Skip to content

Commit

Permalink
ruff rule D211, D300, D403 compliance. (SciTools#5661)
Browse files Browse the repository at this point in the history
* git compliane for D300.

* ruff compliance.

* fix doctests.
  • Loading branch information
tkknight authored Dec 20, 2023
1 parent 9ab0637 commit 3383f00
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 21 deletions.
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

0 comments on commit 3383f00

Please sign in to comment.