diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e27762d..ef416be 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.16.1 + rev: v0.16.3 hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -68,7 +68,7 @@ repos: - repo: https://github.com/tox-dev/pyproject-fmt - rev: "v2.27.0" + rev: "v2.27.1" hooks: - id: pyproject-fmt diff --git a/docs/source/conf.py b/docs/source/conf.py index b1bd46b..0190a6c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -198,3 +198,7 @@ # -- Extension configuration ------------------------------------------------- +# Ignore self-ref URLs +linkcheck_ignore = [ + "https://stackoverflow.com/*", +] diff --git a/oceans/RPSstuff.py b/oceans/RPSstuff.py index 3ce4f31..db9d790 100644 --- a/oceans/RPSstuff.py +++ b/oceans/RPSstuff.py @@ -62,7 +62,7 @@ def ms2hms(millisecs): return hour, mn, sec -def julian(y, m=0, d=0, h=0, mi=0, s=0, *, noon=False): # noqa: PLR0913 +def julian(y, m=0, d=0, h=0, mi=0, s=0, *, noon=False): # noqa: PLR0917, PLR0913 """Converts Gregorian calendar dates to Julian dates USAGE: [j]=julian(y,m,d,h) diff --git a/oceans/datasets.py b/oceans/datasets.py index e539113..5b60993 100644 --- a/oceans/datasets.py +++ b/oceans/datasets.py @@ -153,7 +153,7 @@ def woa_profile( @functools.lru_cache(maxsize=256) -def woa_subset( # noqa: PLR0913 +def woa_subset( # noqa: PLR0917, PLR0913 min_lon, max_lon, min_lat, diff --git a/oceans/filters.py b/oceans/filters.py index 63852c1..d97b23f 100644 --- a/oceans/filters.py +++ b/oceans/filters.py @@ -138,7 +138,7 @@ def smoo1(datain, window_len=11, window="hanning"): return data_out[window_len - 1 : -window_len + 1] -def smoo2(A, hei, wid, kind="hann", badflag=-9999, beta=14): # noqa: ARG001, PLR0915, PLR0913, C901 +def smoo2(A, hei, wid, kind="hann", badflag=-9999, beta=14): # noqa: ARG001, PLR0917, PLR0915, PLR0913, C901 """Calculates the smoothed array 'As' from the original array 'A' using the specified window of type 'kind' and shape ('hei', 'wid'). diff --git a/oceans/ocfis.py b/oceans/ocfis.py index 496bb0e..ac95f7e 100644 --- a/oceans/ocfis.py +++ b/oceans/ocfis.py @@ -676,7 +676,7 @@ def alphanum_key(s): return key -def get_profile(x, y, f, xi, yi, mode="nearest", order=3): # noqa: PLR0913 +def get_profile(x, y, f, xi, yi, mode="nearest", order=3): # noqa: PLR0913, PLR0917 """Interpolate regular data. Parameters diff --git a/oceans/plotting.py b/oceans/plotting.py index e51c91f..95662e4 100644 --- a/oceans/plotting.py +++ b/oceans/plotting.py @@ -209,7 +209,7 @@ class EditPoints: >>> _ = ax.set_title("Click and drag a point to move it") >>> _ = ax.axis([-2, 2, -2, 2]) - Based on https://matplotlib.org/examples/event_handling/poly_editor.html + Based on https://matplotlib.org/stable/gallery/event_handling/poly_editor.html """ diff --git a/oceans/sw_extras/waves.py b/oceans/sw_extras/waves.py index e104971..8dc0ba8 100644 --- a/oceans/sw_extras/waves.py +++ b/oceans/sw_extras/waves.py @@ -82,7 +82,7 @@ class Waves: """ - def __init__(self, h, T=None, L=None, thetao=None, Ho=None, lat=None): # noqa: PLR0915, PLR0913, PLR0912, C901 + def __init__(self, h, T=None, L=None, thetao=None, Ho=None, lat=None): # noqa: PLR0917, PLR0915, PLR0913, PLR0912, C901 self.T = np.asarray(T, dtype=np.float64) self.L = np.asarray(L, dtype=np.float64) self.Ho = np.asarray(Ho, dtype=np.float64) diff --git a/oceans/synop.py b/oceans/synop.py index a89581a..5430176 100644 --- a/oceans/synop.py +++ b/oceans/synop.py @@ -1,7 +1,7 @@ import numpy as np -def scaloa(xc, yc, x, y, t=None, corrlen=None, err=None, zc=None): # noqa: PLR0913 +def scaloa(xc, yc, x, y, t=None, corrlen=None, err=None, zc=None): # noqa: PLR0913, PLR0917 """Scalar objective analysis. Interpolates t(x, y) into tp(xc, yc) Assumes spatial correlation function to be isotropic and Gaussian in the form of: C = (1 - err) * np.exp(-d**2 / corrlen**2) where: diff --git a/ruff.toml b/ruff.toml index ac35a0c..40258df 100644 --- a/ruff.toml +++ b/ruff.toml @@ -3,18 +3,19 @@ line-length = 110 lint.select = ["ALL"] lint.ignore = [ - "COM812", # missing-trailing-comma - "D203", # 1 blank line required before class docstring - "D205", # 1 blank line required between summary line and description - "D213", # incompatible. Ignoring `multi-line-summary-second-line` - "TRY003", # Avoid specifying long messages outside the exception class - "ANN", # Missing type annotation - "D", # Missing type annotation - "N", # Missing type annotation - "PLR2004", # Magic value used in comparison - "PLC0415", # `import` should be at the top-level of a file - "INP001", # implicit namespace package - "RUF015", # Prefer `next(...)` over single element slice + "ANN", # Missing type annotation + "COM812", # missing-trailing-comma + "CPY001", # Missing copyright notice at top of file + "D", # Missing type annotation + "D203", # 1 blank line required before class docstring + "D205", # 1 blank line required between summary line and description + "D213", # incompatible. Ignoring `multi-line-summary-second-line` + "INP001", # implicit namespace package + "N", # Missing type annotation + "PLC0415", # `import` should be at the top-level of a file + "PLR2004", # Magic value used in comparison + "RUF015", # Prefer `next(...)` over single element slice + "TRY003", # Avoid specifying long messages outside the exception class ] [lint.extend-per-file-ignores] @@ -27,26 +28,26 @@ lint.ignore = [ "EXE001", # Shebang is present but file is not executable ] "test_*.py" = [ - "ANN001", # Missing type annotation for function argument - "ANN201", # Missing return type annotation for public function - "ANN202", # Missing return type annotation for private function - "INP001", # File is part of an implicit namespace package - "PD901", # Avoid using the generic variable name `df` for DataFrames - "S101", # Use of assert detected + "ANN001", # Missing type annotation for function argument + "ANN201", # Missing return type annotation for public function + "ANN202", # Missing return type annotation for private function + "INP001", # File is part of an implicit namespace package + "PD901", # Avoid using the generic variable name `df` for DataFrames + "S101", # Use of assert detected ] # nbqa-ruff acts on converted .py so we cannot glob .ipynb :-/ # https://github.com/nbQA-dev/nbQA/issues/823 "notebooks/*" = [ - "ANN001", # Missing type annotation for function argument - "ANN201", # Missing return type annotation for public function - "B018", # Found useless expression. Either assign it to a variable or remove it - "D100", # Missing docstring in public module - "D103", # Missing docstring in public function - "E402", # Module level import not at top of file - "FBT003", # Boolean positional value in function call - "INP001", # File is part of an implicit namespace package - "PD901", # Avoid using the generic variable name `df` for DataFrames - "T201", # `print` found" + "ANN001", # Missing type annotation for function argument + "ANN201", # Missing return type annotation for public function + "B018", # Found useless expression. Either assign it to a variable or remove it + "D100", # Missing docstring in public module + "D103", # Missing docstring in public function + "E402", # Module level import not at top of file + "FBT003", # Boolean positional value in function call + "INP001", # File is part of an implicit namespace package + "PD901", # Avoid using the generic variable name `df` for DataFrames + "T201", # `print` found" ] [lint.pycodestyle] max-doc-length = 180