diff --git a/migrations/versions/rev_20200806_23_f11cd76d2f45_create_the_database.py b/migrations/versions/rev_20200806_23_f11cd76d2f45_create_the_database.py index a03e1dc..5f02843 100644 --- a/migrations/versions/rev_20200806_23_f11cd76d2f45_create_the_database.py +++ b/migrations/versions/rev_20200806_23_f11cd76d2f45_create_the_database.py @@ -107,13 +107,13 @@ def upgrade(): sa.Column('id', sa.Integer(), autoincrement=False, nullable=False), sa.Column('primary_id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('place_id', sa.Unicode(length=120), nullable=False), # noqa:WPS432 + sa.Column('place_id', sa.Unicode(length=120), nullable=False), sa.Column('latitude', postgresql.DOUBLE_PRECISION(), nullable=False), sa.Column('longitude', postgresql.DOUBLE_PRECISION(), nullable=False), sa.Column('city_id', sa.SmallInteger(), nullable=False), - sa.Column('city', sa.Unicode(length=25), nullable=False), # noqa:WPS432 + sa.Column('city', sa.Unicode(length=25), nullable=False), sa.Column('zip_code', sa.Integer(), nullable=False), - sa.Column('street', sa.Unicode(length=80), nullable=False), # noqa:WPS432 + sa.Column('street', sa.Unicode(length=80), nullable=False), sa.Column('floor', sa.SmallInteger(), nullable=True), sa.CheckConstraint( '-180 <= longitude AND longitude <= 180', @@ -192,7 +192,7 @@ def upgrade(): 'restaurants', sa.Column('id', sa.SmallInteger(), autoincrement=False, nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('name', sa.Unicode(length=45), nullable=False), # noqa:WPS432 + sa.Column('name', sa.Unicode(length=45), nullable=False), sa.Column('address_id', sa.Integer(), nullable=False), sa.Column('estimated_prep_duration', sa.SmallInteger(), nullable=False), sa.CheckConstraint( diff --git a/migrations/versions/rev_20210106_19_e40623e10405_add_demand_forecasting.py b/migrations/versions/rev_20210106_19_e40623e10405_add_demand_forecasting.py index 1579190..e624259 100644 --- a/migrations/versions/rev_20210106_19_e40623e10405_add_demand_forecasting.py +++ b/migrations/versions/rev_20210106_19_e40623e10405_add_demand_forecasting.py @@ -31,7 +31,7 @@ def upgrade(): sa.Column('start_at', sa.DateTime(), nullable=False), sa.Column('time_step', sa.SmallInteger(), nullable=False), sa.Column('training_horizon', sa.SmallInteger(), nullable=False), - sa.Column('method', sa.Unicode(length=20), nullable=False), # noqa:WPS432 + sa.Column('method', sa.Unicode(length=20), nullable=False), sa.Column('prediction', postgresql.DOUBLE_PRECISION(), nullable=False), sa.PrimaryKeyConstraint('id', name=op.f('pk_forecasts')), sa.ForeignKeyConstraint( diff --git a/setup.cfg b/setup.cfg index 8c3817b..800ade7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -105,6 +105,8 @@ extend-ignore = WPS412, # Allow multiple assignment, e.g., x = y = 123 WPS429, + # There are no magic numbers. + WPS432, per-file-ignores = # Top-levels of a sub-packages are intended to import a lot. @@ -137,8 +139,6 @@ per-file-ignores = src/urban_meal_delivery/configuration.py: # Allow upper case class variables within classes. WPS115, - # Numbers are normal in config files. - WPS432, src/urban_meal_delivery/forecasts/decomposition.py: # The module does not have a high cognitive complexity. WPS232, @@ -166,8 +166,6 @@ per-file-ignores = WPS402, # Allow closures. WPS430, - # Numbers are normal in test cases as expected results. - WPS432, # When testing, it is normal to use implementation details. WPS437, diff --git a/src/urban_meal_delivery/db/addresses.py b/src/urban_meal_delivery/db/addresses.py index d86518d..dad5b72 100644 --- a/src/urban_meal_delivery/db/addresses.py +++ b/src/urban_meal_delivery/db/addresses.py @@ -18,15 +18,13 @@ class Address(meta.Base): id = sa.Column(sa.Integer, primary_key=True, autoincrement=False) # noqa:WPS125 _primary_id = sa.Column('primary_id', sa.Integer, nullable=False, index=True) created_at = sa.Column(sa.DateTime, nullable=False) - place_id = sa.Column( - sa.Unicode(length=120), nullable=False, index=True, # noqa:WPS432 - ) + place_id = sa.Column(sa.Unicode(length=120), nullable=False, index=True) latitude = sa.Column(postgresql.DOUBLE_PRECISION, nullable=False) longitude = sa.Column(postgresql.DOUBLE_PRECISION, nullable=False) city_id = sa.Column(sa.SmallInteger, nullable=False, index=True) - city_name = sa.Column('city', sa.Unicode(length=25), nullable=False) # noqa:WPS432 + city_name = sa.Column('city', sa.Unicode(length=25), nullable=False) zip_code = sa.Column(sa.Integer, nullable=False, index=True) - street = sa.Column(sa.Unicode(length=80), nullable=False) # noqa:WPS432 + street = sa.Column(sa.Unicode(length=80), nullable=False) floor = sa.Column(sa.SmallInteger) # Constraints diff --git a/src/urban_meal_delivery/db/forecasts.py b/src/urban_meal_delivery/db/forecasts.py index 65f12b5..2edb695 100644 --- a/src/urban_meal_delivery/db/forecasts.py +++ b/src/urban_meal_delivery/db/forecasts.py @@ -21,7 +21,7 @@ class Forecast(meta.Base): start_at = sa.Column(sa.DateTime, nullable=False) time_step = sa.Column(sa.SmallInteger, nullable=False) training_horizon = sa.Column(sa.SmallInteger, nullable=False) - model = sa.Column(sa.Unicode(length=20), nullable=False) # noqa:WPS432 + model = sa.Column(sa.Unicode(length=20), nullable=False) # Raw `.prediction`s are stored as `float`s (possibly negative). # The rounding is then done on the fly if required. prediction = sa.Column(postgresql.DOUBLE_PRECISION, nullable=False) diff --git a/src/urban_meal_delivery/db/grids.py b/src/urban_meal_delivery/db/grids.py index c1d7dd2..db03215 100644 --- a/src/urban_meal_delivery/db/grids.py +++ b/src/urban_meal_delivery/db/grids.py @@ -51,7 +51,7 @@ class Grid(meta.Base): @property def pixel_area(self) -> float: """The area of a `Pixel` on the grid in square kilometers.""" - return round((self.side_length ** 2) / 1_000_000, 1) # noqa:WPS432 + return round((self.side_length ** 2) / 1_000_000, 1) @classmethod def gridify(cls, city: db.City, side_length: int) -> db.Grid: diff --git a/src/urban_meal_delivery/db/restaurants.py b/src/urban_meal_delivery/db/restaurants.py index d427540..b17cae7 100644 --- a/src/urban_meal_delivery/db/restaurants.py +++ b/src/urban_meal_delivery/db/restaurants.py @@ -21,7 +21,7 @@ class Restaurant(meta.Base): sa.SmallInteger, primary_key=True, autoincrement=False, ) created_at = sa.Column(sa.DateTime, nullable=False) - name = sa.Column(sa.Unicode(length=45), nullable=False) # noqa:WPS432 + name = sa.Column(sa.Unicode(length=45), nullable=False) address_id = sa.Column(sa.Integer, nullable=False, index=True) estimated_prep_duration = sa.Column(sa.SmallInteger, nullable=False)