Skip to content
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

ruff compliance for D404. #5671

Merged
merged 2 commits into from
Jan 3, 2024
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
1 change: 0 additions & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ lint.ignore = [
"D202", # No blank lines allowed after function docstring
"D205", # 1 blank line required between summary line and description
"D401", # First line of docstring should be in imperative mood: ...
"D404", # First word of the docstring should not be "This"

# pyupgrade (UP)
# https://docs.astral.sh/ruff/rules/#pyupgrade-up
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/_representation/cube_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def __init__(self, title, cell_methods):


class CubeSummary:
"""This class provides a structure for output representations of an Iris cube."""
"""Provide a structure for output representations of an Iris cube."""

def __init__(self, cube, name_padding=35):
self.header = FullHeader(cube, name_padding)
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/analysis/_area_weighted.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class AreaWeightedRegridder:
"""This class provides support for performing area-weighted regridding."""
"""Provide support for performing area-weighted regridding."""

def __init__(self, src_grid_cube, target_grid_cube, mdtol=1):
"""Create an area-weighted regridder for conversions between the source
Expand Down
4 changes: 3 additions & 1 deletion lib/iris/analysis/_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ def snapshot_grid(cube):


class RectilinearInterpolator:
"""This class provides support for performing nearest-neighbour or
"""Provide support for performing nearest-neighbour or linear interpolation.

This class provides support for performing nearest-neighbour or
linear interpolation over one or more orthogonal dimensions.

"""
Expand Down
8 changes: 6 additions & 2 deletions lib/iris/analysis/_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ def _regrid_weighted_curvilinear_to_rectilinear__perform(src_cube, regrid_info):


class CurvilinearRegridder:
"""This class provides support for performing point-in-cell regridding
"""Provides support for performing point-in-cell regridding.

This class provides support for performing point-in-cell regridding
between a curvilinear source grid and a rectilinear target grid.

"""
Expand Down Expand Up @@ -485,7 +487,9 @@ def __call__(self, src):


class RectilinearRegridder:
"""This class provides support for performing nearest-neighbour or
"""Provides support for performing nearest-neighbour or linear regridding.

This class provides support for performing nearest-neighbour or
linear regridding between source and target grids.

"""
Expand Down
14 changes: 10 additions & 4 deletions lib/iris/experimental/regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ def regrid_weighted_curvilinear_to_rectilinear(src_cube, weights, grid_cube):


class PointInCell:
"""This class describes the point-in-cell regridding scheme for use
"""Describe the point-in-cell regridding scheme.

This class describes the point-in-cell regridding scheme for use
typically with :meth:`iris.cube.Cube.regrid()`.

.. warning::
Expand Down Expand Up @@ -234,7 +236,7 @@ def __init__(self, weights=None):


class _ProjectedUnstructuredRegridder:
"""This class provides regridding that uses scipy.interpolate.griddata."""
"""Regridding that uses scipy.interpolate.griddata."""

def __init__(self, src_cube, tgt_grid_cube, method, projection=None):
"""Create a regridder for conversions between the source
Expand Down Expand Up @@ -601,7 +603,9 @@ def __call__(self, src_cube):


class ProjectedUnstructuredLinear:
"""This class describes the linear regridding scheme which uses the
"""Describe the linear regridding scheme.

This class describes the linear regridding scheme which uses the
scipy.interpolate.griddata to regrid unstructured data on to a grid.

The source cube and the target cube will be projected into a common
Expand Down Expand Up @@ -677,7 +681,9 @@ def regridder(self, src_cube, target_grid):


class ProjectedUnstructuredNearest:
"""This class describes the nearest regridding scheme which uses the
"""Describe the nearest regridding scheme which uses scipy.interpolate.griddata.

This class describes the nearest regridding scheme which uses the
scipy.interpolate.griddata to regrid unstructured data on to a grid.

The source cube and the target cube will be projected into a common
Expand Down
4 changes: 3 additions & 1 deletion lib/iris/experimental/ugrid/cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ def non_data_variable_names(self):


class CFUGridReader(cf.CFReader):
"""This class allows the contents of a netCDF file to be interpreted according
"""Allows the contents of a netCDF file to be.

This class allows the contents of a netCDF file to be interpreted according
to the 'NetCDF Climate and Forecast (CF) Metadata Conventions'.

Specialisation of :class:`~iris.fileformats.cf.CFReader` that can also
Expand Down
4 changes: 3 additions & 1 deletion lib/iris/fileformats/cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,9 @@ def __repr__(self):

################################################################################
class CFReader:
"""This class allows the contents of a netCDF file to be interpreted according
"""Allows the contents of a netCDF file to be interpreted.

This class allows the contents of a netCDF file to be interpreted according
to the 'NetCDF Climate and Forecast (CF) Metadata Conventions'.

"""
Expand Down
4 changes: 3 additions & 1 deletion lib/iris/fileformats/pp_load_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,9 @@ def convert(f):


def _all_other_rules(f):
"""This deals with all the other rules that have not been factored into any of
"""Deals with all the other rules.

Deals with all the other rules that have not been factored into any of
the other convert_scalar_coordinate functions above.

"""
Expand Down
4 changes: 3 additions & 1 deletion lib/iris/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,9 @@ def _draw_1d_from_points(draw_method_name, arg_func, *args, **kwargs):


def _draw_two_1d_from_points(draw_method_name, arg_func, *args, **kwargs):
"""This function is equivalend to _draw_two_1d_from_points but expects two
"""Draw two 1d frompoints (expects two y-axis variables rather than one).

This function is equivalend to _draw_two_1d_from_points but expects two
y-axis variables rather than one (such as is required for .fill_between). It
can't be used where the y-axis variables are string coordinates. The y-axis
variable provided first has precedence where the two differ on whether the
Expand Down
4 changes: 3 additions & 1 deletion lib/iris/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,9 @@ def assertArrayShapeStats(self, result, shape, mean, std_dev, rtol=1e-6):
self.assertArrayAllClose(result.data.std(), std_dev, rtol=rtol)

def assertDictEqual(self, lhs, rhs, msg=None):
"""This method overrides unittest.TestCase.assertDictEqual (new in Python3.1)
"""Dictionary Comparison.

This method overrides unittest.TestCase.assertDictEqual (new in Python3.1)
in order to cope with dictionary comparison where the value of a key may
be a numpy array.

Expand Down
5 changes: 4 additions & 1 deletion lib/iris/tests/system_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
# See LICENSE in the root of the repository for full licensing details.


"""This system test module is useful to identify if some of the key components required for Iris are available.
"""System test module.

System test module is useful to identify if some of the key components required for
Iris are available.

The system tests can be run with ``python setup.py test --system-tests``.

Expand Down
4 changes: 3 additions & 1 deletion lib/iris/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def test_netcdf4_import():


def test_python_versions():
"""This test is designed to fail whenever Iris' supported Python versions are
"""Test Python Versions.

Test is designed to fail whenever Iris' supported Python versions are
updated, insisting that versions are updated EVERYWHERE in-sync.
"""
latest_supported = "3.11"
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/test_pp_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class TestAll(tests.IrisTest, pp.PPTest):
_ref_dir = ("usecases", "pp_to_cf_conversion")

def _test_file(self, name):
"""This is the main test routine that is called for each of the files listed below."""
"""Main test routine that is called for each of the files listed below."""
pp_path = self._src_pp_path(name)

# 1) Load the PP and check the Cube
Expand Down
4 changes: 3 additions & 1 deletion lib/iris/tests/unit/cube/test_Cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,9 @@ def test_weights_dim_coord(self):


class Test_slices_dim_order(tests.IrisTest):
"""This class tests the capability of iris.cube.Cube.slices(), including its
"""Test the capability of iris.cube.Cube.slices().

Test the capability of iris.cube.Cube.slices(), including its
ability to correctly re-order the dimensions.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ def test_no_chunks_from_file(tmp_filepath, save_cubelist_with_sigma):


def test_as_dask(tmp_filepath, save_cubelist_with_sigma):
"""This does not test return values, as we can't be sure
"""Test as dask.

No return values, as we can't be sure
dask chunking behaviour won't change, or that it will differ
from our own chunking behaviour.
"""
Expand Down