Skip to content

Commit 454c905

Browse files
authored
fix for ruff rule D301 (#5646)
* fixed for ruff rule D301. * additional fix * remove debug comment.
1 parent d05cc8e commit 454c905

File tree

13 files changed

+22
-23
lines changed

13 files changed

+22
-23
lines changed

.ruff.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ lint.ignore = [
4242
"D211", # No blank lines allowed before class docstring
4343
"D214", # Section is over-indented
4444
"D300", # triple double quotes `""" / Use triple single quotes `'''`
45-
"D301", # Use `r"""` if any backslashes in a docstring
4645
"D400", # First line should end with a period
4746
"D401", # First line of docstring should be in imperative mood: ...
4847
"D403", # First word of the first line should be capitalized

benchmarks/benchmarks/cperf/equality.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

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

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

2525
@on_demand_benchmark
2626
class CubeEquality(EqualityMixin):
27-
"""Benchmark time and memory costs of comparing LFRic and UM
27+
r"""Benchmark time and memory costs of comparing LFRic and UM
2828
:class:`~iris.cube.Cube`\\ s.
2929
"""
3030

benchmarks/benchmarks/sperf/equality.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@on_demand_benchmark
1212
class CubeEquality(FileMixin):
13-
"""Benchmark time and memory costs of comparing :class:`~iris.cube.Cube`\\ s
13+
r"""Benchmark time and memory costs of comparing :class:`~iris.cube.Cube`\\ s
1414
with attached :class:`~iris.experimental.ugrid.mesh.Mesh`\\ es.
1515
1616
Uses :class:`FileMixin` as the realistic case will be comparing

lib/iris/_constraints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, name=None, cube_func=None, coord_values=None, **kwargs):
3333
----------
3434
name : str or None, optional
3535
If a string, it is used as the name to match against the
36-
:attr:`iris.cube.Cube.names` property. TREMTEST
36+
:attr:`iris.cube.Cube.names` property.
3737
cube_func : callable or None, optional
3838
If a callable, it must accept a Cube as its first and only argument
3939
and return either True or False.

lib/iris/_merge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def _is_combination(name):
525525

526526

527527
def build_indexes(positions):
528-
"""Construct a mapping for each candidate dimension that maps for each
528+
r"""Construct a mapping for each candidate dimension that maps for each
529529
of its scalar values the set of values for each of the other candidate
530530
dimensions.
531531

lib/iris/cube.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ def _is_single_item(testee):
752752

753753

754754
class CubeAttrsDict(MutableMapping):
755-
"""A :class:`dict`\\-like object for :attr:`iris.cube.Cube.attributes`,
755+
r"""A :class:`dict`\\-like object for :attr:`iris.cube.Cube.attributes`,
756756
providing unified user access to combined cube "local" and "global" attributes
757757
dictionaries, with the access behaviour of an ordinary (single) dictionary.
758758
@@ -2018,7 +2018,7 @@ def coords(
20182018
dim_coords=None,
20192019
mesh_coords=None,
20202020
):
2021-
"""Return a list of coordinates from the :class:`Cube` that match the
2021+
r"""Return a list of coordinates from the :class:`Cube` that match the
20222022
provided criteria.
20232023
20242024
.. seealso::
@@ -2184,7 +2184,7 @@ def coord(
21842184
dim_coords=None,
21852185
mesh_coords=None,
21862186
):
2187-
"""Return a single coordinate from the :class:`Cube` that matches the
2187+
r"""Return a single coordinate from the :class:`Cube` that matches the
21882188
provided criteria.
21892189
21902190
.. note::
@@ -2359,7 +2359,7 @@ def _any_meshcoord(self):
23592359

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

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

24002400
def mesh_dim(self):
2401-
"""Return the cube dimension of the mesh, if the cube has any
2401+
r"""Return the cube dimension of the mesh, if the cube has any
24022402
:class:`~iris.experimental.ugrid.MeshCoord`\\ s,
24032403
or ``None`` if it has none.
24042404

lib/iris/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class CannotAddError(ValueError):
176176

177177

178178
class IrisUserWarning(UserWarning):
179-
"""Base class for :class:`UserWarning`\\ s generated by Iris."""
179+
r"""Base class for :class:`UserWarning`\\ s generated by Iris."""
180180

181181
pass
182182

lib/iris/experimental/ugrid/load.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55

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

144144

145145
def load_meshes(uris, var_name=None):
146-
"""Load :class:`~iris.experimental.ugrid.mesh.Mesh` objects from one or more NetCDF files.
146+
r"""Load :class:`~iris.experimental.ugrid.mesh.Mesh` objects from one or more NetCDF files.
147147
148148
Parameters
149149
----------

lib/iris/experimental/ugrid/mesh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ def normalise(element, axis):
659659

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

18671867
def to_MeshCoords(self, location):
1868-
"""Generate a tuple of
1868+
r"""Generate a tuple of
18691869
:class:`~iris.experimental.ugrid.mesh.MeshCoord`\\ s, each referencing
18701870
the current :class:`Mesh`, one for each :attr:`AXES` value, passing
18711871
through the ``location`` argument.

lib/iris/fileformats/_nc_load_rules/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
class FactEntity:
23-
"""An object with an 'entity_lists' property which is a dict of 'FactList's.
23+
r"""An object with an 'entity_lists' property which is a dict of 'FactList's.
2424
2525
A Factlist, in turn, is an object with property 'case_specific_facts',
2626
which is a list of tuples of strings

lib/iris/pandas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def as_cubes(
192192
cell_measure_cols=None,
193193
ancillary_variable_cols=None,
194194
):
195-
"""Convert a Pandas Series/DataFrame into n-dimensional Iris Cubes, including dimensional metadata.
195+
r"""Convert a Pandas Series/DataFrame into n-dimensional Iris Cubes, including dimensional metadata.
196196
197197
The index of `pandas_structure` will be used for generating the
198198
:class:`~iris.cube.Cube` dimension(s) and :class:`~iris.coords.DimCoord`\\ s.
@@ -617,7 +617,7 @@ def as_data_frame(
617617
add_cell_measures=False,
618618
add_ancillary_variables=False,
619619
):
620-
"""Convert a :class:`~iris.cube.Cube` to a :class:`pandas.DataFrame`.
620+
r"""Convert a :class:`~iris.cube.Cube` to a :class:`pandas.DataFrame`.
621621
622622
:attr:`~iris.cube.Cube.dim_coords` and :attr:`~iris.cube.Cube.data` are
623623
flattened into a long-style :class:`~pandas.DataFrame`. Other

lib/iris/tests/test_coding_standards.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def test_python_versions():
125125

126126

127127
def test_categorised_warnings():
128-
"""To ensure that all UserWarnings raised by Iris are categorised, for ease of use.
128+
r"""To ensure that all UserWarnings raised by Iris are categorised, for ease of use.
129129
130130
No obvious category? Use the parent:
131131
:class:`iris.exceptions.IrisUserWarning`.
@@ -182,7 +182,7 @@ class _WarnComboCfDefaulting(IrisCfWarning, IrisDefaultingWarning):
182182
class TestLicenseHeaders(tests.IrisTest):
183183
@staticmethod
184184
def whatchanged_parse(whatchanged_output):
185-
"""Returns a generator of tuples of data parsed from
185+
r"""Returns a generator of tuples of data parsed from
186186
"git whatchanged --pretty='TIME:%at". The tuples are of the form
187187
``(filename, last_commit_datetime)``
188188

lib/iris/tests/unit/coords/test__DimensionalMetadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def coord_representations(self, *args, **kwargs):
172172
return self.repr_str_strings(coord)
173173

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

0 commit comments

Comments
 (0)