Skip to content

Commit

Permalink
ruff compliance for D409 and D410. (#5662)
Browse files Browse the repository at this point in the history
* ruff compliance for D409 and D410.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix doctest.

* fix line

* fix doctest.

* fix merge

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
tkknight and pre-commit-ci[bot] committed Dec 20, 2023
1 parent 3383f00 commit a3410ce
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 82 deletions.
2 changes: 0 additions & 2 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ lint.ignore = [
"D405", # Section name should be properly capitalized
"D406", # Section name should end with a newline
"D407", # Missing dashed underline after section
"D409", # Section underline should match the length of its name
"D410", # Missing blank line after section

# pyupgrade (UP)
# https://docs.astral.sh/ruff/rules/#pyupgrade-up
Expand Down
8 changes: 4 additions & 4 deletions lib/iris/analysis/cartography.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def wrap_lons(lons, base, period):
[-175. 30. 160. 75.]
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
"""
Expand Down Expand Up @@ -258,7 +258,7 @@ def get_xy_grids(cube):
x, y = get_xy_grids(cube)
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
"""
Expand Down Expand Up @@ -289,7 +289,7 @@ def get_xy_contiguous_bounded_grids(cube):
xs, ys = get_xy_contiguous_bounded_grids(cube)
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down Expand Up @@ -499,7 +499,7 @@ def cosine_latitude_weights(cube):
weights = np.sqrt(cosine_latitude_weights(cube))
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
"""
Expand Down
22 changes: 11 additions & 11 deletions lib/iris/analysis/maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def abs(cube, in_place=False):
An instance of :class:`iris.cube.Cube`.
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down Expand Up @@ -154,7 +154,7 @@ def intersection_of_cubes(cube, other_cube):
cube1, cube2 = (intersections[0], intersections[1])
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down Expand Up @@ -236,7 +236,7 @@ def add(cube, other, dim=None, in_place=False):
iris.cube.Cube
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down Expand Up @@ -289,7 +289,7 @@ def subtract(cube, other, dim=None, in_place=False):
iris.cube.Cube
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down Expand Up @@ -392,7 +392,7 @@ def multiply(cube, other, dim=None, in_place=False):
iris.cube.Cube
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
"""
Expand Down Expand Up @@ -476,7 +476,7 @@ def divide(cube, other, dim=None, in_place=False):
iris.cube.Cube
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
"""
Expand Down Expand Up @@ -542,7 +542,7 @@ def exponentiate(cube, exponent, in_place=False):
An instance of :class:`iris.cube.Cube`.
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
"""
Expand Down Expand Up @@ -593,7 +593,7 @@ def exp(cube, in_place=False):
An instance of :class:`iris.cube.Cube`.
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down Expand Up @@ -623,7 +623,7 @@ def log(cube, in_place=False):
An instance of :class:`iris.cube.Cube`.
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down Expand Up @@ -657,7 +657,7 @@ def log2(cube, in_place=False):
An instance of :class:`iris.cube.Cube`.
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down Expand Up @@ -687,7 +687,7 @@ def log10(cube, in_place=False):
An instance of :class:`iris.cube.Cube`.
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/analysis/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def interpolate(cube, sample_points, method=None):
interpolated_cube = interpolate(cube, sample_points)
Notes
------
-----
This function does not maintain laziness when called; it realises data.
See more at :doc:`/userguide/real_and_lazy_data`.
"""
Expand Down
6 changes: 3 additions & 3 deletions lib/iris/common/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Resolve:
>>> resolver = Resolve(cube1, cube2)
>>> results = [resolver.cube(data) for data in payload]
""" # noqa: D214, D411
""" # noqa: D214, D410, D411

def __init__(self, lhs=None, rhs=None):
"""Resolve the provided ``lhs`` :class:`~iris.cube.Cube` operand and
Expand Down Expand Up @@ -2493,7 +2493,7 @@ def mapped(self):
>>> resolver.map_rhs_to_lhs
False
""" # noqa: D214, D411
""" # noqa: D214, D410, D411
result = None
if self.mapping is not None:
result = self._src_cube.ndim == len(self.mapping)
Expand Down Expand Up @@ -2554,5 +2554,5 @@ def shape(self):
>>> Resolve(cube2, cube1).shape
(240, 37, 49)
""" # noqa: D214, D411
""" # noqa: D214, D410, D411
return self._broadcast_shape
3 changes: 2 additions & 1 deletion lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -4517,7 +4517,8 @@ def rolling_window(self, coord, aggregator, window, **kwargs):
Notice that the forecast_period dimension now represents the 4
possible windows of size 3 from the original cube.
""" # noqa: D214, D411
""" # noqa: D214, D410, D411

# Update weights kwargs (if necessary) to handle different types of
# weights
weights_info = None
Expand Down
3 changes: 1 addition & 2 deletions lib/iris/fileformats/dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,7 @@ def _dot_node(indent, id, name, attributes):
The visual name of the node.
attributes:
An iterable of (name, value) attribute pairs.
""" # noqa: D411
""" # noqa: D410, D411
attributes = r"\n".join("%s: %s" % item for item in attributes)
template = """%(indent)s"%(id)s" [
%(indent)s label = "%(name)s|%(attributes)s"
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/iterate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def izip(*cubes, **kwargs):
... pass
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def cmap_norm(cube):
:class:`iris.palette.SymmetricNormalize`
Notes
------
-----
This function maintains laziness when called; it does not realise data.
See more at :doc:`/userguide/real_and_lazy_data`.
Expand Down
6 changes: 3 additions & 3 deletions lib/iris/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def as_cubes(
:class:`~iris.coords.AncillaryVariable` objects.
Returns
--------
-------
:class:`~iris.cube.CubeList`
One :class:`~iris.cube.Cube` for each column not referenced in
`aux_coord_cols`/`cell_measure_cols`/`ancillary_variable_cols`.
Expand Down Expand Up @@ -584,7 +584,7 @@ def as_series(cube, copy=True):
make sure it is not masked and use copy=False.
Notes
------
-----
Since this function converts to/from a Pandas object, laziness will not be preserved.
"""
Expand Down Expand Up @@ -797,7 +797,7 @@ def as_data_frame(
Name: surface_temperature, Length: 419904, dtype: float32
Notes
------
-----
Since this function converts to/from a Pandas object, laziness will not be preserved.
"""
Expand Down
Loading

0 comments on commit a3410ce

Please sign in to comment.