Clean up the comments and lint the notebooks #22

Merged
alexander merged 19 commits from lint-cleanups into develop 2026-12-03 12:26:19 +01:00
11 changed files with 27 additions and 27 deletions
Showing only changes of commit 2f1afd459f - Show all commits

Break multi-line comments before conjunctions

Alexander Hess 2026-12-03 10:13:13 +01:00
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -305,8 +305,8 @@ class Path(meta.Base):
# the `.waypoints` are not available
self.sync_with_google_maps()
# First, plot the couriers' path between the start and
# end locations, so that it is below the `folium.Circle`s
# First, plot the couriers' path between the start and end locations,
# so that it is below the `folium.Circle`s
line = folium.PolyLine(
locations=(
self.first_address.location.lat_lng,

View file

@ -69,8 +69,8 @@ class Customer(meta.Base):
# Note: a `Customer` may have more than one delivery `Address`es.
# That is not true for `Restaurant`s after the data cleaning.
# Obtain all primary `Address`es where
# at least one delivery was made to `self`
# Obtain all primary `Address`es
# where at least one delivery was made to `self`
delivery_addresses = db.session.scalars(
sa.select(db.Address).where(
db.Address.id.in_(

View file

@ -50,8 +50,8 @@ class Forecast(meta.Base):
nullable=False,
)
# We also store the actual order counts for convenient retrieval.
# A `UniqueConstraint` below ensures that redundant values that
# are to be expected are consistent across rows.
# A `UniqueConstraint` below ensures that redundant values
# that are to be expected are consistent across rows.
actual: orm.Mapped[int] = orm.mapped_column(
sa.SmallInteger,
nullable=False,

View file

@ -216,8 +216,8 @@ class ReplayedOrder(meta.Base):
sa.CheckConstraint(
# A simulation must fill in at least all the timing and dispatch related
# columns, unless an order is cancelled in a run.
# Only `.estimated_prep_duration`, `.first_estimated_delivery_at`, and
# `.utilization` are truly optional.
# Only `.estimated_prep_duration`, `.first_estimated_delivery_at`,
# and `.utilization` are truly optional.
# This constraint does allow missing columns for cancelled orders
# in any combination of the below columns. So, no precedence constraints
# are enforced (e.g., `.restaurant_notified_at` and `.restaurant_ready_at`
@ -326,8 +326,8 @@ class ReplayedOrder(meta.Base):
name="orders_dispatched_in_business_hours",
),
*(
# The timestamps must be in a logically correct order. That is the same as
# in the actual `Order` model with an extra `restaurant_ready_at` column
# The timestamps must be in a logically correct order. That is the same
# as in the actual `Order` model with an extra `restaurant_ready_at` column
# and the non-simulated columns removed.
sa.CheckConstraint(
constraint,

View file

@ -110,8 +110,8 @@ class Restaurant(meta.Base):
`.address.city.map` for convenience in interactive usage
"""
if customers:
# Obtain all primary `Address`es in the city that
# received at least one delivery from `self`
# Obtain all primary `Address`es in the city
# that received at least one delivery from `self`
delivery_addresses = db.session.scalars(
sa.select(db.Address).where(
db.Address.id.in_(

View file

@ -44,8 +44,8 @@ def predict(
seasonal_lag = frequency * (training_ts.index[1] - training_ts.index[0])
for lag in range(frequency):
# Obtain all `observations` of the same seasonal lag and
# fit a straight line through them (= `trend`)
# Obtain all `observations` of the same seasonal lag
# and fit a straight line through them (= `trend`)
observations = training_ts[slice(lag, 999_999_999, frequency)]
trend = observations - tsa.detrend(observations)

View file

@ -93,8 +93,8 @@ class ForecastingModelABC(abc.ABC):
return cached_forecast
# Horizontal and real-time `*Model`s return a `pd.DataFrame` with one
# row corresponding to the time step starting at `predict_at` whereas
# vertical models return several rows, covering all time steps of a day
# row corresponding to the time step starting at `predict_at`
# whereas vertical models return several rows, covering all time steps of a day
predictions = self.predict(pixel, predict_at, train_horizon)
# Convert the `predictions` into a `list` of `Forecast` objects

View file

@ -30,9 +30,9 @@ def test_two_pixels_with_two_addresses(
# ... and another one in the upper-right one.
address2 = make_address(latitude=48.8898312, longitude=2.4357622)
# Locate a `Restaurant` at the two `Address` objects and
# place one `Order` for each of them so that the `Address`
# objects are used as `Order.pickup_address`s
# Locate a `Restaurant` at the two `Address`es
# and place one `Order` for each of them
# so that the `Address`es are used as `Order.pickup_address`es
restaurant1 = make_restaurant(address=address1)
restaurant2 = make_restaurant(address=address2)
order1 = make_order(restaurant=restaurant1)

View file

@ -21,8 +21,8 @@ class AddressFactory(alchemy.SQLAlchemyModelFactory):
created_at = factory.LazyFunction(utils.early_in_the_morning)
# When testing, all addresses are considered primary ones.
# As non-primary addresses have no different behavior and
# the property is only kept from the original dataset for
# As non-primary addresses have no different behavior
# and the property is only kept from the original dataset for
# completeness sake, that is ok to do.
primary_id = factory.LazyAttribute(lambda obj: obj.id)

View file

@ -384,8 +384,8 @@ class TestSyncWithGoogleMaps:
"legs": [
{
# We choose an artificially high distance of `9999`
# so that the synced bicycle distance is longer than
# the randomized air distance (i.e., fake data) for sure
# so that the synced bicycle distance is longer
# than the randomized air distance (i.e., fake data) for sure
"distance": {"text": "3.0 km", "value": 9999},
"duration": {"text": "10 mins", "value": 596},
"end_address": "13 Place Paul et Jean Paul Avisseau, ...",

View file

@ -100,8 +100,8 @@ class TestConstraints:
with pytest.raises(sa_exc.IntegrityError, match="fk_orders_to_restaurants"):
db_session.commit()
# Here should be a test to check deletion of a referenced pickup address, so
# `test_delete_a_referenced_pickup_address(self, db_session, order)`.
# Here should be a test to check deletion of a referenced pickup address,
# so `test_delete_a_referenced_pickup_address(self, db_session, order)`.
# The corresponding "fk_orders_to_addresses_on_pickup_address_id" constraint
# is very hard to test in isolation as the above "fk_orders_to_restaurants_..."
# constraint ensures its integrity already.
@ -1167,8 +1167,8 @@ def test_make_random_orders(
# Ad-hoc `Order`s are far more common than pre-orders
scheduled = random.choice([True, False, False, False, False])
# Randomly pass a `address` argument to `make_restaurant()` and
# a `restaurant` argument to `make_order()`
# Randomly pass a `address` argument to `make_restaurant()`
# and a `restaurant` argument to `make_order()`
if random.random() < 0.5:
address = random.choice([None, make_address()])
restaurant = make_restaurant(address=address)