From 6707d012377a7e4d51dd8dc927f11cf181df5bf4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 6 Jan 2025 00:31:24 +0100 Subject: [PATCH] Fixed typos discovered by codespell (#855) --- .pre-commit-config.yaml | 11 +++++++++-- docs/versionhistory.rst | 2 +- pyproject.toml | 3 +++ src/anyio/_core/_fileio.py | 2 +- src/anyio/abc/_streams.py | 2 +- src/anyio/from_thread.py | 2 +- tests/test_synchronization.py | 4 ++-- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 620a059d..3c243d59 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,15 +21,22 @@ repos: args: [ "--fix=lf" ] - id: trailing-whitespace + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + additional_dependencies: + - tomli + - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.4 + rev: v0.8.6 hooks: - id: ruff args: [--fix, --show-fixes] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.0 + rev: v1.14.1 hooks: - id: mypy additional_dependencies: diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst index 5834c6cc..5c75f286 100644 --- a/docs/versionhistory.rst +++ b/docs/versionhistory.rst @@ -83,7 +83,7 @@ contain the changes from v4.5.1. As Python 3.8 support was dropped in v4.6.0, this interim release was created to bring a regression fix to Python 3.8, and adds a few other fixes also present in v4.6.1. -- Fixed acquring a lock twice in the same task on asyncio hanging instead of raising a +- Fixed acquiring a lock twice in the same task on asyncio hanging instead of raising a ``RuntimeError`` (`#798 `_) - Fixed an async fixture's ``self`` being different than the test's ``self`` in class-based tests (`#633 `_) diff --git a/pyproject.toml b/pyproject.toml index b8a9ea2f..45e17608 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,6 +112,9 @@ markers = [ "network: marks tests as requiring Internet access", ] +[tool.codespell] +ignore-words-list = "asend,daa,hel" + [tool.coverage.run] source = ["anyio"] relative_files = true diff --git a/src/anyio/_core/_fileio.py b/src/anyio/_core/_fileio.py index 4e34f2ad..e7243d18 100644 --- a/src/anyio/_core/_fileio.py +++ b/src/anyio/_core/_fileio.py @@ -231,7 +231,7 @@ class Path: * :meth:`~pathlib.Path.from_uri` (available on Python 3.13 or later) * :meth:`~pathlib.Path.full_match` (available on Python 3.13 or later) * :meth:`~pathlib.Path.is_junction` (available on Python 3.12 or later) - * :meth:`~pathlib.Path.match` (the ``case_sensitive`` paramater is only available on + * :meth:`~pathlib.Path.match` (the ``case_sensitive`` parameter is only available on Python 3.13 or later) * :meth:`~pathlib.Path.move` (available on Python 3.14 or later) * :meth:`~pathlib.Path.move_into` (available on Python 3.14 or later) diff --git a/src/anyio/abc/_streams.py b/src/anyio/abc/_streams.py index 8c638683..f11d97b5 100644 --- a/src/anyio/abc/_streams.py +++ b/src/anyio/abc/_streams.py @@ -137,7 +137,7 @@ async def receive(self, max_bytes: int = 65536) -> bytes: """ Receive at most ``max_bytes`` bytes from the peer. - .. note:: Implementors of this interface should not return an empty + .. note:: Implementers of this interface should not return an empty :class:`bytes` object, and users should ignore them. :param max_bytes: maximum number of bytes to receive diff --git a/src/anyio/from_thread.py b/src/anyio/from_thread.py index 93a4cfe8..61790973 100644 --- a/src/anyio/from_thread.py +++ b/src/anyio/from_thread.py @@ -248,7 +248,7 @@ def _spawn_task_from_thread( """ Spawn a new task using the given callable. - Implementors must ensure that the future is resolved when the task finishes. + Implementers must ensure that the future is resolved when the task finishes. :param func: a callable :param args: positional arguments to be passed to the callable diff --git a/tests/test_synchronization.py b/tests/test_synchronization.py index 92a7a5a2..964c980e 100644 --- a/tests/test_synchronization.py +++ b/tests/test_synchronization.py @@ -197,7 +197,7 @@ async def test_cancel_after_release(self) -> None: task1 = loop.create_task(lock.acquire(), name="task1") await asyncio.sleep(0) - # Trigger the aqcuiring task to be rescheduled, but also cancel it right away + # Trigger the acquiring task to be rescheduled, but also cancel it right away lock.release() task1.cancel() statistics = lock.statistics() @@ -598,7 +598,7 @@ async def test_cancel_after_release(self) -> None: task1 = loop.create_task(semaphore.acquire()) await asyncio.sleep(0) - # Trigger the aqcuiring task to be rescheduled, but also cancel it right away + # Trigger the acquiring task to be rescheduled, but also cancel it right away semaphore.release() task1.cancel() assert semaphore.value == 0