From 2f1afd459fe73c2ab4136acaa1f87ecf64212e9f Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Thu, 3 Dec 2026 10:13:13 +0100 Subject: [PATCH] Break multi-line comments before conjunctions --- src/velofy/db/addresses_addresses.py | 4 ++-- src/velofy/db/customers.py | 4 ++-- src/velofy/db/forecasts.py | 4 ++-- src/velofy/db/replay/orders.py | 8 ++++---- src/velofy/db/restaurants.py | 4 ++-- src/velofy/forecasts/methods/extrapolate_season.py | 4 ++-- src/velofy/forecasts/models/base.py | 4 ++-- tests/console/test_gridify.py | 6 +++--- tests/db/fake_data/factories/addresses.py | 4 ++-- tests/db/test_addresses_addresses.py | 4 ++-- tests/db/test_orders.py | 8 ++++---- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/velofy/db/addresses_addresses.py b/src/velofy/db/addresses_addresses.py index 1919794..eb31d2f 100644 --- a/src/velofy/db/addresses_addresses.py +++ b/src/velofy/db/addresses_addresses.py @@ -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, diff --git a/src/velofy/db/customers.py b/src/velofy/db/customers.py index 15fb3c2..cb84ca7 100644 --- a/src/velofy/db/customers.py +++ b/src/velofy/db/customers.py @@ -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_( diff --git a/src/velofy/db/forecasts.py b/src/velofy/db/forecasts.py index 31ef318..d90c16c 100644 --- a/src/velofy/db/forecasts.py +++ b/src/velofy/db/forecasts.py @@ -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, diff --git a/src/velofy/db/replay/orders.py b/src/velofy/db/replay/orders.py index ffe126e..d9f5418 100644 --- a/src/velofy/db/replay/orders.py +++ b/src/velofy/db/replay/orders.py @@ -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, diff --git a/src/velofy/db/restaurants.py b/src/velofy/db/restaurants.py index 7a01f52..b1020f3 100644 --- a/src/velofy/db/restaurants.py +++ b/src/velofy/db/restaurants.py @@ -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_( diff --git a/src/velofy/forecasts/methods/extrapolate_season.py b/src/velofy/forecasts/methods/extrapolate_season.py index deab4fc..ffa6a5e 100644 --- a/src/velofy/forecasts/methods/extrapolate_season.py +++ b/src/velofy/forecasts/methods/extrapolate_season.py @@ -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) diff --git a/src/velofy/forecasts/models/base.py b/src/velofy/forecasts/models/base.py index fd8e9c0..0c490a8 100644 --- a/src/velofy/forecasts/models/base.py +++ b/src/velofy/forecasts/models/base.py @@ -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 diff --git a/tests/console/test_gridify.py b/tests/console/test_gridify.py index 4945b0e..13bfba1 100644 --- a/tests/console/test_gridify.py +++ b/tests/console/test_gridify.py @@ -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) diff --git a/tests/db/fake_data/factories/addresses.py b/tests/db/fake_data/factories/addresses.py index 3af587a..594ea5b 100644 --- a/tests/db/fake_data/factories/addresses.py +++ b/tests/db/fake_data/factories/addresses.py @@ -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) diff --git a/tests/db/test_addresses_addresses.py b/tests/db/test_addresses_addresses.py index 2611e9c..313f669 100644 --- a/tests/db/test_addresses_addresses.py +++ b/tests/db/test_addresses_addresses.py @@ -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, ...", diff --git a/tests/db/test_orders.py b/tests/db/test_orders.py index 38e8526..b62d57a 100644 --- a/tests/db/test_orders.py +++ b/tests/db/test_orders.py @@ -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)