From 138f06025dbd5ce2f1c172b7bf2806ed9b1bfcb6 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 17 Jul 2024 12:59:48 -0500 Subject: [PATCH] Add typos CI, fix typos --- .github/workflows/ci.yml | 7 +++++++ pytools/__init__.py | 8 ++++---- pytools/prefork.py | 4 ++-- pytools/py_codegen.py | 2 +- pytools/tag.py | 2 +- pytools/test/test_persistent_dict.py | 2 +- typos.toml | 4 ++++ 7 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 typos.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1229bee..3df093d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,13 @@ jobs: pip install ruff ruff check + typos: + name: Typos + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@master + validate_cff: name: Validate CITATION.cff runs-on: ubuntu-latest diff --git a/pytools/__init__.py b/pytools/__init__.py index 2536f46e..80ec93a4 100644 --- a/pytools/__init__.py +++ b/pytools/__init__.py @@ -826,7 +826,7 @@ def memoize_method( .. versionchanged:: 2021.2 Can memoize methods on classes that do not allow setting attributes - (e.g. by overwritting ``__setattr__``), e.g. frozen :mod:`dataclasses`. + (e.g. by overwriting ``__setattr__``), e.g. frozen :mod:`dataclasses`. """ return memoize_on_first_arg(method, @@ -905,7 +905,7 @@ class keyed_memoize_method(keyed_memoize_on_first_arg): # noqa: N801 .. versionchanged:: 2021.2 Can memoize methods on classes that do not allow setting attributes - (e.g. by overwritting ``__setattr__``), e.g. frozen :mod:`dataclasses`. + (e.g. by overwriting ``__setattr__``), e.g. frozen :mod:`dataclasses`. """ def _default_cache_dict_name(self, function): return intern(f"_memoize_dic_{function.__name__}") @@ -931,7 +931,7 @@ class memoize_in: # noqa: N801 .. versionchanged:: 2021.2.1 Can now use instances of classes as *container* that do not allow - setting attributes (e.g. by overwritting ``__setattr__``), + setting attributes (e.g. by overwriting ``__setattr__``), e.g. frozen :mod:`dataclasses`. """ @@ -2787,7 +2787,7 @@ def unordered_hash(hash_instance: Any, *hash_constructor*, return a hash object whose internal state depends on the entries of *iterable*, but not their order. If *hash* is the instance returned by evaluating ``hash_constructor()``, then - the each entry *i* of the iterable must permit ``hash.upate(i)`` to + the each entry *i* of the iterable must permit ``hash.update(i)`` to succeed. An example of *hash_constructor* is ``hashlib.sha256`` from :mod:`hashlib`. ``hash.digest_size`` must also be defined. If *hash_constructor* is not provided, ``hash_instance.name`` is diff --git a/pytools/prefork.py b/pytools/prefork.py index c10dfc23..6f612df3 100644 --- a/pytools/prefork.py +++ b/pytools/prefork.py @@ -1,6 +1,6 @@ -"""OpenMPI, once intialized, prohibits forking. This helper module +"""OpenMPI, once initialized, prohibits forking. This helper module allows the forking of *one* helper child process before OpenMPI -initializaton that can do the forking for the fork-challenged +initialization that can do the forking for the fork-challenged parent process. Since none of this is MPI-specific, it got parked in pytools. diff --git a/pytools/py_codegen.py b/pytools/py_codegen.py index 887497c0..76fb3b40 100644 --- a/pytools/py_codegen.py +++ b/pytools/py_codegen.py @@ -136,7 +136,7 @@ def __setstate__(self, obj): # {{{ picklable function class PicklableFunction: - """Convience class wrapping a function in a :class:`PicklableModule`. + """Convenience class wrapping a function in a :class:`PicklableModule`. """ def __init__(self, module, name): diff --git a/pytools/tag.py b/pytools/tag.py index 916293dc..336df880 100644 --- a/pytools/tag.py +++ b/pytools/tag.py @@ -257,7 +257,7 @@ class Taggable: if not TYPE_CHECKING: def __init__(self, tags: FrozenSet[Tag] = frozenset()): warn("The Taggable constructor is deprecated. " - "Subclasses must declare their onwn storage for .tags. " + "Subclasses must declare their own storage for .tags. " "The constructor will disappear in 2025.x.", DeprecationWarning, stacklevel=2) diff --git a/pytools/test/test_persistent_dict.py b/pytools/test/test_persistent_dict.py index 151ac030..b04d43a0 100644 --- a/pytools/test/test_persistent_dict.py +++ b/pytools/test/test_persistent_dict.py @@ -683,7 +683,7 @@ def test_datetime_hashing() -> None: assert (keyb(datetime.datetime(2020, 1, 1)) == keyb(datetime.datetime(2020, 1, 1)) == keyb(datetime.datetime(2020, 1, 1, 0, 0, 0, 0)) - == "215dbe82add7a55c" + == "215dbe82add7a55c" # spellchecker: disable-line ) assert keyb(datetime.datetime(2020, 1, 1)) != keyb(datetime.datetime(2020, 1, 2)) assert (keyb(datetime.datetime(2020, 1, 1)) diff --git a/typos.toml b/typos.toml new file mode 100644 index 00000000..9d260f95 --- /dev/null +++ b/typos.toml @@ -0,0 +1,4 @@ +[default] +extend-ignore-re = [ + "(?Rm)^.*(#|//)\\s*spellchecker:\\s*disable-line$" +]