Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 18, 2024
1 parent df70eea commit ece9f03
Show file tree
Hide file tree
Showing 88 changed files with 140 additions and 47 deletions.
1 change: 1 addition & 0 deletions benchmarks/benchmarks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Common code for benchmarks."""

from os import environ
import resource

Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/cperf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Files available from the UK Met Office:
moo ls moose:/adhoc/projects/avd/asv/data_for_nightly_tests/
"""

import numpy as np

from iris import load_cube
Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/cperf/equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Equality benchmarks for the CPerf scheme of the UK Met Office's NG-VAT project."""

from .. import on_demand_benchmark
from . import SingleDiagnosticMixin

Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/cperf/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""File loading benchmarks for the CPerf scheme of the UK Met Office's NG-VAT project."""

from .. import on_demand_benchmark
from . import SingleDiagnosticMixin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
run-time that scale with data size.
"""

import os

import dask.array as da
Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/generate_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
benchmark sequence runs over two different Python versions.
"""

from contextlib import contextmanager
from inspect import getsource
from os import environ
Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/generate_data/ugrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Scripts for generating supporting data for UGRID-related benchmarking."""

from iris import load_cube as iris_loadcube
from iris.experimental.ugrid import PARSE_UGRID_ON_LOAD

Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/iterate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Iterate benchmark tests."""

import numpy as np

from iris import coords, cube, iterate
Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Plot benchmark tests."""

import matplotlib as mpl
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
run-time that scale with data size.
"""

from iris import save
from iris.experimental.ugrid import save_mesh

Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/sperf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
SPerf = assessing performance against a series of increasingly large LFRic
datasets.
"""

from iris import load_cube

# TODO: remove uses of PARSE_UGRID_ON_LOAD once UGRID parsing is core behaviour.
Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/sperf/combine_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Region combine benchmarks for the SPerf scheme of the UK Met Office's NG-VAT project."""

import os.path

from dask import array as da
Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/sperf/equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Equality benchmarks for the SPerf scheme of the UK Met Office's NG-VAT project."""

from .. import on_demand_benchmark
from . import FileMixin

Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/sperf/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""File loading benchmarks for the SPerf scheme of the UK Met Office's NG-VAT project."""

from .. import on_demand_benchmark
from . import FileMixin

Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/sperf/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""File saving benchmarks for the SPerf scheme of the UK Met Office's NG-VAT project."""

import os.path

from iris import save
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery_code/oceanography/plot_load_nemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def main():

# Include the point's position in the plot's title
lat_point = cube.coord("latitude").points[y_point_index, x_point_index]
lat_string = "{:.3f}\u00B0 {}".format(
lat_string = "{:.3f}\u00b0 {}".format(
abs(lat_point), "N" if lat_point > 0.0 else "S"
)
lon_point = cube.coord("longitude").points[y_point_index, x_point_index]
lon_string = "{:.3f}\u00B0 {}".format(
lon_string = "{:.3f}\u00b0 {}".format(
abs(lon_point), "E" if lon_point > 0.0 else "W"
)
plt.title("{} at {} {}".format(cube.long_name.capitalize(), lat_string, lon_string))
Expand Down
1 change: 1 addition & 0 deletions docs/src/userguide/plotting_examples/cube_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Can use iris.plot.contour() or iris.quicplot.contour().
"""

import matplotlib.pyplot as plt

import iris
Expand Down
1 change: 1 addition & 0 deletions docs/src/userguide/plotting_examples/cube_contourf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Can use iris.plot.contour() or iris.quickplot.contour().
"""

import matplotlib.pyplot as plt

import iris
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Global cube masked to Brazil and plotted with quickplot."""

import cartopy.io.shapereader as shpreader
import matplotlib.pyplot as plt

Expand Down
1 change: 1 addition & 0 deletions lib/iris/_representation/cube_printout.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Provides text printouts of Iris cubes."""

from copy import deepcopy

from iris._representation.cube_summary import CubeSummary
Expand Down
1 change: 1 addition & 0 deletions lib/iris/_representation/cube_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Provides objects describing cube summaries."""

import re

from iris.common.metadata import hexdigest
Expand Down
1 change: 1 addition & 0 deletions lib/iris/common/_split_attribute_dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
So, we simply treat "global" and "local" attributes of the same name as entirely
independent. Which happily is also the easiest to code, and to explain.
"""

from collections.abc import Mapping, Sequence
from functools import wraps

Expand Down
1 change: 0 additions & 1 deletion lib/iris/common/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# See LICENSE in the root of the repository for full licensing details.
"""Provides the infrastructure to support the common metadata API."""


from abc import ABCMeta
from collections import namedtuple
from collections.abc import Iterable, Mapping
Expand Down
1 change: 1 addition & 0 deletions lib/iris/experimental/regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
discuss how to replace it or to retain it.
"""

import copy
import functools
import warnings
Expand Down
1 change: 1 addition & 0 deletions lib/iris/experimental/ugrid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
definition at :const:`iris.experimental.ugrid.load.PARSE_UGRID_ON_LOAD`.
"""

from ...config import get_logger
from .load import PARSE_UGRID_ON_LOAD, load_mesh, load_meshes
from .mesh import Connectivity, Mesh, MeshCoord
Expand Down
1 change: 1 addition & 0 deletions lib/iris/experimental/ugrid/cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Eventual destination: :mod:`iris.fileformats.cf`.
"""

import warnings

from ...fileformats import cf
Expand Down
1 change: 1 addition & 0 deletions lib/iris/experimental/ugrid/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Eventual destination: :mod:`iris.fileformats.netcdf`.
"""

from contextlib import contextmanager
from itertools import groupby
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions lib/iris/experimental/ugrid/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Eventual destination: dedicated module in :mod:`iris` root.
"""

from abc import ABC, abstractmethod
from collections import namedtuple
from collections.abc import Container
Expand Down
1 change: 1 addition & 0 deletions lib/iris/experimental/ugrid/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Eventual destination: :mod:`iris.common.metadata`.
"""

from functools import wraps

from ...common import BaseMetadata
Expand Down
1 change: 1 addition & 0 deletions lib/iris/experimental/ugrid/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Eventual destination: :mod:`iris.fileformats.netcdf`.
"""

from collections.abc import Iterable

from ...fileformats import netcdf
Expand Down
1 change: 1 addition & 0 deletions lib/iris/experimental/ugrid/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# See LICENSE in the root of the repository for full licensing details.

"""Utility operations specific to unstructured data."""

from typing import AnyStr, Iterable, Union

import dask.array as da
Expand Down
1 change: 1 addition & 0 deletions lib/iris/fileformats/_nc_load_rules/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
used in :meth:`iris.fileformats.netcdf._actions_activation_stats`.
"""

from .actions import run_actions


Expand Down
1 change: 1 addition & 0 deletions lib/iris/fileformats/_nc_load_rules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
build routines, and which it does not use.
"""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions lib/iris/fileformats/netcdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Also : `CF Conventions <https://cfconventions.org/>`_.
"""

import iris.config

# Note: *must* be done before importing from submodules, as they also use this !
Expand Down
1 change: 1 addition & 0 deletions lib/iris/fileformats/netcdf/_dask_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
'distributed.Lock', which requires a distributed scheduler to function.
"""

import threading

import dask.array
Expand Down
1 change: 1 addition & 0 deletions lib/iris/fileformats/netcdf/_thread_safe_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Intention is that no other Iris module should import the netCDF4 module.
"""

from abc import ABC
from threading import Lock
import typing
Expand Down
1 change: 1 addition & 0 deletions lib/iris/fileformats/netcdf/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Also : `CF Conventions <https://cfconventions.org/>`_.
"""

from collections.abc import Iterable, Mapping
from contextlib import contextmanager
from copy import deepcopy
Expand Down
1 change: 1 addition & 0 deletions lib/iris/fileformats/netcdf/saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Also : `CF Conventions <https://cfconventions.org/>`_.
"""

import collections
from itertools import repeat, zip_longest
import os
Expand Down
1 change: 0 additions & 1 deletion lib/iris/fileformats/um/_optimal_array_structuring.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# See LICENSE in the root of the repository for full licensing details.
"""A module to provide an optimal array structure calculation."""


from iris.fileformats._structured_array_identification import GroupStructure


Expand Down
1 change: 1 addition & 0 deletions lib/iris/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
See also: https://pandas.pydata.org/
"""

import datetime
from itertools import chain, combinations
import warnings
Expand Down
1 change: 1 addition & 0 deletions lib/iris/tests/integration/experimental/test_ugrid_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
standard behaviour.
"""

# Import iris.tests first so that some things can be initialised before
# importing anything else.
import iris.tests as tests # isort:skip
Expand Down
1 change: 1 addition & 0 deletions lib/iris/tests/integration/experimental/test_ugrid_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Integration tests for NetCDF-UGRID file saving."""

# Import iris.tests first so that some things can be initialised before
# importing anything else.
import iris.tests as tests # isort:skip
Expand Down
1 change: 1 addition & 0 deletions lib/iris/tests/integration/netcdf/test__dask_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
and (b) mock-ist testing of the implementation code in isolation would not add anything
of much value.
"""

import dask
import dask.config
import distributed
Expand Down
17 changes: 10 additions & 7 deletions lib/iris/tests/integration/netcdf/test_aux_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ def test_save_load_loop(self):
# Tests an issue where the variable names in the formula
# terms changed to the standard_names instead of the variable names
# when loading a previously saved cube.
with self.temp_filename(suffix=".nc") as filename, self.temp_filename(
suffix=".nc"
) as other_filename:
with (
self.temp_filename(suffix=".nc") as filename,
self.temp_filename(suffix=".nc") as other_filename,
):
iris.save(self.cube, filename)
cube = iris.load_cube(filename, "air_potential_temperature")
iris.save(cube, other_filename)
Expand Down Expand Up @@ -117,8 +118,9 @@ def test_shared_primary(self):
)
factory.rename("another altitude")
cube.add_aux_factory(factory)
with self.temp_filename(suffix=".nc") as filename, self.assertRaisesRegex(
ValueError, "multiple aux factories"
with (
self.temp_filename(suffix=".nc") as filename,
self.assertRaisesRegex(ValueError, "multiple aux factories"),
):
iris.save(cube, filename)

Expand All @@ -141,8 +143,9 @@ def test_hybrid_height_cubes_on_dimension_coordinate(self):
sa = hh2.coord("surface_altitude")
sa.points = sa.points * 10
emsg = "Unable to create dimensonless vertical coordinate."
with self.temp_filename(".nc") as fname, self.assertRaisesRegex(
ValueError, emsg
with (
self.temp_filename(".nc") as fname,
self.assertRaisesRegex(ValueError, emsg),
):
iris.save([hh1, hh2], fname)

Expand Down
1 change: 1 addition & 0 deletions lib/iris/tests/integration/netcdf/test_delayed_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Integration tests for delayed saving."""

import re
import warnings

Expand Down
Loading

0 comments on commit ece9f03

Please sign in to comment.