From 203d6d20a26400231f8dd8130ab48fc1bb9c7708 Mon Sep 17 00:00:00 2001 From: tkknight <2108488+tkknight@users.noreply.github.com> Date: Tue, 19 Dec 2023 16:51:33 +0000 Subject: [PATCH 1/2] ruff rule D208 compliance. (#5656) --- .ruff.toml | 1 - .../unit/analysis/geometry/test_geometry_area_weights.py | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index 38dcd2af3f..96aedee6c6 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -37,7 +37,6 @@ lint.ignore = [ "D200", # One-line docstring should fit on one line "D202", # No blank lines allowed after function docstring "D205", # 1 blank line required between summary line and description - "D208", # Docstring is over-indented "D209", # Multi-line docstring closing quotes should be on a separate line "D211", # No blank lines allowed before class docstring "D300", # triple double quotes `""" / Use triple single quotes `'''` diff --git a/lib/iris/tests/unit/analysis/geometry/test_geometry_area_weights.py b/lib/iris/tests/unit/analysis/geometry/test_geometry_area_weights.py index 29b3ba8c7e..5d7d39dfc4 100644 --- a/lib/iris/tests/unit/analysis/geometry/test_geometry_area_weights.py +++ b/lib/iris/tests/unit/analysis/geometry/test_geometry_area_weights.py @@ -2,10 +2,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. -"""Unit tests for the :func:`iris.analysis.geometry.geometry_area_weights` -function. - - """ +"""Unit tests for the :func:`iris.analysis.geometry.geometry_area_weights` function.""" # Import iris.tests first so that some things can be initialised before # importing anything else. From 52fd4ab0e39bbedbf24c8484231092a1f4f0b9a1 Mon Sep 17 00:00:00 2001 From: tkknight <2108488+tkknight@users.noreply.github.com> Date: Tue, 19 Dec 2023 16:53:25 +0000 Subject: [PATCH 2/2] ruff rule D411 compliance. (#5657) * ruff rule D411 complliance. * removed comment * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .ruff.toml | 1 - lib/iris/analysis/_regrid.py | 1 + lib/iris/common/resolve.py | 6 +++--- lib/iris/cube.py | 2 +- lib/iris/fileformats/dot.py | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index 96aedee6c6..8d65204a28 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -48,7 +48,6 @@ lint.ignore = [ "D407", # Missing dashed underline after section "D409", # Section underline should match the length of its name "D410", # Missing blank line after section - "D411", # Missing blank line before section "D412", # No blank lines allowed between a section header and its content # pyupgrade (UP) diff --git a/lib/iris/analysis/_regrid.py b/lib/iris/analysis/_regrid.py index 3e9074fc6b..b2ce99ee7a 100644 --- a/lib/iris/analysis/_regrid.py +++ b/lib/iris/analysis/_regrid.py @@ -988,6 +988,7 @@ def _create_cube(data, src, src_dims, tgt_coords, num_tgt_dims, regrid_callback) regrid_callback : callable The routine that will be used to calculate the interpolated values of any reference surfaces. + Returns ------- cube diff --git a/lib/iris/common/resolve.py b/lib/iris/common/resolve.py index 9124483dac..ec73792915 100644 --- a/lib/iris/common/resolve.py +++ b/lib/iris/common/resolve.py @@ -205,7 +205,7 @@ class Resolve: >>> resolver = Resolve(cube1, cube2) >>> results = [resolver.cube(data) for data in payload] - """ # noqa: D214 + """ # noqa: D214, D411 def __init__(self, lhs=None, rhs=None): """Resolve the provided ``lhs`` :class:`~iris.cube.Cube` operand and @@ -2493,7 +2493,7 @@ def mapped(self): >>> resolver.map_rhs_to_lhs False - """ # noqa: D214 + """ # noqa: D214, D411 result = None if self.mapping is not None: result = self._src_cube.ndim == len(self.mapping) @@ -2554,5 +2554,5 @@ def shape(self): >>> Resolve(cube2, cube1).shape (240, 37, 49) - """ # noqa: D214 + """ # noqa: D214, D411 return self._broadcast_shape diff --git a/lib/iris/cube.py b/lib/iris/cube.py index cb9fc02520..44ca2777bb 100644 --- a/lib/iris/cube.py +++ b/lib/iris/cube.py @@ -4521,7 +4521,7 @@ 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 + """ # noqa: D214, D411 # Update weights kwargs (if necessary) to handle different types of # weights weights_info = None diff --git a/lib/iris/fileformats/dot.py b/lib/iris/fileformats/dot.py index 6175dd553f..ff0e26bf84 100644 --- a/lib/iris/fileformats/dot.py +++ b/lib/iris/fileformats/dot.py @@ -337,16 +337,16 @@ def _coord_system_text(cs, uid): def _dot_node(indent, id, name, attributes): """Return a string containing the dot representation for a single node. - Args - ---- - id + Parameters + ---------- + id : The ID of the node. - name + name : The visual name of the node. - attributes + attributes: An iterable of (name, value) attribute pairs. - """ + """ # noqa: D411 attributes = r"\n".join("%s: %s" % item for item in attributes) template = """%(indent)s"%(id)s" [ %(indent)s label = "%(name)s|%(attributes)s"