Explain the "why" in a few more comments
Comments that only repeated the code are removed.
This commit is contained in:
parent
51f68743e5
commit
f90f263dab
4 changed files with 8 additions and 10 deletions
|
|
@ -123,7 +123,6 @@ class Grid(meta.Base):
|
||||||
|
|
||||||
pixel = pixels[(n_x, n_y)]
|
pixel = pixels[(n_x, n_y)]
|
||||||
|
|
||||||
# Create an association between the `address` and `pixel`
|
|
||||||
assoc = db.AddressPixelAssociation(address=address, pixel=pixel)
|
assoc = db.AddressPixelAssociation(address=address, pixel=pixel)
|
||||||
pixel.addresses.append(assoc)
|
pixel.addresses.append(assoc)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ class ForecastingModelABC(abc.ABC):
|
||||||
# vertical ones all time steps of the day
|
# vertical ones all time steps of the day
|
||||||
predictions = self.predict(pixel, predict_at, train_horizon)
|
predictions = self.predict(pixel, predict_at, train_horizon)
|
||||||
|
|
||||||
# Convert the `predictions` into a `list` of `Forecast` objects
|
|
||||||
forecasts = db.Forecast.from_dataframe(
|
forecasts = db.Forecast.from_dataframe(
|
||||||
pixel=pixel,
|
pixel=pixel,
|
||||||
time_step=self._order_history.time_step,
|
time_step=self._order_history.time_step,
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ class OrderHistory:
|
||||||
msg = "no orders in the pixel"
|
msg = "no orders in the pixel"
|
||||||
raise RuntimeError(msg)
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
# Return a proper `datetime.datetime` object
|
# A plain `dt.datetime` instead of a `pd.Timestamp`
|
||||||
return dt.datetime(
|
return dt.datetime(
|
||||||
first_order.year,
|
first_order.year,
|
||||||
first_order.month,
|
first_order.month,
|
||||||
|
|
@ -240,7 +240,7 @@ class OrderHistory:
|
||||||
msg = "no orders in the pixel"
|
msg = "no orders in the pixel"
|
||||||
raise RuntimeError(msg)
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
# Return a proper `datetime.datetime` object
|
# A plain `dt.datetime` instead of a `pd.Timestamp`
|
||||||
return dt.datetime(
|
return dt.datetime(
|
||||||
last_order.year,
|
last_order.year,
|
||||||
last_order.month,
|
last_order.month,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from tests.db.fake_data import factories
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def make_address(city):
|
def make_address(city):
|
||||||
"""Replaces `AddressFactory.build()`: Create an `Address` in the `city`."""
|
"""Replaces `AddressFactory.build()`: Create an `Address` in the `city`."""
|
||||||
# Reset the identifiers before every test
|
# Identifiers start at 1 in every test, independent of the test order
|
||||||
factories.AddressFactory.reset_sequence(1)
|
factories.AddressFactory.reset_sequence(1)
|
||||||
|
|
||||||
def func(**kwargs):
|
def func(**kwargs):
|
||||||
|
|
@ -25,7 +25,7 @@ def make_address(city):
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def make_courier():
|
def make_courier():
|
||||||
"""Replaces `CourierFactory.build()`: Create a `Courier`."""
|
"""Replaces `CourierFactory.build()`: Create a `Courier`."""
|
||||||
# Reset the identifiers before every test
|
# Identifiers start at 1 in every test, independent of the test order
|
||||||
factories.CourierFactory.reset_sequence(1)
|
factories.CourierFactory.reset_sequence(1)
|
||||||
|
|
||||||
def func(**kwargs):
|
def func(**kwargs):
|
||||||
|
|
@ -38,7 +38,7 @@ def make_courier():
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def make_customer():
|
def make_customer():
|
||||||
"""Replaces `CustomerFactory.build()`: Create a `Customer`."""
|
"""Replaces `CustomerFactory.build()`: Create a `Customer`."""
|
||||||
# Reset the identifiers before every test
|
# Identifiers start at 1 in every test, independent of the test order
|
||||||
factories.CustomerFactory.reset_sequence(1)
|
factories.CustomerFactory.reset_sequence(1)
|
||||||
|
|
||||||
def func(**kwargs):
|
def func(**kwargs):
|
||||||
|
|
@ -51,7 +51,7 @@ def make_customer():
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def make_restaurant(make_address):
|
def make_restaurant(make_address):
|
||||||
"""Replaces `RestaurantFactory.build()`: Create a `Restaurant`."""
|
"""Replaces `RestaurantFactory.build()`: Create a `Restaurant`."""
|
||||||
# Reset the identifiers before every test
|
# Identifiers start at 1 in every test, independent of the test order
|
||||||
factories.RestaurantFactory.reset_sequence(1)
|
factories.RestaurantFactory.reset_sequence(1)
|
||||||
|
|
||||||
def func(address=None, **kwargs):
|
def func(address=None, **kwargs):
|
||||||
|
|
@ -74,7 +74,7 @@ def make_restaurant(make_address):
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def make_order(make_address, make_courier, make_customer, make_restaurant):
|
def make_order(make_address, make_courier, make_customer, make_restaurant):
|
||||||
"""Replaces `OrderFactory.build()`: Create a `Order`."""
|
"""Replaces `OrderFactory.build()`: Create a `Order`."""
|
||||||
# Reset the identifiers before every test
|
# Identifiers start at 1 in every test, independent of the test order
|
||||||
factories.AdHocOrderFactory.reset_sequence(1)
|
factories.AdHocOrderFactory.reset_sequence(1)
|
||||||
|
|
||||||
def func(*, scheduled=False, restaurant=None, courier=None, **kwargs):
|
def func(*, scheduled=False, restaurant=None, courier=None, **kwargs):
|
||||||
|
|
@ -119,7 +119,7 @@ def make_order(make_address, make_courier, make_customer, make_restaurant):
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def make_replay_order(make_order, simulation):
|
def make_replay_order(make_order, simulation):
|
||||||
"""Replaces `ReplayedOrderFactory.build()`: Create a `ReplayedOrder`."""
|
"""Replaces `ReplayedOrderFactory.build()`: Create a `ReplayedOrder`."""
|
||||||
# Reset the identifiers before every test
|
# Identifiers start at 1 in every test, independent of the test order
|
||||||
factories.ReplayedOrderFactory.reset_sequence(1)
|
factories.ReplayedOrderFactory.reset_sequence(1)
|
||||||
|
|
||||||
def func(*, scheduled=False, order=None, **kwargs):
|
def func(*, scheduled=False, order=None, **kwargs):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue