Enable PL in ruff
This commit is contained in:
parent
95f08bc96d
commit
99dda74a9e
7 changed files with 13 additions and 8 deletions
|
|
@ -253,6 +253,8 @@ select = [
|
||||||
# "FURB",
|
# "FURB",
|
||||||
# Perflint => No performance anti-patterns
|
# Perflint => No performance anti-patterns
|
||||||
# "PERF",
|
# "PERF",
|
||||||
|
# Pylint => Fewer bugs and simpler code
|
||||||
|
# "PL",
|
||||||
# flake8-use-pathlib => `pathlib` instead of `os` functions
|
# flake8-use-pathlib => `pathlib` instead of `os` functions
|
||||||
# "PTH",
|
# "PTH",
|
||||||
# pyupgrade => Modern syntax for the targeted Python version
|
# pyupgrade => Modern syntax for the targeted Python version
|
||||||
|
|
@ -535,8 +537,8 @@ select = [
|
||||||
"ICN",
|
"ICN",
|
||||||
# Perflint => No performance anti-patterns
|
# Perflint => No performance anti-patterns
|
||||||
"PERF",
|
"PERF",
|
||||||
# Pylint's refactoring rules => simpler and smaller functions
|
# Pylint => Fewer bugs and simpler code
|
||||||
"PLR",
|
"PL",
|
||||||
# flake8-use-pathlib => `pathlib` instead of `os` functions
|
# flake8-use-pathlib => `pathlib` instead of `os` functions
|
||||||
"PTH",
|
"PTH",
|
||||||
# flake8-print => no `print()`
|
# flake8-print => no `print()`
|
||||||
|
|
|
||||||
|
|
@ -147,9 +147,9 @@ class Path(meta.Base):
|
||||||
paths = []
|
paths = []
|
||||||
|
|
||||||
# We consider all 2-tuples of `Address`es. The symmetric graph is ...
|
# We consider all 2-tuples of `Address`es. The symmetric graph is ...
|
||||||
for first, second in itertools.combinations(addresses, 2):
|
for pair in itertools.combinations(addresses, 2):
|
||||||
# ... implicitly enforced by a precedence constraint for the `.id`s.
|
# ... implicitly enforced by a precedence constraint for the `.id`s.
|
||||||
first, second = (first, second) if first.id < second.id else (second, first)
|
first, second = sorted(pair, key=lambda address: address.id)
|
||||||
|
|
||||||
# If there is no `Path` object in the database ...
|
# If there is no `Path` object in the database ...
|
||||||
path = (
|
path = (
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,9 @@ class Location:
|
||||||
"""The UTM zone of the location as the zone number and the band."""
|
"""The UTM zone of the location as the zone number and the band."""
|
||||||
return self._zone, self._band
|
return self._zone, self._band
|
||||||
|
|
||||||
|
# Explicitly unhashable, the default for classes defining only `__eq__()`
|
||||||
|
__hash__ = None # type: ignore[assignment]
|
||||||
|
|
||||||
def __eq__(self, other: object) -> bool:
|
def __eq__(self, other: object) -> bool:
|
||||||
"""Check if two `Location` objects are the same location."""
|
"""Check if two `Location` objects are the same location."""
|
||||||
if not isinstance(other, Location):
|
if not isinstance(other, Location):
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ def predict(
|
||||||
"""
|
"""
|
||||||
# Initialize R only if it is actually used.
|
# Initialize R only if it is actually used.
|
||||||
# For example, the nox session "ci-tests-fast" does not use it.
|
# For example, the nox session "ci-tests-fast" does not use it.
|
||||||
from velofy import init_r # noqa:F401
|
from velofy import init_r # noqa:F401,PLC0415
|
||||||
|
|
||||||
# Re-seed R every time it is used to ensure reproducibility.
|
# Re-seed R every time it is used to ensure reproducibility.
|
||||||
robjects.r("set.seed(42)")
|
robjects.r("set.seed(42)")
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ def stl( # noqa:C901,PLR0912,PLR0913,PLR0915
|
||||||
|
|
||||||
# Initialize R only if it is actually used.
|
# Initialize R only if it is actually used.
|
||||||
# For example, the nox session "ci-tests-fast" does not use it.
|
# For example, the nox session "ci-tests-fast" does not use it.
|
||||||
from velofy import init_r # noqa:F401
|
from velofy import init_r # noqa:F401,PLC0415
|
||||||
|
|
||||||
# Re-seed R every time it is used to ensure reproducibility.
|
# Re-seed R every time it is used to ensure reproducibility.
|
||||||
robjects.r("set.seed(42)")
|
robjects.r("set.seed(42)")
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ def predict(
|
||||||
"""
|
"""
|
||||||
# Initialize R only if it is actually used.
|
# Initialize R only if it is actually used.
|
||||||
# For example, the nox session "ci-tests-fast" does not use it.
|
# For example, the nox session "ci-tests-fast" does not use it.
|
||||||
from velofy import init_r # noqa:F401
|
from velofy import init_r # noqa:F401,PLC0415
|
||||||
|
|
||||||
# Re-seed R every time it is used to ensure reproducibility.
|
# Re-seed R every time it is used to ensure reproducibility.
|
||||||
robjects.r("set.seed(42)")
|
robjects.r("set.seed(42)")
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,6 @@ def test_r_packages_installed():
|
||||||
in the "research/r_dependencies.ipynb" notebook or
|
in the "research/r_dependencies.ipynb" notebook or
|
||||||
in the GitHub Actions CI.
|
in the GitHub Actions CI.
|
||||||
"""
|
"""
|
||||||
from velofy import init_r
|
from velofy import init_r # noqa:PLC0415
|
||||||
|
|
||||||
assert init_r is not None
|
assert init_r is not None
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue