Skip to content

Commit

Permalink
fix for ruff rule D301 (#5646)
Browse files Browse the repository at this point in the history
* fixed for ruff rule D301.

* additional fix

* remove debug comment.
  • Loading branch information
tkknight authored Dec 18, 2023
1 parent d05cc8e commit 454c905
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 23 deletions.
1 change: 0 additions & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ lint.ignore = [
"D211", # No blank lines allowed before class docstring
"D214", # Section is over-indented
"D300", # triple double quotes `""" / Use triple single quotes `'''`
"D301", # Use `r"""` if any backslashes in a docstring
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood: ...
"D403", # First word of the first line should be capitalized
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/benchmarks/cperf/equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class EqualityMixin(SingleDiagnosticMixin):
"""Uses :class:`SingleDiagnosticMixin` as the realistic case will be comparing
r"""Uses :class:`SingleDiagnosticMixin` as the realistic case will be comparing
:class:`~iris.cube.Cube`\\ s that have been loaded from file.
"""

Expand All @@ -24,7 +24,7 @@ def setup(self, file_type, three_d=False, three_times=False):

@on_demand_benchmark
class CubeEquality(EqualityMixin):
"""Benchmark time and memory costs of comparing LFRic and UM
r"""Benchmark time and memory costs of comparing LFRic and UM
:class:`~iris.cube.Cube`\\ s.
"""

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks/sperf/equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@on_demand_benchmark
class CubeEquality(FileMixin):
"""Benchmark time and memory costs of comparing :class:`~iris.cube.Cube`\\ s
r"""Benchmark time and memory costs of comparing :class:`~iris.cube.Cube`\\ s
with attached :class:`~iris.experimental.ugrid.mesh.Mesh`\\ es.
Uses :class:`FileMixin` as the realistic case will be comparing
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, name=None, cube_func=None, coord_values=None, **kwargs):
----------
name : str or None, optional
If a string, it is used as the name to match against the
:attr:`iris.cube.Cube.names` property. TREMTEST
:attr:`iris.cube.Cube.names` property.
cube_func : callable or None, optional
If a callable, it must accept a Cube as its first and only argument
and return either True or False.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def _is_combination(name):


def build_indexes(positions):
"""Construct a mapping for each candidate dimension that maps for each
r"""Construct a mapping for each candidate dimension that maps for each
of its scalar values the set of values for each of the other candidate
dimensions.
Expand Down
12 changes: 6 additions & 6 deletions lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ def _is_single_item(testee):


class CubeAttrsDict(MutableMapping):
"""A :class:`dict`\\-like object for :attr:`iris.cube.Cube.attributes`,
r"""A :class:`dict`\\-like object for :attr:`iris.cube.Cube.attributes`,
providing unified user access to combined cube "local" and "global" attributes
dictionaries, with the access behaviour of an ordinary (single) dictionary.
Expand Down Expand Up @@ -2018,7 +2018,7 @@ def coords(
dim_coords=None,
mesh_coords=None,
):
"""Return a list of coordinates from the :class:`Cube` that match the
r"""Return a list of coordinates from the :class:`Cube` that match the
provided criteria.
.. seealso::
Expand Down Expand Up @@ -2184,7 +2184,7 @@ def coord(
dim_coords=None,
mesh_coords=None,
):
"""Return a single coordinate from the :class:`Cube` that matches the
r"""Return a single coordinate from the :class:`Cube` that matches the
provided criteria.
.. note::
Expand Down Expand Up @@ -2359,7 +2359,7 @@ def _any_meshcoord(self):

@property
def mesh(self):
"""Return the unstructured :class:`~iris.experimental.ugrid.Mesh`
r"""Return the unstructured :class:`~iris.experimental.ugrid.Mesh`
associated with the cube, if the cube has any
:class:`~iris.experimental.ugrid.MeshCoord`\\ s,
or ``None`` if it has none.
Expand All @@ -2379,7 +2379,7 @@ def mesh(self):

@property
def location(self):
"""Return the mesh "location" of the cube data, if the cube has any
r"""Return the mesh "location" of the cube data, if the cube has any
:class:`~iris.experimental.ugrid.MeshCoord`\\ s,
or ``None`` if it has none.
Expand All @@ -2398,7 +2398,7 @@ def location(self):
return result

def mesh_dim(self):
"""Return the cube dimension of the mesh, if the cube has any
r"""Return the cube dimension of the mesh, if the cube has any
:class:`~iris.experimental.ugrid.MeshCoord`\\ s,
or ``None`` if it has none.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class CannotAddError(ValueError):


class IrisUserWarning(UserWarning):
"""Base class for :class:`UserWarning`\\ s generated by Iris."""
r"""Base class for :class:`UserWarning`\\ s generated by Iris."""

pass

Expand Down
4 changes: 2 additions & 2 deletions lib/iris/experimental/ugrid/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +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.

"""Extensions to Iris' NetCDF loading to allow the construction of
r"""Extensions to Iris' NetCDF loading to allow the construction of
:class:`~iris.experimental.ugrid.mesh.Mesh`\\ es from UGRID data in the file.
Eventual destination: :mod:`iris.fileformats.netcdf`.
Expand Down Expand Up @@ -143,7 +143,7 @@ def load_mesh(uris, var_name=None):


def load_meshes(uris, var_name=None):
"""Load :class:`~iris.experimental.ugrid.mesh.Mesh` objects from one or more NetCDF files.
r"""Load :class:`~iris.experimental.ugrid.mesh.Mesh` objects from one or more NetCDF files.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/experimental/ugrid/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def normalise(element, axis):

@classmethod
def from_coords(cls, *coords):
"""Construct a :class:`Mesh` by derivation from one or more
r"""Construct a :class:`Mesh` by derivation from one or more
:class:`~iris.coords.Coord`\\ s.
The :attr:`~Mesh.topology_dimension`, :class:`~iris.coords.Coord`
Expand Down Expand Up @@ -1865,7 +1865,7 @@ def to_MeshCoord(self, location, axis):
return MeshCoord(mesh=self, location=location, axis=axis)

def to_MeshCoords(self, location):
"""Generate a tuple of
r"""Generate a tuple of
:class:`~iris.experimental.ugrid.mesh.MeshCoord`\\ s, each referencing
the current :class:`Mesh`, one for each :attr:`AXES` value, passing
through the ``location`` argument.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/_nc_load_rules/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


class FactEntity:
"""An object with an 'entity_lists' property which is a dict of 'FactList's.
r"""An object with an 'entity_lists' property which is a dict of 'FactList's.
A Factlist, in turn, is an object with property 'case_specific_facts',
which is a list of tuples of strings
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def as_cubes(
cell_measure_cols=None,
ancillary_variable_cols=None,
):
"""Convert a Pandas Series/DataFrame into n-dimensional Iris Cubes, including dimensional metadata.
r"""Convert a Pandas Series/DataFrame into n-dimensional Iris Cubes, including dimensional metadata.
The index of `pandas_structure` will be used for generating the
:class:`~iris.cube.Cube` dimension(s) and :class:`~iris.coords.DimCoord`\\ s.
Expand Down Expand Up @@ -617,7 +617,7 @@ def as_data_frame(
add_cell_measures=False,
add_ancillary_variables=False,
):
"""Convert a :class:`~iris.cube.Cube` to a :class:`pandas.DataFrame`.
r"""Convert a :class:`~iris.cube.Cube` to a :class:`pandas.DataFrame`.
:attr:`~iris.cube.Cube.dim_coords` and :attr:`~iris.cube.Cube.data` are
flattened into a long-style :class:`~pandas.DataFrame`. Other
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_python_versions():


def test_categorised_warnings():
"""To ensure that all UserWarnings raised by Iris are categorised, for ease of use.
r"""To ensure that all UserWarnings raised by Iris are categorised, for ease of use.
No obvious category? Use the parent:
:class:`iris.exceptions.IrisUserWarning`.
Expand Down Expand Up @@ -182,7 +182,7 @@ class _WarnComboCfDefaulting(IrisCfWarning, IrisDefaultingWarning):
class TestLicenseHeaders(tests.IrisTest):
@staticmethod
def whatchanged_parse(whatchanged_output):
"""Returns a generator of tuples of data parsed from
r"""Returns a generator of tuples of data parsed from
"git whatchanged --pretty='TIME:%at". The tuples are of the form
``(filename, last_commit_datetime)``
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/unit/coords/test__DimensionalMetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def coord_representations(self, *args, **kwargs):
return self.repr_str_strings(coord)

def assertLines(self, list_of_expected_lines, string_result):
"""Assert equality between a result and expected output lines.
r"""Assert equality between a result and expected output lines.
For convenience, the 'expected lines' are joined with a '\\n',
because a list of strings is nicer to construct in code.
Expand Down

0 comments on commit 454c905

Please sign in to comment.