Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into ruff2
Browse files Browse the repository at this point in the history
* upstream/main:
  ruff NPY rule compliance (SciTools#5653)
  ruff ICN rule compliance (SciTools#5652)
  ruff EXE rule compliance (SciTools#5651)
  ruff com rule compliance (SciTools#5650)
  Remove compliant ignored ruff rules (SciTools#5649)
  fix for ruff rule D301 (SciTools#5646)
  Updated environment lockfiles (SciTools#5645)
  Bump scitools/workflows from 2023.10.0 to 2023.12.1 (SciTools#5648)
  • Loading branch information
tkknight committed Dec 18, 2023
2 parents 72b40a5 + 67be801 commit cbb0856
Show file tree
Hide file tree
Showing 36 changed files with 130 additions and 175 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ concurrency:
jobs:
manifest:
name: "check-manifest"
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2023.10.0
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2023.12.1
2 changes: 1 addition & 1 deletion .github/workflows/refresh-lockfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ on:

jobs:
refresh_lockfiles:
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@2023.10.0
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@2023.12.1
secrets: inherit
54 changes: 1 addition & 53 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ lint.ignore = [
"D211", # No blank lines allowed before class docstring
"D214", # Section is over-indented
"D300", # triple double quotes `""" / Use triple single quotes `'''`
"D301", # Use `r"""` if any backslashes in a docstring
"D400", # First line should end with a period
"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"
Expand All @@ -58,22 +58,10 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#pyupgrade-up
"UP",

# flake8-2020 (YTT)
# https://docs.astral.sh/ruff/rules/#flake8-2020-ytt
"YTT",

# flake8-annotations (ANN)
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ANN",

# flake8-async (ASYNC)
# https://docs.astral.sh/ruff/rules/#flake8-async-async
"ASYNC",

# flake8-trio (TRIO)
# https://docs.astral.sh/ruff/rules/#flake8-trio-trio
"TRIO",

# flake8-bandit (S)
# https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"S",
Expand All @@ -94,10 +82,6 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"A",

# flake8-commas (COM)
# https://docs.astral.sh/ruff/rules/#flake8-commas-com
"COM",

# flake8-copyright (CPY)
# https://docs.astral.sh/ruff/rules/#flake8-copyright-cpy
"CPY",
Expand All @@ -110,22 +94,10 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"DTZ",

# flake8-debugger (T10)
# https://docs.astral.sh/ruff/rules/#flake8-debugger-t10
"T10",

# flake8-django (DJ)
# https://docs.astral.sh/ruff/rules/#flake8-django-dj
"DJ",

# flake8-errmsg (EM)
# https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"EM",

# flake8-executable (EXE)
# https://docs.astral.sh/ruff/rules/#flake8-executable-exe
"EXE",

# flake8-future-annotations (FA)
# https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
"FA",
Expand All @@ -134,10 +106,6 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
"ISC",

# flake8-import-conventions (ICN)
# https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn
"ICN",

# flake8-logging-format (G)
# https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
"G",
Expand All @@ -162,10 +130,6 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
"PT",

# flake8-quotes (Q)
# https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"Q",

# flake8-raise (RSE)
# https://docs.astral.sh/ruff/rules/#flake8-raise-rse
"RSE",
Expand Down Expand Up @@ -194,10 +158,6 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch
"TCH",

# flake8-gettext (INT)
# https://docs.astral.sh/ruff/rules/#flake8-gettext-int
"INT",

# flake8-unused-arguments (ARG)
# https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
"ARG",
Expand Down Expand Up @@ -238,10 +198,6 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#flynt-fly
"FLY",

# NumPy-specific rules (NPY)
# https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy
"NPY",

# Airflow (AIR)
# https://docs.astral.sh/ruff/rules/#airflow-air
"AIR",
Expand All @@ -250,14 +206,6 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#perflint-perf
"PERF",

# refurb (FURB)
# https://docs.astral.sh/ruff/rules/#refurb-furb
"FURB",

# flake8-logging (LOG)
# https://docs.astral.sh/ruff/rules/#flake8-logging-log
"LOG",

# Ruff-specific rules (RUF)
# https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
"RUF",
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/benchmarks/cperf/equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


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

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

@on_demand_benchmark
class CubeEquality(EqualityMixin):
"""Benchmark time and memory costs of comparing LFRic and UM
r"""Benchmark time and memory costs of comparing LFRic and UM
:class:`~iris.cube.Cube`\\ s.
"""

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/benchmarks/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"""Plot benchmark tests.
"""
import matplotlib
import matplotlib as mpl
import numpy as np

from iris import coords, cube, plot

from . import ARTIFICIAL_DIM_SIZE

matplotlib.use("agg")
mpl.use("agg")


class AuxSort:
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks/sperf/equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@on_demand_benchmark
class CubeEquality(FileMixin):
"""Benchmark time and memory costs of comparing :class:`~iris.cube.Cube`\\ s
r"""Benchmark time and memory costs of comparing :class:`~iris.cube.Cube`\\ s
with attached :class:`~iris.experimental.ugrid.mesh.Mesh`\\ es.
Uses :class:`FileMixin` as the realistic case will be comparing
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, name=None, cube_func=None, coord_values=None, **kwargs):
----------
name : str or None, optional
If a string, it is used as the name to match against the
:attr:`iris.cube.Cube.names` property. TREMTEST
:attr:`iris.cube.Cube.names` property.
cube_func : callable or None, optional
If a callable, it must accept a Cube as its first and only argument
and return either True or False.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def _is_combination(name):


def build_indexes(positions):
"""Construct a mapping for each candidate dimension that maps for each
r"""Construct a mapping for each candidate dimension that maps for each
of its scalar values the set of values for each of the other candidate
dimensions.
Expand Down
12 changes: 6 additions & 6 deletions lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ def _is_single_item(testee):


class CubeAttrsDict(MutableMapping):
"""A :class:`dict`\\-like object for :attr:`iris.cube.Cube.attributes`,
r"""A :class:`dict`\\-like object for :attr:`iris.cube.Cube.attributes`,
providing unified user access to combined cube "local" and "global" attributes
dictionaries, with the access behaviour of an ordinary (single) dictionary.
Expand Down Expand Up @@ -2018,7 +2018,7 @@ def coords(
dim_coords=None,
mesh_coords=None,
):
"""Return a list of coordinates from the :class:`Cube` that match the
r"""Return a list of coordinates from the :class:`Cube` that match the
provided criteria.
.. seealso::
Expand Down Expand Up @@ -2184,7 +2184,7 @@ def coord(
dim_coords=None,
mesh_coords=None,
):
"""Return a single coordinate from the :class:`Cube` that matches the
r"""Return a single coordinate from the :class:`Cube` that matches the
provided criteria.
.. note::
Expand Down Expand Up @@ -2359,7 +2359,7 @@ def _any_meshcoord(self):

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

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

def mesh_dim(self):
"""Return the cube dimension of the mesh, if the cube has any
r"""Return the cube dimension of the mesh, if the cube has any
:class:`~iris.experimental.ugrid.MeshCoord`\\ s,
or ``None`` if it has none.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class CannotAddError(ValueError):


class IrisUserWarning(UserWarning):
"""Base class for :class:`UserWarning`\\ s generated by Iris."""
r"""Base class for :class:`UserWarning`\\ s generated by Iris."""

pass

Expand Down
4 changes: 2 additions & 2 deletions lib/iris/experimental/ugrid/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# 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.

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


def load_meshes(uris, var_name=None):
"""Load :class:`~iris.experimental.ugrid.mesh.Mesh` objects from one or more NetCDF files.
r"""Load :class:`~iris.experimental.ugrid.mesh.Mesh` objects from one or more NetCDF files.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/experimental/ugrid/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def normalise(element, axis):

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

def to_MeshCoords(self, location):
"""Generate a tuple of
r"""Generate a tuple of
:class:`~iris.experimental.ugrid.mesh.MeshCoord`\\ s, each referencing
the current :class:`Mesh`, one for each :attr:`AXES` value, passing
through the ``location`` argument.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/_nc_load_rules/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


class FactEntity:
"""An object with an 'entity_lists' property which is a dict of 'FactList's.
r"""An object with an 'entity_lists' property which is a dict of 'FactList's.
A Factlist, in turn, is an object with property 'case_specific_facts',
which is a list of tuples of strings
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ def save(self, file_handle):
ia //= PP_WORD_DEPTH
else:
# ia is the datalength in WORDS
ia = np.product(extra_elem.shape)
ia = np.prod(extra_elem.shape)
# flip the byteorder if the data is not big-endian
if extra_elem.dtype.newbyteorder(">") != extra_elem.dtype:
# take a copy of the extra data when byte swapping
Expand Down
Loading

0 comments on commit cbb0856

Please sign in to comment.