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 D209. #5663

Merged
merged 3 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
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 = [
"D200", # One-line docstring should fit on one line
"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
"D401", # First line of docstring should be in imperative mood: ...
"D404", # First word of the docstring should not be "This"
"D405", # Section name should be properly capitalized
Expand Down
6 changes: 4 additions & 2 deletions benchmarks/benchmarks/aux_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ def setup_common(self):
self.factory = self.create()

def time_create(self):
"""Create an instance of the benchmarked factory. create method is
specified in the subclass."""
"""Create an instance of the benchmarked factory.

Create method is specified in the subclass.
"""
self.create()


Expand Down
6 changes: 4 additions & 2 deletions benchmarks/benchmarks/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ def setup_common(self):
self.component = self.create()

def time_create(self):
"""Create an instance of the benchmarked coord. create method is
specified in the subclass."""
"""Create an instance of the benchmarked factory.

Create method is specified in the subclass.
"""
self.create()


Expand Down
7 changes: 5 additions & 2 deletions benchmarks/benchmarks/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ def setup(self):
raise NotImplementedError

def create(self):
"""Generic cube creation. cube_kwargs allow dynamic inclusion of
different components; specified in subclasses."""
"""Generic cube creation.

cube_kwargs allow dynamic inclusion of different components;
specified in subclasses.
"""
return cube.Cube(data=data_2d, **self.cube_kwargs)

def setup_common(self):
Expand Down
6 changes: 4 additions & 2 deletions benchmarks/benchmarks/experimental/ugrid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ def create(self):
raise NotImplementedError

def time_create(self, *params):
"""Create an instance of the benchmarked object. create() method is
specified in the subclass."""
"""Create an instance of the benchmarked object.

create() method is specified in the subclass.
"""
self.create()


Expand Down
6 changes: 4 additions & 2 deletions lib/iris/analysis/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@


class _Segment:
"""A single trajectory line segment: Two points, as described in the
Trajectory class."""
"""A single trajectory line segment.

Two points, as described in the Trajectory class.
"""

def __init__(self, p0, p1):
# check keys
Expand Down
10 changes: 7 additions & 3 deletions lib/iris/fileformats/_nc_load_rules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1542,8 +1542,11 @@ def is_rotated_longitude(engine, cf_name):

################################################################################
def has_supported_mercator_parameters(engine, cf_name):
"""Determine whether the CF grid mapping variable has the supported
values for the parameters of the Mercator projection."""
"""Determine whether the CF grid mapping variable has the supported values.

Determine whether the CF grid mapping variable has the supported
values for the parameters of the Mercator projection.
"""

is_valid = True
cf_grid_var = engine.cf_var.cf_group[cf_name]
Expand All @@ -1567,7 +1570,8 @@ def has_supported_mercator_parameters(engine, cf_name):
################################################################################
def has_supported_polar_stereographic_parameters(engine, cf_name):
"""Determine whether the CF grid mapping variable has the supported
values for the parameters of the Polar Stereographic projection."""
values for the parameters of the Polar Stereographic projection.
"""

is_valid = True
cf_grid_var = engine.cf_var.cf_group[cf_name]
Expand Down
6 changes: 4 additions & 2 deletions lib/iris/tests/integration/netcdf/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ def test_single_packed_unsigned(self):
self._single_test("u1", "single_packed_unsigned.cdl")

def test_single_packed_manual_scale(self):
"""Test saving a single CF-netCDF file with packing with scale
factor and add_offset set manually."""
"""Test saving a single CF-netCDF file.

File with packing with scale factor and add_offset set manually.
"""
self._single_test("i2", "single_packed_manual.cdl", manual=True)

def _multi_test(self, CDLfilename, multi_dtype=False):
Expand Down
6 changes: 4 additions & 2 deletions lib/iris/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,8 @@ class SliceMixin:
"""Mixin class providing tests for each 2-dimensional permutation of axes.

Requires self.draw_method to be the relevant plotting function,
and self.results to be a dictionary containing the desired test results."""
and self.results to be a dictionary containing the desired test results.
"""

def test_yx(self):
cube = self.wind[0, 0, :, :]
Expand Down Expand Up @@ -727,7 +728,8 @@ class Slice1dMixin:
"""Mixin class providing tests for each 1-dimensional permutation of axes.

Requires self.draw_method to be the relevant plotting function,
and self.results to be a dictionary containing the desired test results."""
and self.results to be a dictionary containing the desired test results.
"""

def test_x(self):
cube = self.wind[0, 0, 0, :]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# 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.
"""Unit tests for the
:func:`iris.analysis._scipy_interpolate._RegularGridInterpolator` class."""
:func:`iris.analysis._scipy_interpolate._RegularGridInterpolator` class.
"""

# Import iris.tests first so that some things can be initialised before
# importing anything else.
Expand Down
9 changes: 6 additions & 3 deletions lib/iris/tests/unit/coords/test_Cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ def test_PartialDateTime_other(self):


class Test_contains_point(tests.IrisTest):
"""Test that contains_point works for combinations of datetime,
cf.datatime, and PartialDateTime objects."""
"""Test that contains_point works for combinations.

Combinations of datetime, cf.datatime, and PartialDateTime objects.
"""

def test_datetime_PartialDateTime_point(self):
point = PartialDateTime(month=6)
Expand Down Expand Up @@ -236,7 +238,8 @@ def test_cftime_360_day_cftime_360day_point(self):

class Test_numpy_comparison(tests.IrisTest):
"""Unit tests to check that the results of comparisons with numpy types can be
used as truth values."""
used as truth values.
"""

def test_cell_lhs(self):
cell = Cell(point=1.5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# 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.
"""Unit tests for the `iris.plot._check_bounds_contiguity_and_mask`
function."""
function.
"""

# Import iris.tests first so that some things can be initialised before
# importing anything else.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# 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.
"""Unit tests for the `iris.plot._check_geostationary_coords_and_convert
function."""
function.
"""

# Import iris.tests first so that some things can be initialised before
# importing anything else.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# 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.
"""Unit tests for the `iris.plot._get_plot_defn_custom_coords_picked`
function."""
function.
"""

# Import iris.tests first so that some things can be initialised before
# importing anything else.
Expand Down
12 changes: 8 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,18 @@ def session_cachefile(session: nox.sessions.Session) -> Path:


def venv_populated(session: nox.sessions.Session) -> bool:
"""Returns True if the conda venv has been created
and the list of packages in the lockfile installed."""
"""List of packages in the lockfile installed.

Returns True if the conda venv has been created.
"""
return session_cachefile(session).is_file()


def venv_changed(session: nox.sessions.Session) -> bool:
"""Returns True if the installed session is different to that specified
in the lockfile."""
"""Returns True if the installed session is different.

Compares to that specified in the lockfile.
"""
changed = False
cache = session_cachefile(session)
lockfile = session_lockfile(session)
Expand Down