diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 60b2d423d..1e444c75d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,6 +27,14 @@ repos: - id: rst-inline-touching-normal - id: text-unicode-replacement-char +- repo: https://github.com/codespell-project/codespell + rev: v2.2.2 + hooks: + - id: codespell + args: ["--write-changes"] + additional_dependencies: + - tomli + - repo: https://github.com/charliermarsh/ruff-pre-commit rev: 'v0.0.170' hooks: diff --git a/asdf/_display.py b/asdf/_display.py index ea98be666..febf5cdee 100644 --- a/asdf/_display.py +++ b/asdf/_display.py @@ -191,7 +191,7 @@ def _render(self, info, active_depths, is_tail): is_tail indicates if the child is the last of the children, needed to indicate the proper connecting character in the tree - display. Likewise, active_depths is used to track which preceeding + display. Likewise, active_depths is used to track which preceding depths are incomplete thus need continuing lines preceding in the tree display. """ diff --git a/asdf/asdf.py b/asdf/asdf.py index 9f9428e32..2db1cc231 100644 --- a/asdf/asdf.py +++ b/asdf/asdf.py @@ -754,7 +754,7 @@ def _parse_header_line(cls, line): try: version = versioning.AsdfVersion(parts[1].decode("ascii")) except ValueError: - raise ValueError(f"Unparseable version in ASDF file: {parts[1]}") + raise ValueError(f"Unparsable version in ASDF file: {parts[1]}") return version @@ -947,7 +947,7 @@ def _open_generic_file( try: # TODO: this feels a bit circular, try to clean up. Also # this introduces another dependency on astropy which may - # not be desireable. + # not be desirable. from . import fits_embed return fits_embed.AsdfInFits._open_impl( diff --git a/asdf/block.py b/asdf/block.py index 19668bd43..5b51868e0 100644 --- a/asdf/block.py +++ b/asdf/block.py @@ -757,7 +757,7 @@ def add_inline(self, array): def get_output_compressions(self): """ - Get the list of unqiue compressions used on blocks. + Get the list of unique compressions used on blocks. """ return list({b.output_compression for b in self.blocks}) @@ -820,7 +820,7 @@ def __init__(self, data=None, uri=None, array_storage="internal", memmap=True, l self._allocated = self._size def __repr__(self): - return "".format( + return "".format( self._array_storage[:3], self._offset, self._allocated, self._size ) @@ -904,7 +904,7 @@ def output_compression(self, compression): @property def output_compression_kwargs(self): """ - The configuration options to the Compressor constructur + The configuration options to the Compressor constructor used to write the block. :return: """ diff --git a/asdf/tags/core/ndarray.py b/asdf/tags/core/ndarray.py index ff139db4b..48e366106 100644 --- a/asdf/tags/core/ndarray.py +++ b/asdf/tags/core/ndarray.py @@ -436,7 +436,7 @@ def to_tree(cls, data, ctx): block = ctx.blocks.find_or_create_block_for_array(data, ctx) if block.array_storage == "fits": - # Views over arrays stored in FITS files have some idiosyncracies. + # Views over arrays stored in FITS files have some idiosyncrasies. # astropy.io.fits always writes arrays C-contiguous with big-endian # byte order, whereas asdf preserves the "contiguousity" and byte order # of the base array. diff --git a/asdf/tags/core/tests/test_external_reference.py b/asdf/tags/core/tests/test_external_reference.py index 808829f58..0db3d256e 100644 --- a/asdf/tags/core/tests/test_external_reference.py +++ b/asdf/tags/core/tests/test_external_reference.py @@ -3,7 +3,7 @@ def test_roundtrip_external_array(tmpdir): - ref = ExternalArrayReference("./nonexistant.fits", 1, "np.float64", (100, 100)) + ref = ExternalArrayReference("./nonexistent.fits", 1, "np.float64", (100, 100)) tree = {"nothere": ref} diff --git a/asdf/tests/test_extension.py b/asdf/tests/test_extension.py index 1881032cd..d99e54114 100644 --- a/asdf/tests/test_extension.py +++ b/asdf/tests/test_extension.py @@ -229,7 +229,7 @@ def test_extension_proxy(): with pytest.raises(TypeError): ExtensionProxy(FullExtension(compressors=[object()])) - # Unparseable ASDF Standard requirement: + # Unparsable ASDF Standard requirement: with pytest.raises(ValueError): ExtensionProxy(FullExtension(asdf_standard_requirement="asdf-standard >= 1.4.0")) diff --git a/asdf/treeutil.py b/asdf/treeutil.py index 9bb0720d0..7f4347081 100644 --- a/asdf/treeutil.py +++ b/asdf/treeutil.py @@ -356,7 +356,7 @@ def _handle_immutable_sequence(node, json_id): result._tag = node._tag except TypeError: # The derived class signature is different, so simply store the - # list representing the contents. Currently this is primarly + # list representing the contents. Currently this is primarily # intended to handle namedtuple and NamedTuple instances. if not ignore_implicit_conversion: warnings.warn(f"Failed to serialize instance of {type(node)}, converting to list instead", AsdfWarning) @@ -384,7 +384,7 @@ def _recurse(node, json_id=None): # to the same object id. return _context[node] - # Inform the context that we're going to start modifing + # Inform the context that we're going to start modifying # this node. with _context.pending(node): # Take note of the "id" field, in case we're modifying diff --git a/asdf/types.py b/asdf/types.py index dd53cf63e..129e41073 100644 --- a/asdf/types.py +++ b/asdf/types.py @@ -363,7 +363,7 @@ def incompatible_version(cls, version): compatible. Child classes can override this method to affect how version - compatiblity for this type is determined. + compatibility for this type is determined. Parameters ---------- diff --git a/docs/asdf/arrays.rst b/docs/asdf/arrays.rst index 55a38d72b..ba9f79f5c 100644 --- a/docs/asdf/arrays.rst +++ b/docs/asdf/arrays.rst @@ -100,7 +100,7 @@ see :ref:`config_options_array_inline_threshold`. Saving external arrays ---------------------- -ASDF files may also be saved in "exploded form", which creats multiple files +ASDF files may also be saved in "exploded form", which creates multiple files corresponding to the following data items: - One ASDF file containing only the header and tree. diff --git a/docs/asdf/developer_overview.rst b/docs/asdf/developer_overview.rst index fa9da682b..736629e5e 100644 --- a/docs/asdf/developer_overview.rst +++ b/docs/asdf/developer_overview.rst @@ -191,7 +191,7 @@ When an ``AsdfFile`` class is instantiated, one thing that happens on the retrieves the extensions from the global config and selects those that are compatible with the ``AsdfFile``'s ASDF Standard version. It returns the resulting list, which is assigned to the ``_plugin_extensions`` variable. The -term "plugin extensions" constrasts with "user extensions" which are additional +term "plugin extensions" contrasts with "user extensions" which are additional extensions provided by the user as an argument to ``AsdfFile.__init__``. The extension lists are used by ``AsdfFile`` to create the file's ``ExtensionList`` @@ -298,7 +298,7 @@ tagged_tree is then returned to the ``af`` instance (still running the (This is the major reason that the tree isn't directly converted to an object tree since jsonschema would not be able to use the final object tree for validation, besides issues relate to the fact that things that don't validate -may not be convertable to the designated object.) +may not be convertible to the designated object.) The validate machinery is a bit confusing since there are essentially two basic approaches to how validation is done. One type of validation is for validation diff --git a/docs/asdf/features.rst b/docs/asdf/features.rst index be3cf5f2a..2614da6de 100644 --- a/docs/asdf/features.rst +++ b/docs/asdf/features.rst @@ -659,7 +659,7 @@ a child node of the current tree root: Regular expression searches --------------------------- -Any string argument to search is interpeted as a regular expression. For example, +Any string argument to search is interpreted as a regular expression. For example, we can search for nodes whose keys start with a particular string: .. code:: pycon diff --git a/pyproject.toml b/pyproject.toml index 4c03379e0..c439ac8b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,3 +166,9 @@ extend_skip_glob = ["asdf/extern/*", ".eggs/*", ".tox/*"] [tool.ruff] line-length = 120 extend-exclude = ["asdf/extern/*", "docs/*"] + +[tool.codespell] +skip="*.pdf,*.fits,*.asdf,.tox,asdf/extern,build,./tags,.git,docs/_build" +ignore-words-list=""" +fo, +"""