Add ruff to the project #6

Merged
alexander merged 5 commits from add-ruff into develop 2026-11-28 05:01:26 +01:00
18 changed files with 318 additions and 98 deletions

View file

@ -2,8 +2,8 @@
By default, `uv run nox` runs the sessions that assure code quality:
- "format": Format the source files with `autoflake`, `black`, and `isort`
- "lint": Lint the source files with `flake8` and `isort`
- "format": Format source files with `autoflake`, `black`, `flynt`, `isort`, and `ruff`
- "lint": Lint source files with `flake8`, `isort`, and `ruff`
- "test": Run the test suite with `pytest`
- "doctest": Check if code snippets in the docstrings run
@ -141,7 +141,7 @@ os.makedirs(tempfile.tempdir, exist_ok=True)
@nox.session(name="format", python=MAIN_PYTHON)
def format_code(session: Session) -> None:
"""Format source files with `autoflake`, `black`, and `isort`.
"""Format source files with `autoflake`, `black`, `flynt`, `isort`, and `ruff`.
If no extra arguments are provided, all source files are formatted.
Otherwise, they are interpreted as paths the formatters work on recursively.
@ -150,7 +150,7 @@ def format_code(session: Session) -> None:
# The formatters do not need `velofy` installed
# because they work on the source files directly
install_pinned(session, "autoflake", "black", "isort")
install_pinned(session, "autoflake", "black", "flynt", "isort", "ruff")
# Interpret extra arguments as `locations` of source files
locations = session.posargs or SRC_LOCATIONS
@ -160,16 +160,23 @@ def format_code(session: Session) -> None:
session.run("autoflake", "--version")
session.run("autoflake", *locations)
session.run("flynt", "--version")
session.run("flynt", *locations)
session.run("black", "--version")
session.run("black", *locations)
session.run("isort", "--version")
session.run("isort", *locations)
session.run("ruff", "--version")
session.run("ruff", "check", "--fix-only", *locations)
session.run("ruff", "format", *locations)
@nox.session(name="lint", python=MAIN_PYTHON)
def lint_code(session: Session) -> None:
"""Lint source files with `flake8` and `isort`.
"""Lint source files with `flake8`, `isort`, and `ruff`.
If no extra arguments are provided, all source files are linted.
Otherwise, they are interpreted as paths the linters work on recursively.
@ -201,6 +208,7 @@ def lint_code(session: Session) -> None:
# 'mypy',
"pep8-naming",
"pydoclint[flake8]",
"ruff",
)
# Interpret extra arguments as `locations` of source files
@ -214,12 +222,15 @@ def lint_code(session: Session) -> None:
session.run("isort", "--version")
session.run("isort", "--check-only", *locations)
session.run("ruff", "--version")
session.run("ruff", "check", *locations)
# TODO: Include `mypy` once it passes
# - Only for the *.py files to be packaged
# - It then needs the developed package and its dependencies installed
# as it treats missing packages as `Any` and reports false successes
# session.run('mypy', '--version')
# session.run('mypy', PACKAGE_LOCATION)
# session.run('mypy', '--version') # noqa:ERA001
# session.run('mypy', PACKAGE_LOCATION) # noqa:ERA001
@nox.session(name="test", python=MAIN_PYTHON)
@ -306,7 +317,7 @@ def build_docs(session: Session) -> None:
# Verify that all external links return 200 OK
session.run("sphinx-build", "-b", "linkcheck", DOCS_LOCATION, DOCS_BUILD)
print(f"Docs are available at {os.getcwd()}/{DOCS_BUILD}index.html")
session.log(f"Docs are available at {os.getcwd()}/{DOCS_BUILD}index.html")
@nox.session(name="venv", python=MAIN_PYTHON, venv_backend="none")

View file

@ -86,6 +86,7 @@ dev = [
# Code Formatters
"autoflake (>=2.4.0,<3.0.0)",
"black (>=25.12.0,<26.0.0)",
"flynt (>=1.0.6,<2.0.0)",
"isort (>=9.0.2,<10.0.0)",
# Code Analyzers
@ -108,6 +109,7 @@ dev = [
"mypy (>=2.4.1,<3.0.0)",
"pep8-naming (>=0.15.1,<0.16.0)",
"pydoclint[flake8] (>=0.12.0,<0.13.0)",
"ruff (>=0.17.6,<0.18.0)",
]
test = [
@ -315,7 +317,7 @@ pytest-parametrize-values-type = "list"
# Source: https://pycqa.github.io/isort/docs/configuration/options.html
atomic = true
case_sensitive = true
case_sensitive = false # Implied by "force_alphabetical_sort_within_sections"
combine_star = true
force_alphabetical_sort_within_sections = true
lines_after_imports = 2
@ -418,6 +420,135 @@ markers = [
[tool.ruff]
# Source: https://docs.astral.sh/ruff/
cache-dir = ".cache/ruff"
src = ["src"]
target-version = "py313"
line-length = 88
[tool.ruff.format]
# Align with black
quote-style = "double"
skip-magic-trailing-comma = false
[tool.ruff.lint] # aligned with [tool.flake8] above
select = [
# ===================================
# Violations also covered by `flake8`
# ===================================
# flake8-annotations => enforce type checking for functions
"ANN0", "ANN2",
# flake8-unused-arguments ("U100") => declared function arguments must be used
"ARG",
# flake8-bugbear => opinionated bugs and design flaws
"B",
# flake8-comprehensions => better comprehensions
"C4",
# mccabe => cyclomatic complexity
"C90",
# flake8-commas ("C8") => better comma placements
"COM",
# flake8-docstrings => PEP257 compliance
"D",
# pycodestyle => PEP8 compliance
"E", "W",
# pyflakes => basic errors
"F",
# pep8-naming => PEP8 naming conventions
"N",
# flake8-pytest-style => enforce a consistent style with pytest
"PT",
# flake8-quotes => use double quotes everywhere
"Q",
# flake8-bandit => common security issues
"S",
# flake8-debugger => no debugger usage
"T10",
# flake8-todos => unify TODOs
"TD",
# =======================================
# Violations not covered by `flake8` above
# =======================================
# eradicate => no commented-out code
"ERA",
# isort => imports are sorted
"I",
# Pylint's refactoring rules => simpler and smaller functions
"PLR",
# flake8-print => no `print()`
"T20",
]
extend-ignore = [
# Let the formatter handle trailing commas.
"COM812",
# Thresholds like the ones in the maps read better as literals.
"PLR2004",
# Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`.
"PT023",
# TODOs need neither an author nor an issue.
"TD002", "TD003",
]
[tool.ruff.lint.per-file-ignores]
# Top-levels of a sub-packages are intended to import a lot.
"**/__init__.py" = ["F401"]
# Type annotations are not strictly enforced.
"migrations/env.py" = ["ANN0", "ANN2"]
# - ANN0, ANN2 => Type annotations are not strictly enforced.
# - S608 => Do not worry about SQL injection here.
"migrations/versions/*.py" = ["ANN0", "ANN2", "S608"]
# Type annotations are not strictly enforced.
"noxfile.py" = ["ANN0", "ANN2"]
# `print()` is ok in ad-hoc scripts
"scripts/**" = ["T20"]
# - ANN0, ANN2 => Type annotations are not strictly enforced.
# - D106 => The `Meta` class inside the factory_boy models do not need a docstring.
# - PLR0913, PLR0917 => `pytest` passes fixtures as arguments.
# - S101 => `assert` statements are ok in the test suite.
# - S311 => The `random` module is not used for cryptography.
"tests/**/*.py" = ["ANN0", "ANN2", "D106", "PLR0913", "PLR0917", "S101", "S311"]
[tool.ruff.lint.flake8-pytest-style] # aligned with [tool.flake8] above
fixture-parentheses = false
parametrize-names-type = "list"
parametrize-values-row-type = "tuple"
parametrize-values-type = "list"
[tool.ruff.lint.isort] # aligned with [tool.isort] above
case-sensitive = false # Same as `isort`
force-single-line = true
lines-after-imports = 2
order-by-type = false
single-line-exclusions = ["typing"]
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.uv]
# Source: https://docs.astral.sh/uv/reference/settings/

View file

@ -20,7 +20,7 @@ def db_revision(
"""Do not execute the `func` if the revision does not match."""
if not os.getenv("TESTING"):
result = subprocess.run( # noqa:S603,S607
["alembic", "current"],
["alembic", "current"], # noqa:S607
capture_output=True,
check=False,
encoding="utf8",

View file

@ -24,7 +24,7 @@ from velofy.forecasts import timify
@click.argument("time_step", default=60, type=int)
@click.argument("train_horizon", default=8, type=int)
@decorators.db_revision("8bfb928a31f8")
def tactical_heuristic( # noqa:C901,DOC001
def tactical_heuristic( # noqa:C901,D417,DOC001
city: str,
side_length: int,
time_step: int,

View file

@ -33,7 +33,7 @@ class Path(meta.Base):
Implements an association pattern between `Address` and `Address`.
Further info:
https://docs.sqlalchemy.org/en/stable/orm/basic_relationships.html#association-object # noqa:E501
https://docs.sqlalchemy.org/en/stable/orm/basic_relationships.html#association-object
"""
__tablename__ = "addresses_addresses"
@ -254,7 +254,7 @@ class Path(meta.Base):
return points
def draw(
def draw( # noqa:PLR0913
self,
*,
reverse: bool = False,

View file

@ -13,7 +13,7 @@ class AddressPixelAssociation(meta.Base):
updates the `city_id` and `grid_id` columns.
Further info:
https://docs.sqlalchemy.org/en/stable/orm/basic_relationships.html#association-object # noqa:E501
https://docs.sqlalchemy.org/en/stable/orm/basic_relationships.html#association-object
"""
__tablename__ = "addresses_pixels"

View file

@ -216,14 +216,14 @@ class City(meta.Base):
row[0]
for row in db.session.execute(
sa.text(
f""" -- # noqa:S608
f"""
SELECT DISTINCT
{config.CLEAN_SCHEMA}.addresses.zip_code
FROM
{config.CLEAN_SCHEMA}.addresses AS addresses
WHERE
{config.CLEAN_SCHEMA}.addresses.city_id = {self.id};
""",
""", # noqa:S608
),
)
)

View file

@ -40,7 +40,7 @@ class Customer(meta.Base):
"""Shortcut to the `...city.map` object."""
return self.orders[0].pickup_address.city.map
def draw( # noqa:C901
def draw( # noqa:C901,PLR0912
self,
restaurants: bool = True,
order_counts: bool = False, # pragma: no cover
@ -140,13 +140,11 @@ class Customer(meta.Base):
.all()
)
if len(restaurants) == 1: # type:ignore
tooltip = (
f"{restaurants[0].name} (#{restaurants[0].id})" # type:ignore
)
restaurant = restaurants[0] # type:ignore
tooltip = f"{restaurant.name} (#{restaurant.id})"
else:
tooltip = "Restaurants " + ", ".join(
f"#{restaurant.id}" for restaurant in restaurants # type:ignore
)
ids = ", ".join(f"#{r.id}" for r in restaurants) # type:ignore
tooltip = f"Restaurants {ids}"
if order_counts:
n_orders = (

View file

@ -141,7 +141,7 @@ class Pixel(meta.Base):
"""Shortcut to the `.city.map` object."""
return self.grid.city.map
def draw( # noqa:C901
def draw( # noqa:C901,PLR0912
self,
restaurants: bool = True,
order_counts: bool = False, # pragma: no cover
@ -215,13 +215,11 @@ class Pixel(meta.Base):
.all()
)
if len(restaurants) == 1: # type:ignore
tooltip = (
f"{restaurants[0].name} (#{restaurants[0].id})" # type:ignore
)
restaurant = restaurants[0] # type:ignore
tooltip = f"{restaurant.name} (#{restaurant.id})"
else:
tooltip = "Restaurants " + ", ".join(
f"#{restaurant.id}" for restaurant in restaurants # type:ignore
)
ids = ", ".join(f"#{r.id}" for r in restaurants) # type:ignore
tooltip = f"Restaurants {ids}"
if order_counts:
# Calculate the number of orders for ALL restaurants ...

View file

@ -12,7 +12,7 @@ from rpy2 import robjects
from rpy2.robjects import pandas2ri
def stl( # noqa:C901
def stl( # noqa:C901,PLR0912,PLR0913,PLR0915
time_series: pd.Series,
*,
frequency: int,

View file

@ -134,7 +134,6 @@ class HorizontalSMAModel(base.ForecastingModelABC):
if (
predictions[["actual", "prediction"]].isnull().any().any()
): # pragma: no cover
raise RuntimeError("missing predictions in hsma model")
if predict_at not in predictions.index: # pragma: no cover
raise RuntimeError("missing prediction for `predict_at`")

View file

@ -71,7 +71,7 @@ class OrderHistory:
# This happens when there is no demand in the `Pixel` in the given `time_step`.
data = pd.read_sql_query(
sa.text(
f""" -- # noqa:S608
f"""
SELECT
pixel_id,
start_at,
@ -139,7 +139,7 @@ class OrderHistory:
ORDER BY
pixel_id,
start_at;
""",
""", # noqa:S608
),
con=db.connection,
index_col=["pixel_id", "start_at"],

View file

@ -48,18 +48,22 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
cancel_before_pickup = factory.Trait(
cancel_=True,
cancelled_at=factory.LazyAttribute(
lambda obj: obj.dispatch_at
+ utils.random_timespan(
max_seconds=(obj.pickup_at - obj.dispatch_at).total_seconds(),
lambda obj: (
obj.dispatch_at
+ utils.random_timespan(
max_seconds=(obj.pickup_at - obj.dispatch_at).total_seconds(),
)
),
),
)
cancel_after_pickup = factory.Trait(
cancel_=True,
cancelled_at=factory.LazyAttribute(
lambda obj: obj.pickup_at
+ utils.random_timespan(
max_seconds=(obj.delivery_at - obj.pickup_at).total_seconds(),
lambda obj: (
obj.pickup_at
+ utils.random_timespan(
max_seconds=(obj.delivery_at - obj.pickup_at).total_seconds(),
)
),
),
)
@ -71,8 +75,10 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
# Attributes regarding the specialization of an `Order`: ad-hoc or scheduled.
# Ad-hoc `Order`s are placed between 11.45 and 14.15.
placed_at = factory.LazyFunction(
lambda: dt.datetime(*test_config.DATE, 11, 45)
+ utils.random_timespan(max_hours=2, max_minutes=30),
lambda: (
dt.datetime(*test_config.DATE, 11, 45)
+ utils.random_timespan(max_hours=2, max_minutes=30)
),
)
ad_hoc = True
scheduled_delivery_at = None
@ -96,15 +102,18 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
# Restaurant-related attributes
# restaurant -> set by the `make_order` fixture for better control
restaurant_notified_at = factory.LazyAttribute(
lambda obj: obj.placed_at
+ utils.random_timespan(min_seconds=30, max_seconds=90),
lambda obj: (
obj.placed_at + utils.random_timespan(min_seconds=30, max_seconds=90)
),
)
restaurant_notified_at_corrected = factory.LazyAttribute(
lambda obj: False if obj.restaurant_notified_at else None,
)
restaurant_confirmed_at = factory.LazyAttribute(
lambda obj: obj.restaurant_notified_at
+ utils.random_timespan(min_seconds=30, max_seconds=150),
lambda obj: (
obj.restaurant_notified_at
+ utils.random_timespan(min_seconds=30, max_seconds=150)
),
)
restaurant_confirmed_at_corrected = factory.LazyAttribute(
lambda obj: False if obj.restaurant_confirmed_at else None,
@ -117,22 +126,26 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
# Dispatch-related columns
# courier -> set by the `make_order` fixture for better control
dispatch_at = factory.LazyAttribute(
lambda obj: obj.placed_at
+ utils.random_timespan(min_seconds=600, max_seconds=1080),
lambda obj: (
obj.placed_at + utils.random_timespan(min_seconds=600, max_seconds=1080)
),
)
dispatch_at_corrected = factory.LazyAttribute(
lambda obj: False if obj.dispatch_at else None,
)
courier_notified_at = factory.LazyAttribute(
lambda obj: obj.dispatch_at
+ utils.random_timespan(min_seconds=100, max_seconds=140),
lambda obj: (
obj.dispatch_at + utils.random_timespan(min_seconds=100, max_seconds=140)
),
)
courier_notified_at_corrected = factory.LazyAttribute(
lambda obj: False if obj.courier_notified_at else None,
)
courier_accepted_at = factory.LazyAttribute(
lambda obj: obj.courier_notified_at
+ utils.random_timespan(min_seconds=15, max_seconds=45),
lambda obj: (
obj.courier_notified_at
+ utils.random_timespan(min_seconds=15, max_seconds=45)
),
)
courier_accepted_at_corrected = factory.LazyAttribute(
lambda obj: False if obj.courier_accepted_at else None,
@ -143,20 +156,25 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
# Pickup-related attributes
# pickup_address -> aligned with `restaurant.address` by the `make_order` fixture
reached_pickup_at = factory.LazyAttribute(
lambda obj: obj.courier_accepted_at
+ utils.random_timespan(min_seconds=300, max_seconds=600),
lambda obj: (
obj.courier_accepted_at
+ utils.random_timespan(min_seconds=300, max_seconds=600)
),
)
pickup_at = factory.LazyAttribute(
lambda obj: obj.reached_pickup_at
+ utils.random_timespan(min_seconds=120, max_seconds=600),
lambda obj: (
obj.reached_pickup_at
+ utils.random_timespan(min_seconds=120, max_seconds=600)
),
)
pickup_at_corrected = factory.LazyAttribute(
lambda obj: False if obj.pickup_at else None,
)
pickup_not_confirmed = False
left_pickup_at = factory.LazyAttribute(
lambda obj: obj.pickup_at
+ utils.random_timespan(min_seconds=60, max_seconds=180),
lambda obj: (
obj.pickup_at + utils.random_timespan(min_seconds=60, max_seconds=180)
),
)
left_pickup_at_corrected = factory.LazyAttribute(
lambda obj: False if obj.left_pickup_at else None,
@ -165,12 +183,15 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
# Delivery-related attributes
# delivery_address -> set by the `make_order` fixture as there is only one `city`
reached_delivery_at = factory.LazyAttribute(
lambda obj: obj.left_pickup_at
+ utils.random_timespan(min_seconds=240, max_seconds=480),
lambda obj: (
obj.left_pickup_at + utils.random_timespan(min_seconds=240, max_seconds=480)
),
)
delivery_at = factory.LazyAttribute(
lambda obj: obj.reached_delivery_at
+ utils.random_timespan(min_seconds=240, max_seconds=660),
lambda obj: (
obj.reached_delivery_at
+ utils.random_timespan(min_seconds=240, max_seconds=660)
),
)
delivery_at_corrected = factory.LazyAttribute(
lambda obj: False if obj.delivery_at else None,
@ -182,10 +203,12 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
# Statistical attributes -> calculate realistic stats
logged_delivery_distance = factory.LazyAttribute(
lambda obj: distance.great_circle(
(obj.pickup_address.latitude, obj.pickup_address.longitude),
(obj.delivery_address.latitude, obj.delivery_address.longitude),
).meters,
lambda obj: (
distance.great_circle(
(obj.pickup_address.latitude, obj.pickup_address.longitude),
(obj.delivery_address.latitude, obj.delivery_address.longitude),
).meters
),
)
logged_avg_speed = factory.LazyAttribute(
lambda obj: round(

View file

@ -34,62 +34,81 @@ class ReplayedOrderFactory(alchemy.SQLAlchemyModelFactory):
# Restaurant-related columns
estimated_prep_duration = 1200
restaurant_notified_at = factory.LazyAttribute(
lambda obj: obj.placed_at
+ utils.random_timespan(min_seconds=1, max_seconds=30),
lambda obj: (
obj.placed_at + utils.random_timespan(min_seconds=1, max_seconds=30)
),
)
restaurant_confirmed_at = factory.LazyAttribute(
lambda obj: obj.restaurant_notified_at
+ utils.random_timespan(min_seconds=1, max_seconds=60),
lambda obj: (
obj.restaurant_notified_at
+ utils.random_timespan(min_seconds=1, max_seconds=60)
),
)
restaurant_ready_at = factory.LazyAttribute(
lambda obj: obj.restaurant_confirmed_at
+ dt.timedelta(seconds=obj.estimated_prep_duration)
+ utils.random_timespan(min_seconds=300, max_seconds=300),
lambda obj: (
obj.restaurant_confirmed_at
+ dt.timedelta(seconds=obj.estimated_prep_duration)
+ utils.random_timespan(min_seconds=300, max_seconds=300)
),
)
# Dispatch-related columns
dispatch_at = factory.LazyAttribute(
lambda obj: obj.actual.placed_at
+ utils.random_timespan(min_seconds=30, max_seconds=60),
lambda obj: (
obj.actual.placed_at + utils.random_timespan(min_seconds=30, max_seconds=60)
),
)
first_estimated_delivery_at = factory.LazyAttribute(
lambda obj: obj.restaurant_notified_at
+ dt.timedelta(seconds=obj.estimated_prep_duration)
+ dt.timedelta(minutes=10),
lambda obj: (
obj.restaurant_notified_at
+ dt.timedelta(seconds=obj.estimated_prep_duration)
+ dt.timedelta(minutes=10)
),
)
# courier -> set by the `make_replay_order` fixture for better control
courier_notified_at = factory.LazyAttribute(
lambda obj: obj.dispatch_at
+ utils.random_timespan(min_seconds=1, max_seconds=30),
lambda obj: (
obj.dispatch_at + utils.random_timespan(min_seconds=1, max_seconds=30)
),
)
courier_accepted_at = factory.LazyAttribute(
lambda obj: obj.courier_notified_at
+ utils.random_timespan(min_seconds=1, max_seconds=60),
lambda obj: (
obj.courier_notified_at
+ utils.random_timespan(min_seconds=1, max_seconds=60)
),
)
utilization = None
# Pickup-related columns
reached_pickup_at = factory.LazyAttribute(
lambda obj: obj.restaurant_ready_at
+ utils.random_timespan(min_seconds=1, max_seconds=60),
lambda obj: (
obj.restaurant_ready_at
+ utils.random_timespan(min_seconds=1, max_seconds=60)
),
)
pickup_at = factory.LazyAttribute(
lambda obj: obj.reached_pickup_at
+ utils.random_timespan(min_seconds=30, max_seconds=60),
lambda obj: (
obj.reached_pickup_at
+ utils.random_timespan(min_seconds=30, max_seconds=60)
),
)
left_pickup_at = factory.LazyAttribute(
lambda obj: obj.pickup_at
+ utils.random_timespan(min_seconds=30, max_seconds=60),
lambda obj: (
obj.pickup_at + utils.random_timespan(min_seconds=30, max_seconds=60)
),
)
# Delivery-related columns
reached_delivery_at = factory.LazyAttribute(
lambda obj: obj.left_pickup_at
+ utils.random_timespan(min_minutes=5, max_minutes=10),
lambda obj: (
obj.left_pickup_at + utils.random_timespan(min_minutes=5, max_minutes=10)
),
)
delivery_at = factory.LazyAttribute(
lambda obj: obj.reached_delivery_at
+ utils.random_timespan(min_seconds=30, max_seconds=60),
lambda obj: (
obj.reached_delivery_at
+ utils.random_timespan(min_seconds=30, max_seconds=60)
),
)
@factory.post_generation

View file

@ -45,12 +45,16 @@ class ScheduledOrderFactory(ad_hoc.AdHocOrderFactory):
# Restaurant-related attributes
restaurant_notified_at = factory.LazyAttribute(
lambda obj: obj.scheduled_delivery_at
- utils.random_timespan(min_minutes=45, max_minutes=50),
lambda obj: (
obj.scheduled_delivery_at
- utils.random_timespan(min_minutes=45, max_minutes=50)
),
)
# Dispatch-related attributes
dispatch_at = factory.LazyAttribute(
lambda obj: obj.scheduled_delivery_at
- utils.random_timespan(min_minutes=40, max_minutes=45),
lambda obj: (
obj.scheduled_delivery_at
- utils.random_timespan(min_minutes=40, max_minutes=45)
),
)

View file

@ -1097,7 +1097,6 @@ def test_make_random_orders( # noqa:C901
"""
# Generate a large number of `Order`s to obtain a large variance of data.
for _ in range(1_000):
# Ad-hoc `Order`s are far more common than pre-orders.
scheduled = random.choice([True, False, False, False, False])

View file

@ -98,7 +98,7 @@ class TestSpecialMethods:
def test_compare_utm_coordinates_to_themselves(self, location):
"""Test `Location.__eq__()`."""
result = location == location
result = location == location # noqa:PLR0124
assert result is True

38
uv.lock generated
View file

@ -1076,6 +1076,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/b3/0b/1d658aca231a3e4b3c0b9e7fed71ced551cbfd955a41cfd32b221b396edc/flake8_unused_arguments-0.0.14-py3-none-any.whl", hash = "sha256:6c0b7ce7236a156f4bd90adec67ad0e5d0139efcd15c2a1fc0fb3a6ffd7e435e", size = 6190, upload-time = "2025-10-27T22:22:54.888Z" },
]
[[package]]
name = "flynt"
version = "1.0.6"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/23/ea/be0bd620182b18af37cc784c6f0e1766246982084776702cd1b5649b6885/flynt-1.0.6.tar.gz", hash = "sha256:471b7ff00756678e2912d4261dcbcd8fc1395129b66bf6977f88a3b3ad220c90", size = 25907, upload-time = "2025-07-29T06:12:46.808Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/d7/80/14dc476cf6b6897a613f242beda253ba380f0e25d6355cb299e6b95f2aee/flynt-1.0.6-py3-none-any.whl", hash = "sha256:4e837c9597036b634a347855a89acf1483c4f8b73daa82c49372b10b6e1d1778", size = 36663, upload-time = "2025-07-29T06:12:45.386Z" },
]
[[package]]
name = "folium"
version = "1.0.0"
@ -3172,6 +3181,31 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/68/3d/51c9bbe79865a1eb0661b7f660e48fbf066d3940cb7773d906fd1d9dafc4/rpy2_robjects-3.6.6-py3-none-any.whl", hash = "sha256:ec377b1eb5a41964b5d3b3b164781c5dd2f602f3bb3d9409094c2b4de3608888", size = 125823, upload-time = "2026-10-10T17:42:37.273Z" },
]
[[package]]
name = "ruff"
version = "0.17.6"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/df/8e/6929d337aa5380aafc7355f3149f3ccfe55cba5fdd34a045697ebaceb5a0/ruff-0.17.6.tar.gz", hash = "sha256:2b04276561331300325040bdca21460770029ec574d4c479099e39e8ad1ed43c", size = 5374388, upload-time = "2026-11-19T15:56:27.106Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/12/5d/38ef6310c22cacb094e9ae0ff7964062e04ffeecb45ee296894c2b1acc54/ruff-0.17.6-py3-none-linux_armv6l.whl", hash = "sha256:084d9c8f5ec718e7eba007dba339e7cb4f7571d2f267558ae080bf428fb6a69b", size = 10174693, upload-time = "2026-11-19T15:55:52.414Z" },
{ url = "https://files.pythonhosted.org/packages/a2/ed/fd35261049920a4888ef7c787a5c27089502077a4910f6ca8f1213157d6d/ruff-0.17.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:9d44ef2140402043fd6f689ef541858b80883a8b0a02e38539ef0614ebe57d0c", size = 10221650, upload-time = "2026-11-19T15:55:54.962Z" },
{ url = "https://files.pythonhosted.org/packages/ba/d4/c31391b36c729cd9fafa65b7a52a58850b99afb2b65da6be4263a53302f2/ruff-0.17.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:9fbddc08577592e283c265d865e0182de6e33db185494db7b06290d989d888e5", size = 9580986, upload-time = "2026-11-19T15:55:57.391Z" },
{ url = "https://files.pythonhosted.org/packages/eb/11/f3032684dcb3a676d7924545153d76fb56f76753e038f2ea650b99c71bdf/ruff-0.17.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:435241c61af5909a022f76219d3d1bf24730dc1bf0acabb5ddf4b569ab3cbb30", size = 10271368, upload-time = "2026-11-19T15:55:59.654Z" },
{ url = "https://files.pythonhosted.org/packages/08/30/c1e024eeb5bae99ae78c6b896ed108f64c9c845a03b56eaeff098e99b6e6/ruff-0.17.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d006bbb2945edb17b0ce6a0c1b5f5a8d81ba11dbac294a0a925effa22ce34feb", size = 9981564, upload-time = "2026-11-19T15:56:01.807Z" },
{ url = "https://files.pythonhosted.org/packages/7d/a5/da3e0c2d4bf02b3ca6c1d7fa4bb04d0081e340b1dd03c4f83b1bec3e15c1/ruff-0.17.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd661702202a89c00a4c9d0339008805fa5876bfa1c57e165495c2e62230dfbf", size = 10641991, upload-time = "2026-11-19T15:56:03.981Z" },
{ url = "https://files.pythonhosted.org/packages/4d/c1/6d7f981e86201c9db457cca99fd2c09b77574ebab37dff3e9239b218603c/ruff-0.17.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6a12c50a33936dc00db2be21ba25fb168a8b95c55eda2a3ac85005af69885e4b", size = 11403484, upload-time = "2026-11-19T15:56:05.778Z" },
{ url = "https://files.pythonhosted.org/packages/c3/92/8182f07b94998541d5f8f38f53da465aa28062afce24ecc398f45bfc62f1/ruff-0.17.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b5aba93b3db4b70c5697e4fee6e0d5b9c8452a9a3a03679611cadc25915a2173", size = 10892316, upload-time = "2026-11-19T15:56:08.016Z" },
{ url = "https://files.pythonhosted.org/packages/be/48/3df7d81249fd69ee6a49519b149fb5d11e13118fd7d0e8d65329a237087b/ruff-0.17.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa3b08254a732acba246891089a152c47c5733dc36b8ecb76ce8602f8326e5e4", size = 10645279, upload-time = "2026-11-19T15:56:09.785Z" },
{ url = "https://files.pythonhosted.org/packages/71/80/4d232281544345d7beb98d1d32c24dae804ed360780a6f7753738b81225e/ruff-0.17.6-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:0692088e6b33455572fb18465e891b443f196e98dc1986825685c77ff6f4c5ac", size = 10534501, upload-time = "2026-11-19T15:56:11.718Z" },
{ url = "https://files.pythonhosted.org/packages/98/0a/b477f075a4a94eb541bf1c759a3e72b2a3d6390af7a13a5be0887229f67c/ruff-0.17.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:fb589e032806bb942e4fb526f30b80a1a64112147ed9f1d38cc3de2e255b6f45", size = 10136036, upload-time = "2026-11-19T15:56:13.779Z" },
{ url = "https://files.pythonhosted.org/packages/f1/d8/cf32fbfeb1fcda1470fb5c3bee50c69ee6bca257d487ec1eb17a0387edb4/ruff-0.17.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1939b3d701c7b6981b7cf93473de5bf88b129b9ba84efaed5154cc517c44634d", size = 9969640, upload-time = "2026-11-19T15:56:15.738Z" },
{ url = "https://files.pythonhosted.org/packages/a7/22/bb9f9752f7fcdfdc8b9c51576cc142bb377ade745290e35085173963c7be/ruff-0.17.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1a0bea6aa1216e0ec4cd35d3dbccec0d772a7c2aad28ec9c6e82571dff2c20b0", size = 10389427, upload-time = "2026-11-19T15:56:17.617Z" },
{ url = "https://files.pythonhosted.org/packages/81/c7/e09d220818ab146b736d62e0676dad215215d7de0884bbdad9fa075dc7d2/ruff-0.17.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3db61f5015600543a581b07fa7f6f64afa0eeedefe16034cadd88c4074087582", size = 10760296, upload-time = "2026-11-19T15:56:19.463Z" },
{ url = "https://files.pythonhosted.org/packages/2e/09/28329441dfa2c463e2d377a69d4ebbe4d51665e9dbd49fb421f3bc80d775/ruff-0.17.6-py3-none-win32.whl", hash = "sha256:c2f4af6670b7a0501904e881bb3f1f24bd0d964dec1eedbd85f0eb73786e1128", size = 9966266, upload-time = "2026-11-19T15:56:21.581Z" },
{ url = "https://files.pythonhosted.org/packages/4b/9d/18ba9730addfc7554c70d6f171fb8dc2c08e774d9fb2b98e7946ef845c59/ruff-0.17.6-py3-none-win_amd64.whl", hash = "sha256:9cd2fd9923e9806b8b6b67a3469e2258e84bd4d21e45d5a1a690afdfb9c8e57d", size = 10365847, upload-time = "2026-11-19T15:56:23.582Z" },
{ url = "https://files.pythonhosted.org/packages/70/8a/59c33e2a64a4f9672f7f842a0dc522915cfbbaffd13d37d0cec57d1c5c5d/ruff-0.17.6-py3-none-win_arm64.whl", hash = "sha256:d8b14e1473dc86ab9069cf7a2ba5041dc012f59110201844ed04cfddf07055a0", size = 9926224, upload-time = "2026-11-19T15:56:25.269Z" },
]
[[package]]
name = "scipy"
version = "1.18.1"
@ -3759,12 +3793,14 @@ dev = [
{ name = "flake8-sfs" },
{ name = "flake8-todos" },
{ name = "flake8-unused-arguments" },
{ name = "flynt" },
{ name = "isort" },
{ name = "mypy" },
{ name = "nox" },
{ name = "pep8-naming" },
{ name = "pre-commit" },
{ name = "pydoclint", extra = ["flake8"] },
{ name = "ruff" },
]
docs = [
{ name = "sphinx" },
@ -3823,12 +3859,14 @@ dev = [
{ name = "flake8-sfs", specifier = ">=1.0.1,<2.0.0" },
{ name = "flake8-todos", specifier = ">=0.3.1,<0.4.0" },
{ name = "flake8-unused-arguments", specifier = ">=0.0.14,<0.1.0" },
{ name = "flynt", specifier = ">=1.0.6,<2.0.0" },
{ name = "isort", specifier = ">=9.0.2,<10.0.0" },
{ name = "mypy", specifier = ">=2.4.1,<3.0.0" },
{ name = "nox", specifier = ">=2026.10.20" },
{ name = "pep8-naming", specifier = ">=0.15.1,<0.16.0" },
{ name = "pre-commit", specifier = ">=4.7.0,<5.0.0" },
{ name = "pydoclint", extras = ["flake8"], specifier = ">=0.12.0,<0.13.0" },
{ name = "ruff", specifier = ">=0.17.6,<0.18.0" },
]
docs = [
{ name = "sphinx", specifier = ">=9.2.0,<10.0.0" },