From 2a6c7e18638ee265636c1ed97ab57d7b2155f295 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Tue, 25 May 2021 17:41:01 +0100 Subject: [PATCH 1/4] update pre-commit packages --- .pre-commit-config.yaml | 6 +++--- requirements/ci/py36.yml | 2 +- requirements/ci/py37.yml | 2 +- requirements/ci/py38.yml | 2 +- requirements/test.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cea9d3585d..0833790fc2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 'v3.4.0' + rev: 'v4.0.1' hooks: # Prevent giant files from being committed. - id: check-added-large-files @@ -17,14 +17,14 @@ repos: # Don't commit to master branch. - id: no-commit-to-branch - repo: https://github.com/psf/black - rev: '20.8b1' + rev: '21.5b1' hooks: - id: black # Force black to run on whole repo, using settings from pyproject.toml pass_filenames: false args: [--config=./pyproject.toml, .] - repo: https://github.com/PyCQA/flake8 - rev: '3.9.0' + rev: '3.9.2' hooks: # Run flake8. - id: flake8 diff --git a/requirements/ci/py36.yml b/requirements/ci/py36.yml index f778704803..1543075948 100644 --- a/requirements/ci/py36.yml +++ b/requirements/ci/py36.yml @@ -34,7 +34,7 @@ dependencies: # Test dependencies. - asv - - black=20.8b1 + - black=21.5b1 - filelock - flake8 - imagehash>=4.0 diff --git a/requirements/ci/py37.yml b/requirements/ci/py37.yml index 5b21e9f778..b7d0ff4157 100644 --- a/requirements/ci/py37.yml +++ b/requirements/ci/py37.yml @@ -34,7 +34,7 @@ dependencies: # Test dependencies. - asv - - black=20.8b1 + - black=21.5b1 - filelock - flake8 - imagehash>=4.0 diff --git a/requirements/ci/py38.yml b/requirements/ci/py38.yml index e09a7a7164..7458b367cd 100644 --- a/requirements/ci/py38.yml +++ b/requirements/ci/py38.yml @@ -34,7 +34,7 @@ dependencies: # Test dependencies. - asv - - black=20.8b1 + - black=21.5b1 - filelock - flake8 - imagehash>=4.0 diff --git a/requirements/test.txt b/requirements/test.txt index ff0e388b03..32c8db4d0a 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,7 +1,7 @@ # Test dependencies. asv -black==20.8b1 +black==21.5b1 filelock imagehash>=4.0 nose From 3ecbc30624778e76cf16a11e39f2eb63a2561c92 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Tue, 25 May 2021 19:27:28 +0100 Subject: [PATCH 2/4] blackify files to new version --- lib/iris/fileformats/netcdf.py | 2 +- lib/iris/tests/integration/test_netcdf.py | 2 +- lib/iris/tests/test_cube_to_pp.py | 2 +- lib/iris/tests/test_file_save.py | 6 +++--- lib/iris/tests/unit/fileformats/test_rules.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/iris/fileformats/netcdf.py b/lib/iris/fileformats/netcdf.py index def393f0a3..206f7526c6 100644 --- a/lib/iris/fileformats/netcdf.py +++ b/lib/iris/fileformats/netcdf.py @@ -2655,7 +2655,7 @@ def save( local_keys.update(different_value_keys) def is_valid_packspec(p): - """ Only checks that the datatype is valid. """ + """Only checks that the datatype is valid.""" if isinstance(p, dict): if "dtype" in p: return is_valid_packspec(p["dtype"]) diff --git a/lib/iris/tests/integration/test_netcdf.py b/lib/iris/tests/integration/test_netcdf.py index 267e5beb50..3bf1e6032e 100644 --- a/lib/iris/tests/integration/test_netcdf.py +++ b/lib/iris/tests/integration/test_netcdf.py @@ -516,7 +516,7 @@ def test_single_packed_signed(self): self._single_test("i2", "single_packed_signed.cdl") def test_single_packed_unsigned(self): - """Test saving a single CF-netCDF file with packing into unsigned. """ + """Test saving a single CF-netCDF file with packing into unsigned.""" self._single_test("u1", "single_packed_unsigned.cdl") def test_single_packed_manual_scale(self): diff --git a/lib/iris/tests/test_cube_to_pp.py b/lib/iris/tests/test_cube_to_pp.py index d0a1e0dcbb..f5d7a4482c 100644 --- a/lib/iris/tests/test_cube_to_pp.py +++ b/lib/iris/tests/test_cube_to_pp.py @@ -275,7 +275,7 @@ def test_365_calendar_export(self): class FakePPEnvironment: - """ fake a minimal PP environment for use in cross-section coords, as in PP save rules """ + """fake a minimal PP environment for use in cross-section coords, as in PP save rules""" y = [1, 2, 3, 4] z = [111, 222, 333, 444] diff --git a/lib/iris/tests/test_file_save.py b/lib/iris/tests/test_file_save.py index 1c2a27c70b..ee48969865 100644 --- a/lib/iris/tests/test_file_save.py +++ b/lib/iris/tests/test_file_save.py @@ -33,7 +33,7 @@ def save_by_filename(filename1, filename2, cube, saver_fn, iosaver=None): - """ Saves a cube to two different filenames using iris.save and the save method of the object representing the file type directly""" + """Saves a cube to two different filenames using iris.save and the save method of the object representing the file type directly""" # Save from object direct saver_fn(cube, filename1) @@ -46,7 +46,7 @@ def save_by_filename(filename1, filename2, cube, saver_fn, iosaver=None): def save_by_filehandle( filehandle1, filehandle2, cube, fn_saver, binary_mode=True ): - """ Saves a cube to two different filehandles using iris.save and the save method of the object representing the file type directly""" + """Saves a cube to two different filehandles using iris.save and the save method of the object representing the file type directly""" mode = "wb" if binary_mode else "w" # Save from object direct @@ -60,7 +60,7 @@ def save_by_filehandle( @tests.skip_data class TestSaveMethods(tests.IrisTest): - """ Base class for file saving tests. Loads data and creates/deletes tempfiles""" + """Base class for file saving tests. Loads data and creates/deletes tempfiles""" def setUp(self): self.cube1 = iris.load_cube( diff --git a/lib/iris/tests/unit/fileformats/test_rules.py b/lib/iris/tests/unit/fileformats/test_rules.py index 00b0e5c540..730ef13f23 100644 --- a/lib/iris/tests/unit/fileformats/test_rules.py +++ b/lib/iris/tests/unit/fileformats/test_rules.py @@ -238,7 +238,7 @@ def converter(field): class Test_scalar_cell_method(tests.IrisTest): - """ Tests for iris.fileformats.rules.scalar_cell_method() function """ + """Tests for iris.fileformats.rules.scalar_cell_method() function""" def setUp(self): self.cube = stock.simple_2d() From 4678646ec09eceb1613a72620366f7a709c06085 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Wed, 26 May 2021 15:25:01 +0100 Subject: [PATCH 3/4] review actions --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index bf6c95acf6..848243eac4 100755 --- a/noxfile.py +++ b/noxfile.py @@ -190,7 +190,7 @@ def black(session: nox.sessions.Session): """ # Pip install the session requirements. - session.install("black==20.8b1") + session.install("black==21.5b1") # Execute the black format checker on the package. session.run("black", "--check", PACKAGE) # Execute the black format checker on this file. From 11db24184080ec65c7a9a126c3634ed0b7be2f05 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Wed, 26 May 2021 15:42:51 +0100 Subject: [PATCH 4/4] update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 353f3df53f..31bc0bca0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 79 -target-version = ['py36', 'py37'] +target-version = ['py36', 'py37', 'py38'] include = '\.pyi?$' exclude = '''