Adjust flake8 to not consider constants magic
This commit is contained in:
parent
a1da1e9af8
commit
de3e489b39
7 changed files with 13 additions and 17 deletions
|
@ -107,13 +107,13 @@ def upgrade():
|
||||||
sa.Column('id', sa.Integer(), autoincrement=False, nullable=False),
|
sa.Column('id', sa.Integer(), autoincrement=False, nullable=False),
|
||||||
sa.Column('primary_id', sa.Integer(), nullable=False),
|
sa.Column('primary_id', sa.Integer(), nullable=False),
|
||||||
sa.Column('created_at', sa.DateTime(), 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('latitude', postgresql.DOUBLE_PRECISION(), nullable=False),
|
||||||
sa.Column('longitude', postgresql.DOUBLE_PRECISION(), nullable=False),
|
sa.Column('longitude', postgresql.DOUBLE_PRECISION(), nullable=False),
|
||||||
sa.Column('city_id', sa.SmallInteger(), 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('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.Column('floor', sa.SmallInteger(), nullable=True),
|
||||||
sa.CheckConstraint(
|
sa.CheckConstraint(
|
||||||
'-180 <= longitude AND longitude <= 180',
|
'-180 <= longitude AND longitude <= 180',
|
||||||
|
@ -192,7 +192,7 @@ def upgrade():
|
||||||
'restaurants',
|
'restaurants',
|
||||||
sa.Column('id', sa.SmallInteger(), autoincrement=False, nullable=False),
|
sa.Column('id', sa.SmallInteger(), autoincrement=False, nullable=False),
|
||||||
sa.Column('created_at', sa.DateTime(), 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('address_id', sa.Integer(), nullable=False),
|
||||||
sa.Column('estimated_prep_duration', sa.SmallInteger(), nullable=False),
|
sa.Column('estimated_prep_duration', sa.SmallInteger(), nullable=False),
|
||||||
sa.CheckConstraint(
|
sa.CheckConstraint(
|
||||||
|
|
|
@ -31,7 +31,7 @@ def upgrade():
|
||||||
sa.Column('start_at', sa.DateTime(), nullable=False),
|
sa.Column('start_at', sa.DateTime(), nullable=False),
|
||||||
sa.Column('time_step', sa.SmallInteger(), nullable=False),
|
sa.Column('time_step', sa.SmallInteger(), nullable=False),
|
||||||
sa.Column('training_horizon', 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.Column('prediction', postgresql.DOUBLE_PRECISION(), nullable=False),
|
||||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_forecasts')),
|
sa.PrimaryKeyConstraint('id', name=op.f('pk_forecasts')),
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
|
|
|
@ -105,6 +105,8 @@ extend-ignore =
|
||||||
WPS412,
|
WPS412,
|
||||||
# Allow multiple assignment, e.g., x = y = 123
|
# Allow multiple assignment, e.g., x = y = 123
|
||||||
WPS429,
|
WPS429,
|
||||||
|
# There are no magic numbers.
|
||||||
|
WPS432,
|
||||||
|
|
||||||
per-file-ignores =
|
per-file-ignores =
|
||||||
# Top-levels of a sub-packages are intended to import a lot.
|
# 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:
|
src/urban_meal_delivery/configuration.py:
|
||||||
# Allow upper case class variables within classes.
|
# Allow upper case class variables within classes.
|
||||||
WPS115,
|
WPS115,
|
||||||
# Numbers are normal in config files.
|
|
||||||
WPS432,
|
|
||||||
src/urban_meal_delivery/forecasts/decomposition.py:
|
src/urban_meal_delivery/forecasts/decomposition.py:
|
||||||
# The module does not have a high cognitive complexity.
|
# The module does not have a high cognitive complexity.
|
||||||
WPS232,
|
WPS232,
|
||||||
|
@ -166,8 +166,6 @@ per-file-ignores =
|
||||||
WPS402,
|
WPS402,
|
||||||
# Allow closures.
|
# Allow closures.
|
||||||
WPS430,
|
WPS430,
|
||||||
# Numbers are normal in test cases as expected results.
|
|
||||||
WPS432,
|
|
||||||
# When testing, it is normal to use implementation details.
|
# When testing, it is normal to use implementation details.
|
||||||
WPS437,
|
WPS437,
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,13 @@ class Address(meta.Base):
|
||||||
id = sa.Column(sa.Integer, primary_key=True, autoincrement=False) # noqa:WPS125
|
id = sa.Column(sa.Integer, primary_key=True, autoincrement=False) # noqa:WPS125
|
||||||
_primary_id = sa.Column('primary_id', sa.Integer, nullable=False, index=True)
|
_primary_id = sa.Column('primary_id', sa.Integer, nullable=False, index=True)
|
||||||
created_at = sa.Column(sa.DateTime, nullable=False)
|
created_at = sa.Column(sa.DateTime, nullable=False)
|
||||||
place_id = sa.Column(
|
place_id = sa.Column(sa.Unicode(length=120), nullable=False, index=True)
|
||||||
sa.Unicode(length=120), nullable=False, index=True, # noqa:WPS432
|
|
||||||
)
|
|
||||||
latitude = sa.Column(postgresql.DOUBLE_PRECISION, nullable=False)
|
latitude = sa.Column(postgresql.DOUBLE_PRECISION, nullable=False)
|
||||||
longitude = 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_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)
|
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)
|
floor = sa.Column(sa.SmallInteger)
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Forecast(meta.Base):
|
||||||
start_at = sa.Column(sa.DateTime, nullable=False)
|
start_at = sa.Column(sa.DateTime, nullable=False)
|
||||||
time_step = sa.Column(sa.SmallInteger, nullable=False)
|
time_step = sa.Column(sa.SmallInteger, nullable=False)
|
||||||
training_horizon = 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).
|
# Raw `.prediction`s are stored as `float`s (possibly negative).
|
||||||
# The rounding is then done on the fly if required.
|
# The rounding is then done on the fly if required.
|
||||||
prediction = sa.Column(postgresql.DOUBLE_PRECISION, nullable=False)
|
prediction = sa.Column(postgresql.DOUBLE_PRECISION, nullable=False)
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Grid(meta.Base):
|
||||||
@property
|
@property
|
||||||
def pixel_area(self) -> float:
|
def pixel_area(self) -> float:
|
||||||
"""The area of a `Pixel` on the grid in square kilometers."""
|
"""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
|
@classmethod
|
||||||
def gridify(cls, city: db.City, side_length: int) -> db.Grid:
|
def gridify(cls, city: db.City, side_length: int) -> db.Grid:
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Restaurant(meta.Base):
|
||||||
sa.SmallInteger, primary_key=True, autoincrement=False,
|
sa.SmallInteger, primary_key=True, autoincrement=False,
|
||||||
)
|
)
|
||||||
created_at = sa.Column(sa.DateTime, nullable=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)
|
address_id = sa.Column(sa.Integer, nullable=False, index=True)
|
||||||
estimated_prep_duration = sa.Column(sa.SmallInteger, nullable=False)
|
estimated_prep_duration = sa.Column(sa.SmallInteger, nullable=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue