Enable more lint rules #10
7 changed files with 13 additions and 8 deletions
Enable PL in ruff
commit
99dda74a9e
|
|
@ -253,6 +253,8 @@ select = [
|
|||
# "FURB",
|
||||
# Perflint => No performance anti-patterns
|
||||
# "PERF",
|
||||
# Pylint => Fewer bugs and simpler code
|
||||
# "PL",
|
||||
# flake8-use-pathlib => `pathlib` instead of `os` functions
|
||||
# "PTH",
|
||||
# pyupgrade => Modern syntax for the targeted Python version
|
||||
|
|
@ -535,8 +537,8 @@ select = [
|
|||
"ICN",
|
||||
# Perflint => No performance anti-patterns
|
||||
"PERF",
|
||||
# Pylint's refactoring rules => simpler and smaller functions
|
||||
"PLR",
|
||||
# Pylint => Fewer bugs and simpler code
|
||||
"PL",
|
||||
# flake8-use-pathlib => `pathlib` instead of `os` functions
|
||||
"PTH",
|
||||
# flake8-print => no `print()`
|
||||
|
|
|
|||
|
|
@ -147,9 +147,9 @@ class Path(meta.Base):
|
|||
paths = []
|
||||
|
||||
# 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.
|
||||
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 ...
|
||||
path = (
|
||||
|
|
|
|||
|
|
@ -94,6 +94,9 @@ class Location:
|
|||
"""The UTM zone of the location as the zone number and the 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:
|
||||
"""Check if two `Location` objects are the same location."""
|
||||
if not isinstance(other, Location):
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ def predict(
|
|||
"""
|
||||
# Initialize R only if it is actually used.
|
||||
# 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.
|
||||
robjects.r("set.seed(42)")
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ def stl( # noqa:C901,PLR0912,PLR0913,PLR0915
|
|||
|
||||
# Initialize R only if it is actually used.
|
||||
# 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.
|
||||
robjects.r("set.seed(42)")
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ def predict(
|
|||
"""
|
||||
# Initialize R only if it is actually used.
|
||||
# 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.
|
||||
robjects.r("set.seed(42)")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@ def test_r_packages_installed():
|
|||
in the "research/r_dependencies.ipynb" notebook or
|
||||
in the GitHub Actions CI.
|
||||
"""
|
||||
from velofy import init_r
|
||||
from velofy import init_r # noqa:PLC0415
|
||||
|
||||
assert init_r is not None
|
||||
|
|
|
|||
Loading…
Reference in a new issue