Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start using codespell #1267

Merged
merged 3 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion asdf/_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
4 changes: 2 additions & 2 deletions asdf/asdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions asdf/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down Expand Up @@ -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 "<Block {} off: {} alc: {} siz: {}>".format(
return "<Block {} off: {} alc: {} size: {}>".format(
self._array_storage[:3], self._offset, self._allocated, self._size
)

Expand Down Expand Up @@ -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:
"""
Expand Down
2 changes: 1 addition & 1 deletion asdf/tags/core/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion asdf/tags/core/tests/test_external_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
2 changes: 1 addition & 1 deletion asdf/tests/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down
4 changes: 2 additions & 2 deletions asdf/treeutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion asdf/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
2 changes: 1 addition & 1 deletion docs/asdf/arrays.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions docs/asdf/developer_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/asdf/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
"""
WilliamJamieson marked this conversation as resolved.
Show resolved Hide resolved