diff --git a/src/velofy/db/addresses.py b/src/velofy/db/addresses.py index 0c16f2c..4da9292 100644 --- a/src/velofy/db/addresses.py +++ b/src/velofy/db/addresses.py @@ -1,7 +1,5 @@ """Provide the ORM's `Address` model.""" -from __future__ import annotations - import datetime as dt import functools import typing as t @@ -171,7 +169,7 @@ class Address(meta.Base): """ return self.location.y - def clear_map(self) -> Address: # pragma: no cover + def clear_map(self) -> "Address": # pragma: no cover """Shortcut to the `.city.clear_map()` method. Returns: diff --git a/src/velofy/db/addresses_addresses.py b/src/velofy/db/addresses_addresses.py index 9defe93..892ef4c 100644 --- a/src/velofy/db/addresses_addresses.py +++ b/src/velofy/db/addresses_addresses.py @@ -1,7 +1,5 @@ """Model for the `Path` relationship between two `Address` objects.""" -from __future__ import annotations - import functools import itertools import json @@ -126,7 +124,7 @@ class Path(meta.Base): cls, *addresses: db.Address, google_maps: bool = False, - ) -> list[Path]: + ) -> list["Path"]: """Calculate pair-wise paths for `Address` objects. This is the main constructor method for the class. @@ -183,7 +181,7 @@ class Path(meta.Base): return paths @classmethod - def from_order(cls, order: db.Order, *, google_maps: bool = False) -> Path: + def from_order(cls, order: "db.Order", *, google_maps: bool = False) -> "Path": """Calculate the path for an `Order` object. The path goes from the `Order.pickup_address` to the `Order.delivery_address`. diff --git a/src/velofy/db/cities.py b/src/velofy/db/cities.py index a6fc363..2c2bcb7 100644 --- a/src/velofy/db/cities.py +++ b/src/velofy/db/cities.py @@ -1,7 +1,5 @@ """Provide the ORM's `City` model.""" -from __future__ import annotations - import functools import folium @@ -120,7 +118,7 @@ class City(meta.Base): """ return self.northeast.northing - self.southwest.northing - def clear_map(self) -> City: # pragma: no cover + def clear_map(self) -> "City": # pragma: no cover """Create a new `folium.Map` object aligned with the city's viewport. The map is available via the `.map` property. Note that it is mutable diff --git a/src/velofy/db/customers.py b/src/velofy/db/customers.py index b7b146c..25bbc35 100644 --- a/src/velofy/db/customers.py +++ b/src/velofy/db/customers.py @@ -1,7 +1,5 @@ """Provide the ORM's `Customer` model.""" -from __future__ import annotations - import folium import sqlalchemy as sa from sqlalchemy import orm @@ -30,7 +28,7 @@ class Customer(meta.Base): # Relationships orders = orm.relationship("Order", back_populates="customer") - def clear_map(self) -> Customer: # pragma: no cover + def clear_map(self) -> "Customer": # pragma: no cover """Shortcut to the `...city.clear_map()` method. Returns: diff --git a/src/velofy/db/forecasts.py b/src/velofy/db/forecasts.py index 1733394..c2b24f0 100644 --- a/src/velofy/db/forecasts.py +++ b/src/velofy/db/forecasts.py @@ -1,7 +1,5 @@ """Provide the ORM's `Forecast` model.""" -from __future__ import annotations - import datetime as dt import math @@ -187,12 +185,12 @@ class Forecast(meta.Base): @classmethod def from_dataframe( cls, - pixel: db.Pixel, + pixel: "db.Pixel", time_step: int, train_horizon: int, model: str, data: pd.DataFrame, - ) -> list[db.Forecast]: + ) -> list["db.Forecast"]: """Convert results from the forecasting `*Model`s into `Forecast` objects. This is an alternative constructor method. diff --git a/src/velofy/db/grids.py b/src/velofy/db/grids.py index ec8802e..1c97748 100644 --- a/src/velofy/db/grids.py +++ b/src/velofy/db/grids.py @@ -1,7 +1,5 @@ """Provide the ORM's `Grid` model.""" -from __future__ import annotations - import typing as t import folium @@ -67,7 +65,7 @@ class Grid(meta.Base): return round((self.side_length**2) / 1_000_000, 1) @classmethod - def gridify(cls, city: db.City, side_length: int) -> db.Grid: + def gridify(cls, city: db.City, side_length: int) -> "db.Grid": """Create a fully populated `Grid` for a `city`. The `Grid` contains only `Pixel`s that have at least one @@ -122,7 +120,7 @@ class Grid(meta.Base): return grid - def clear_map(self) -> Grid: # pragma: no cover + def clear_map(self) -> "Grid": # pragma: no cover """Shortcut to the `.city.clear_map()` method. Returns: diff --git a/src/velofy/db/pixels.py b/src/velofy/db/pixels.py index 61c5ecf..9df0314 100644 --- a/src/velofy/db/pixels.py +++ b/src/velofy/db/pixels.py @@ -1,7 +1,5 @@ """Provide the ORM's `Pixel` model.""" -from __future__ import annotations - import functools import folium @@ -130,7 +128,7 @@ class Pixel(meta.Base): return location @functools.cached_property - def restaurants(self) -> list[db.Restaurant]: # pragma: no cover + def restaurants(self) -> list["db.Restaurant"]: # pragma: no cover """Obtain all `Restaurant`s in `self`.""" return ( db.session.query(db.Restaurant) @@ -142,7 +140,7 @@ class Pixel(meta.Base): .all() ) - def clear_map(self) -> Pixel: # pragma: no cover + def clear_map(self) -> "Pixel": # pragma: no cover """Shortcut to the `.city.clear_map()` method. Returns: diff --git a/src/velofy/db/replay/orders.py b/src/velofy/db/replay/orders.py index 4e32ceb..0d990b7 100644 --- a/src/velofy/db/replay/orders.py +++ b/src/velofy/db/replay/orders.py @@ -1,7 +1,5 @@ """Provide the ORM's `ReplayedOrder` model for the replay simulations.""" -from __future__ import annotations - import datetime as dt import sqlalchemy as sa @@ -409,22 +407,22 @@ class ReplayedOrder(meta.Base): # Convenience properties @property - def customer(self) -> db.Customer: + def customer(self) -> "db.Customer": """`.customer` of the actual `Order`.""" return self.actual.customer @property - def restaurant(self) -> db.Restaurant: + def restaurant(self) -> "db.Restaurant": """`.restaurant` of the actual `Order`.""" return self.actual.restaurant @property - def pickup_address(self) -> db.Address: + def pickup_address(self) -> "db.Address": """`.pickup_address` of the actual `Order`.""" return self.actual.pickup_address @property - def delivery_address(self) -> db.Address: + def delivery_address(self) -> "db.Address": """`.delivery_address` of the actual `Order`.""" return self.actual.delivery_address diff --git a/src/velofy/db/restaurants.py b/src/velofy/db/restaurants.py index 73bb101..733006d 100644 --- a/src/velofy/db/restaurants.py +++ b/src/velofy/db/restaurants.py @@ -1,7 +1,5 @@ """Provide the ORM's `Restaurant` model.""" -from __future__ import annotations - import datetime as dt import folium @@ -75,7 +73,7 @@ class Restaurant(meta.Base): """Non-literal text representation.""" return f"<{self.__class__.__name__}({self.name})>" - def clear_map(self) -> Restaurant: # pragma: no cover + def clear_map(self) -> "Restaurant": # pragma: no cover """Shortcut to the `.address.city.clear_map()` method. Returns: diff --git a/src/velofy/db/utils/locations.py b/src/velofy/db/utils/locations.py index 309f57d..e5ba650 100644 --- a/src/velofy/db/utils/locations.py +++ b/src/velofy/db/utils/locations.py @@ -1,7 +1,5 @@ """A `Location` class to unify working with coordinates.""" -from __future__ import annotations - import utm @@ -132,7 +130,7 @@ class Location: return self._normalized_northing - def relate_to(self, other: Location) -> None: + def relate_to(self, other: "Location") -> None: """Make the origin in the lower-left corner relative to `other`. The `.x` and `.y` properties are the `.easting` and `.northing` values diff --git a/src/velofy/forecasts/timify.py b/src/velofy/forecasts/timify.py index 763a9f0..43119ed 100644 --- a/src/velofy/forecasts/timify.py +++ b/src/velofy/forecasts/timify.py @@ -1,7 +1,5 @@ """Obtain and work with time series data.""" -from __future__ import annotations - import datetime as dt import typing as t @@ -566,7 +564,7 @@ class OrderHistory: pixel_id: int, predict_day: dt.date, train_horizon: int, - ) -> models.ForecastingModelABC: + ) -> "models.ForecastingModelABC": """Choose the most promising forecasting `*Model` for tactical purposes. The rules are deduced from "Table 1: Top-3 models by ..." in the article