Skip to content

ruff rule D211, D300, D403 compliance. #5661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ lint.ignore = [
"D202", # No blank lines allowed after function docstring
"D205", # 1 blank line required between summary line and description
"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 `'''`
"D401", # First line of docstring should be in imperative mood: ...
"D403", # First word of the first line should be capitalized
"D404", # First word of the docstring should not be "This"
"D405", # Section name should be properly capitalized
"D406", # Section name should end with a newline
Expand Down
1 change: 0 additions & 1 deletion benchmarks/benchmarks/aux_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class FactoryCommon:
# * make class an ABC
# * remove NotImplementedError
# * combine setup_common into setup

"""A base class running a generalised suite of benchmarks for any factory.
Factory to be specified in a subclass.

Expand Down
1 change: 0 additions & 1 deletion benchmarks/benchmarks/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class ComponentCommon:
# * make class an ABC
# * remove NotImplementedError
# * combine setup_common into setup

"""A base class running a generalised suite of benchmarks for cubes that
include a specified component (e.g. Coord, CellMeasure etc.). Component to
be specified in a subclass.
Expand Down
1 change: 0 additions & 1 deletion lib/iris/analysis/_scipy_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def _ndim_coords_from_arrays(points, ndim=None):
# source: https://github.com/scipy/scipy/blob/b94a5d5ccc08dddbc88453477ff2625\
# 9aeaafb32/scipy/interpolate/interpolate.py#L1400
class _RegularGridInterpolator:

"""Interpolation on a regular grid in arbitrary dimensions.

The data must be defined on a regular grid; the grid spacing however may be
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/experimental/ugrid/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,7 @@ def _add(self, coords):
setattr(self, member_y, coords[1])

def add(self, node_x=None, node_y=None, edge_x=None, edge_y=None):
"""use self.remove(edge_x=True) to remove a coordinate e.g., using the
"""Use self.remove(edge_x=True) to remove a coordinate e.g., using the
pattern self.add(edge_x=None) will not remove the edge_x coordinate.

"""
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/test_analysis_calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def build_cube(data, spherical=False):

class TestCalculusWKnownSolutions(tests.IrisTest):
def get_coord_pts(self, cube):
"""return (x_pts, x_ones, y_pts, y_ones, z_pts, z_ones) for the given cube."""
"""Return (x_pts, x_ones, y_pts, y_ones, z_pts, z_ones) for the given cube."""
x = cube.coord(axis="X")
y = cube.coord(axis="Y")
z = cube.coord(axis="Z")
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 @@ -136,9 +136,9 @@ def test_categorised_warnings():
.. code-block:: python

class _WarnComboCfDefaulting(IrisCfWarning, IrisDefaultingWarning):
\"""
\"\"\"
One-off combination of warning classes - enhances user filtering.
\"""
\"\"\"
pass

"""
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/test_coordsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def test_update_to_equivalent(self):


class Test_GeogCS_mutation(tests.IrisTest):
"Test that altering attributes of a GeogCS instance behaves as expected."
"""Test that altering attributes of a GeogCS instance behaves as expected."""

def test_semi_major_axis_change(self):
# Clear datum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ def test_fully_wrapped_not_circular(self):

class Test___call___1D_singlelendim(ThreeDimCube):
def setUp(self):
"""thingness / (1) (wibble: 2; latitude: 1)
"""Setup.

thingness / (1) (wibble: 2; latitude: 1)
Dimension coordinates:
wibble x -
latitude - x
Expand Down
8 changes: 4 additions & 4 deletions lib/iris/tests/unit/common/lenient/test__lenient_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def myclient(*args, **kwargs):
def test_call_naked_doc(self):
@_lenient_client
def myclient():
"""myclient doc-string."""
"""Myclient doc-string."""

self.assertEqual(myclient.__doc__, "myclient doc-string.")
self.assertEqual(myclient.__doc__, "Myclient doc-string.")

def test_call_no_kwargs(self):
@_lenient_client()
Expand Down Expand Up @@ -169,9 +169,9 @@ def myclient(*args, **kwargs):
def test_call_doc(self):
@_lenient_client()
def myclient():
"""myclient doc-string."""
"""Myclient doc-string."""

self.assertEqual(myclient.__doc__, "myclient doc-string.")
self.assertEqual(myclient.__doc__, "Myclient doc-string.")


if __name__ == "__main__":
Expand Down
8 changes: 4 additions & 4 deletions lib/iris/tests/unit/common/lenient/test__lenient_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def myservice(*args, **kwargs):
def test_call_naked_doc(self):
@_lenient_service
def myservice():
"""myservice doc-string."""
"""Myservice doc-string."""

self.assertEqual(myservice.__doc__, "myservice doc-string.")
self.assertEqual(myservice.__doc__, "Myservice doc-string.")

def test_call(self):
@_lenient_service()
Expand Down Expand Up @@ -105,9 +105,9 @@ def myservice(*args, **kwargs):
def test_call_doc(self):
@_lenient_service()
def myservice():
"""myservice doc-string."""
"""Myservice doc-string."""

self.assertEqual(myservice.__doc__, "myservice doc-string.")
self.assertEqual(myservice.__doc__, "Myservice doc-string.")


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/unit/cube/test_Cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ class Test_slices_dim_order(tests.IrisTest):
"""

def setUp(self):
"""setup a 4D iris cube, each dimension is length 1.
"""Setup a 4D iris cube, each dimension is length 1.
The dimensions are;
dim1: time
dim2: height
Expand Down