From e03f45df0eae875ca92b4375687f6719491ea2c5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:57:40 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) - [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32c51d35f9..a3e042e614 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ minimum_pre_commit_version: 1.21.0 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: # Prevent giant files from being committed. - id: check-added-large-files @@ -29,7 +29,7 @@ repos: - id: no-commit-to-branch - repo: https://github.com/codespell-project/codespell - rev: "v2.2.5" + rev: "v2.2.6" hooks: - id: codespell types_or: [asciidoc, python, markdown, rst] From a5a4e2c1efab062acfb8593ecd710d94c90e19cf Mon Sep 17 00:00:00 2001 From: Bill Little Date: Wed, 18 Oct 2023 16:19:05 +0100 Subject: [PATCH 2/2] codespell fixes (#5546) * codespell fixes * add whatsnew entry --- benchmarks/benchmarks/cperf/__init__.py | 2 +- benchmarks/benchmarks/generate_data/stock.py | 2 +- benchmarks/benchmarks/load/__init__.py | 2 +- benchmarks/bm_runner.py | 2 +- docs/gallery_code/meteorology/plot_COP_1d.py | 2 +- docs/src/whatsnew/latest.rst | 4 ++++ lib/iris/_deprecation.py | 2 +- lib/iris/analysis/trajectory.py | 4 ++-- lib/iris/fileformats/netcdf/saver.py | 2 +- lib/iris/pandas.py | 2 +- lib/iris/tests/unit/analysis/test_PERCENTILE.py | 2 +- lib/iris/tests/unit/experimental/ugrid/mesh/test_Mesh.py | 4 ++-- lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py | 2 +- .../unit/plot/test__check_geostationary_coords_and_convert.py | 2 +- 14 files changed, 19 insertions(+), 15 deletions(-) diff --git a/benchmarks/benchmarks/cperf/__init__.py b/benchmarks/benchmarks/cperf/__init__.py index fb311c44dc..814d29338f 100644 --- a/benchmarks/benchmarks/cperf/__init__.py +++ b/benchmarks/benchmarks/cperf/__init__.py @@ -53,7 +53,7 @@ def setup(self, file_type, three_d, three_times): if three_d: create_kwargs["n_levels"] = 71 - # Will re-use a file if already present. + # Will reuse a file if already present. file_path = make_cubesphere_testfile(**create_kwargs) else: diff --git a/benchmarks/benchmarks/generate_data/stock.py b/benchmarks/benchmarks/generate_data/stock.py index eaf46bb405..954e791f43 100644 --- a/benchmarks/benchmarks/generate_data/stock.py +++ b/benchmarks/benchmarks/generate_data/stock.py @@ -39,7 +39,7 @@ def _external(func_name_, temp_file_dir, **kwargs_): ) if not REUSE_DATA or not save_path.is_file(): # The xios functions take control of save location so need to move to - # a more specific name that allows re-use. + # a more specific name that allows reuse. actual_path = run_function_elsewhere( _external, func_name_=func_name, diff --git a/benchmarks/benchmarks/load/__init__.py b/benchmarks/benchmarks/load/__init__.py index 3b2a83b1b1..3d15629f9e 100644 --- a/benchmarks/benchmarks/load/__init__.py +++ b/benchmarks/benchmarks/load/__init__.py @@ -69,7 +69,7 @@ def time_realise(self, _, __, ___, ____) -> None: class STASHConstraint: - # xyz sizes mimic LoadAndRealise to maximise file re-use. + # xyz sizes mimic LoadAndRealise to maximise file reuse. params = [[(2, 2, 2), (1280, 960, 5), (2, 2, 1000)], ["FF", "PP"]] param_names = ["xyz", "file_format"] diff --git a/benchmarks/bm_runner.py b/benchmarks/bm_runner.py index b0f98c04ac..4b8f6e1f18 100644 --- a/benchmarks/bm_runner.py +++ b/benchmarks/bm_runner.py @@ -82,7 +82,7 @@ def _prep_data_gen_env() -> None: else: echo("Setting up the data generation environment ...") # Get Nox to build an environment for the `tests` session, but don't - # run the session. Will re-use a cached environment if appropriate. + # run the session. Will reuse a cached environment if appropriate. _subprocess_runner( [ "nox", diff --git a/docs/gallery_code/meteorology/plot_COP_1d.py b/docs/gallery_code/meteorology/plot_COP_1d.py index bebbad4224..2181b89b8c 100644 --- a/docs/gallery_code/meteorology/plot_COP_1d.py +++ b/docs/gallery_code/meteorology/plot_COP_1d.py @@ -54,7 +54,7 @@ def main(): ) # Generate area-weights array. As e1 and a1b are on the same grid we can - # do this just once and re-use. This method requires bounds on lat/lon + # do this just once and reuse. This method requires bounds on lat/lon # coords, so let's add some in sensible locations using the "guess_bounds" # method. e1.coord("latitude").guess_bounds() diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index 58d94bf5fa..bcc411c773 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -106,6 +106,9 @@ This document explains the changes made to Iris for this release #. `@fazledyn-or`_ replaced ``NotImplementedError`` with ``NotImplemented`` as a proper method call. (:pull:`5544`) +#. `@bjlittle`_ corrected various comment spelling mistakes detected by + `codespell`_. (:pull:`5546`) + .. comment Whatsnew author names (@github name) in alphabetical order. Note that, @@ -120,4 +123,5 @@ This document explains the changes made to Iris for this release Whatsnew resources in alphabetical order: .. _NEP29 Drop Schedule: https://numpy.org/neps/nep-0029-deprecation_policy.html#drop-schedule +.. _codespell: https://github.com/codespell-project/codespell diff --git a/lib/iris/_deprecation.py b/lib/iris/_deprecation.py index 8ad762a558..027e11f2dc 100644 --- a/lib/iris/_deprecation.py +++ b/lib/iris/_deprecation.py @@ -16,7 +16,7 @@ class IrisDeprecation(UserWarning): An Iris deprecation warning. Note this subclasses UserWarning for backwards compatibility with Iris' - original deprection warnings. Should subclass DeprecationWarning at the + original deprecation warnings. Should subclass DeprecationWarning at the next major release. """ diff --git a/lib/iris/analysis/trajectory.py b/lib/iris/analysis/trajectory.py index 84ce89ab6f..2495ff12fc 100644 --- a/lib/iris/analysis/trajectory.py +++ b/lib/iris/analysis/trajectory.py @@ -734,7 +734,7 @@ class UnstructuredNearestNeigbourRegridder: """ - # TODO: cache the necessary bits of the operation so re-use can actually + # TODO: cache the necessary bits of the operation so reuse can actually # be more efficient. def __init__(self, src_cube, target_grid_cube): """ @@ -873,7 +873,7 @@ def __init__(self, src_cube, target_grid_cube): def __call__(self, src_cube): # Check the source cube X and Y coords match the original. # Note: for now, this is sufficient to ensure a valid trajectory - # interpolation, but if in future we save + re-use the cache context + # interpolation, but if in future we save and reuse the cache context # for the 'interpolate' call, we may need more checks here. # Check the given cube against the original. diff --git a/lib/iris/fileformats/netcdf/saver.py b/lib/iris/fileformats/netcdf/saver.py index 1ff69df1f7..cfca507226 100644 --- a/lib/iris/fileformats/netcdf/saver.py +++ b/lib/iris/fileformats/netcdf/saver.py @@ -1009,7 +1009,7 @@ def _add_inner_related_vars( for element in sorted( coordlike_elements, key=lambda element: element.name() ): - # Re-use, or create, the associated CF-netCDF variable. + # Reuse, or create, the associated CF-netCDF variable. cf_name = self._name_coord_map.name(element) if cf_name is None: # Not already present : create it diff --git a/lib/iris/pandas.py b/lib/iris/pandas.py index cb26b638e4..0d0e65d648 100644 --- a/lib/iris/pandas.py +++ b/lib/iris/pandas.py @@ -83,7 +83,7 @@ def _add_iris_coord(cube, name, points, dim, calendar=None): Add a Coord or other dimensional metadata to a Cube from a Pandas index or columns array. """ # Most functionality has been abstracted to _get_dimensional_metadata, - # allowing re-use in as_cube() and as_cubes(). + # allowing reuse in as_cube() and as_cubes(). coord = _get_dimensional_metadata(name, points, calendar) if coord.__class__ == DimCoord: diff --git a/lib/iris/tests/unit/analysis/test_PERCENTILE.py b/lib/iris/tests/unit/analysis/test_PERCENTILE.py index bfd3234d26..a29516c604 100644 --- a/lib/iris/tests/unit/analysis/test_PERCENTILE.py +++ b/lib/iris/tests/unit/analysis/test_PERCENTILE.py @@ -94,7 +94,7 @@ class ScipyAggregateMixin: Tests for calculations specific to the default (scipy) function. Includes tests on masked data and tests to verify that the function is called with the expected keywords. Needs to be used with AggregateMixin, as some of - these tests re-use its method. + these tests reuse its method. """ diff --git a/lib/iris/tests/unit/experimental/ugrid/mesh/test_Mesh.py b/lib/iris/tests/unit/experimental/ugrid/mesh/test_Mesh.py index f39f3706ee..64d106f97d 100644 --- a/lib/iris/tests/unit/experimental/ugrid/mesh/test_Mesh.py +++ b/lib/iris/tests/unit/experimental/ugrid/mesh/test_Mesh.py @@ -72,7 +72,7 @@ def setUpClass(cls): class TestProperties1D(TestMeshCommon): - # Tests that can re-use a single instance for greater efficiency. + # Tests that can reuse a single instance for greater efficiency. @classmethod def setUpClass(cls): super().setUpClass() @@ -737,7 +737,7 @@ def test___str__units_stdname(self): class TestOperations1D(TestMeshCommon): - # Tests that cannot re-use an existing Mesh instance, instead need a new + # Tests that cannot reuse an existing Mesh instance, instead need a new # one each time. def setUp(self): self.mesh = mesh.Mesh( diff --git a/lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py b/lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py index ba7306bded..b95c5f09bb 100644 --- a/lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py +++ b/lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py @@ -578,7 +578,7 @@ def _make_test_meshcoord( edge_xs = self.EDGECOORDS_BASENUM + np.arange(n_edges) face_xs = self.FACECOORDS_BASENUM + np.arange(n_faces) - # Record all these for re-use in tests + # Record all these for reuse in tests self.n_faces = n_faces self.n_nodes = n_nodes self.face_xs = face_xs diff --git a/lib/iris/tests/unit/plot/test__check_geostationary_coords_and_convert.py b/lib/iris/tests/unit/plot/test__check_geostationary_coords_and_convert.py index 633dea85c4..a06a437396 100644 --- a/lib/iris/tests/unit/plot/test__check_geostationary_coords_and_convert.py +++ b/lib/iris/tests/unit/plot/test__check_geostationary_coords_and_convert.py @@ -37,7 +37,7 @@ def setUp(self): ) def _test(self, geostationary=True): - # Re-usable test for when Geostationary is present OR absent. + # Reusable test for when Geostationary is present OR absent. if geostationary: # A Geostationary projection WILL be processed. projection_spec = Geostationary