diff --git a/.basedpyright/baseline.json b/.basedpyright/baseline.json index 91086ad..d23817c 100644 --- a/.basedpyright/baseline.json +++ b/.basedpyright/baseline.json @@ -1338,8 +1338,24 @@ { "code": "reportAny", "range": { - "startColumn": 16, - "endColumn": 23, + "startColumn": 12, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 26, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 35, + "endColumn": 50, "lineCount": 1 } }, @@ -4659,22 +4675,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownMemberType", - "range": { - "startColumn": 11, - "endColumn": 38, - "lineCount": 1 - } - }, - { - "code": "reportUnknownVariableType", - "range": { - "startColumn": 11, - "endColumn": 40, - "lineCount": 1 - } - }, { "code": "reportUnknownMemberType", "range": { diff --git a/contrib/weights-from-fortran.py b/contrib/weights-from-fortran.py index 5410580..c918530 100644 --- a/contrib/weights-from-fortran.py +++ b/contrib/weights-from-fortran.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python from __future__ import annotations import re diff --git a/contrib/weights-from-txt.py b/contrib/weights-from-txt.py index daf1297..e256af7 100755 --- a/contrib/weights-from-txt.py +++ b/contrib/weights-from-txt.py @@ -5,7 +5,7 @@ with open(sys.argv[1]) as inf: - lines = [ln.strip() for ln in inf.readlines() if ln.strip()] + lines = [ln.strip() for ln in inf if ln.strip()] rule_name = sys.argv[2] diff --git a/modepy/modal_decay.py b/modepy/modal_decay.py index 5e9785a..b278d13 100644 --- a/modepy/modal_decay.py +++ b/modepy/modal_decay.py @@ -122,9 +122,7 @@ def create_decay_baseline( modal_coefficients = np.asarray(mode_number_vector, dtype=np.float64)**(-n) modal_coefficients[zeros] = 1.0 # irrelevant, just keeps log from NaNing - modal_coefficients = modal_coefficients / la.norm(modal_coefficients) - - return modal_coefficients + return modal_coefficients / la.norm(modal_coefficients) def get_decay_fit_matrix( @@ -152,8 +150,7 @@ def skyline_pessimize(modal_values: ArrayF) -> ArrayF: cur_val = max(my_modes[-1], my_modes[-2]) for imode in range(nmodes-1, -1, -1): - if my_modes[imode] > cur_val: - cur_val = my_modes[imode] + cur_val = max(cur_val, my_modes[imode]) result[iel, imode] = cur_val diff --git a/modepy/tools.py b/modepy/tools.py index 15fae8b..b89e6f1 100644 --- a/modepy/tools.py +++ b/modepy/tools.py @@ -60,7 +60,7 @@ import numpy as np import numpy.linalg as la -from typing_extensions import override +from typing_extensions import Self, override from pytools import memoize_method @@ -292,7 +292,7 @@ def plot_element_values( pt.plot(orig_nodes[0], orig_values, "x") elif dims == 2: import matplotlib.pyplot as pt - import matplotlib.tri as tri + from matplotlib import tri triangulation = tri.Triangulation(nodes[0], nodes[1], triangles=submesh) ax = pt.subplot(1, 1, 1, projection="3d") @@ -414,8 +414,8 @@ class Reshapeable(Protocol): def shape(self) -> tuple[int, ...]: ... def reshape( - self: ReshapeableT, *newshape: tuple[int, ...], order: str - ) -> ReshapeableT: + self, *newshape: tuple[int, ...], order: str + ) -> Self: ... diff --git a/pyproject.toml b/pyproject.toml index 367484f..709f8ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,7 @@ extend-ignore = [ "E402", # module level import not at the top of file "N818", # error suffix in exception names "RUF067", # no code in __init__ *shrug* + "TRY004", ] allowed-confusables = ["‐", "–"] @@ -102,6 +103,8 @@ multiline-quotes = "double" [tool.ruff.lint.per-file-ignores] "modepy/quadrature/jaskowiec_sukumar_tet_data.py" = ["E202", "E203"] +"modepy/test/test_*.py" = ["S102"] +"doc/conf.py" = ["S102"] [tool.ruff.lint.isort] combine-as-imports = true