Add flake8-sfs
This commit is contained in:
parent
650765a9d3
commit
cb8f919b1f
13 changed files with 44 additions and 60 deletions
|
|
@ -16,11 +16,9 @@ import warnings
|
|||
|
||||
def random_schema_name() -> str:
|
||||
"""Generate a random PostgreSQL schema name for testing."""
|
||||
return "temp_{name}".format(
|
||||
name="".join(
|
||||
(random.choice(string.ascii_lowercase) for _ in range(10)), # noqa:S311
|
||||
),
|
||||
)
|
||||
letters = (random.choice(string.ascii_lowercase) for _ in range(10)) # noqa:S311
|
||||
name = "".join(letters)
|
||||
return f"temp_{name}"
|
||||
|
||||
|
||||
class Config:
|
||||
|
|
|
|||
|
|
@ -82,11 +82,7 @@ class Address(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}({street} in {city})>".format(
|
||||
cls=self.__class__.__name__,
|
||||
street=self.street,
|
||||
city=self.city_name,
|
||||
)
|
||||
return f"<{self.__class__.__name__}({self.street} in {self.city_name})>"
|
||||
|
||||
@hybrid.hybrid_property
|
||||
def is_primary(self) -> bool:
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class City(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}({name})>".format(cls=self.__class__.__name__, name=self.name)
|
||||
return f"<{self.__class__.__name__}({self.name})>"
|
||||
|
||||
@functools.cached_property
|
||||
def center(self) -> utils.Location:
|
||||
|
|
|
|||
|
|
@ -47,7 +47,4 @@ class Courier(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}(#{courier_id})>".format(
|
||||
cls=self.__class__.__name__,
|
||||
courier_id=self.id,
|
||||
)
|
||||
return f"<{self.__class__.__name__}(#{self.id})>"
|
||||
|
|
|
|||
|
|
@ -21,10 +21,7 @@ class Customer(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}(#{customer_id})>".format(
|
||||
cls=self.__class__.__name__,
|
||||
customer_id=self.id,
|
||||
)
|
||||
return f"<{self.__class__.__name__}(#{self.id})>"
|
||||
|
||||
# Relationships
|
||||
orders = orm.relationship("Order", back_populates="customer")
|
||||
|
|
|
|||
|
|
@ -142,13 +142,9 @@ class Forecast(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}: {prediction} for pixel ({n_x}|{n_y}) at {start_at}>".format(
|
||||
cls=self.__class__.__name__,
|
||||
prediction=self.prediction,
|
||||
n_x=self.pixel.n_x,
|
||||
n_y=self.pixel.n_y,
|
||||
start_at=self.start_at,
|
||||
)
|
||||
cls = self.__class__.__name__
|
||||
pixel = f"({self.pixel.n_x}|{self.pixel.n_y})"
|
||||
return f"<{cls}: {self.prediction} for pixel {pixel} at {self.start_at}>"
|
||||
|
||||
@classmethod
|
||||
def from_dataframe(
|
||||
|
|
|
|||
|
|
@ -51,10 +51,7 @@ class Grid(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}: {area} sqr. km>".format(
|
||||
cls=self.__class__.__name__,
|
||||
area=self.pixel_area,
|
||||
)
|
||||
return f"<{self.__class__.__name__}: {self.pixel_area} sqr. km>"
|
||||
|
||||
# Convenience properties
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ class Order(meta.Base):
|
|||
*(
|
||||
sa.CheckConstraint(
|
||||
constraint,
|
||||
name="ordered_timestamps_{index}".format(index=index),
|
||||
name=f"ordered_timestamps_{index}",
|
||||
)
|
||||
for index, constraint in enumerate(
|
||||
(
|
||||
|
|
@ -550,10 +550,7 @@ class Order(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}(#{order_id})>".format(
|
||||
cls=self.__class__.__name__,
|
||||
order_id=self.id,
|
||||
)
|
||||
return f"<{self.__class__.__name__}(#{self.id})>"
|
||||
|
||||
def draw(self) -> folium.Map: # pragma: no cover
|
||||
"""Draw the `.waypoints` from `.pickup_address` to `.delivery_address`.
|
||||
|
|
|
|||
|
|
@ -56,11 +56,7 @@ class Pixel(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}: ({x}|{y})>".format(
|
||||
cls=self.__class__.__name__,
|
||||
x=self.n_x,
|
||||
y=self.n_y,
|
||||
)
|
||||
return f"<{self.__class__.__name__}: ({self.n_x}|{self.n_y})>"
|
||||
|
||||
# Convenience properties
|
||||
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ class ReplayedOrder(meta.Base):
|
|||
# and the non-simulated columns removed.
|
||||
sa.CheckConstraint(
|
||||
constraint,
|
||||
name="ordered_timestamps_{index}".format(index=index),
|
||||
name=f"ordered_timestamps_{index}",
|
||||
)
|
||||
for index, constraint in enumerate(
|
||||
(
|
||||
|
|
@ -338,10 +338,7 @@ class ReplayedOrder(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}(#{order_id})>".format(
|
||||
cls=self.__class__.__name__,
|
||||
order_id=self.actual.id,
|
||||
)
|
||||
return f"<{self.__class__.__name__}(#{self.actual.id})>"
|
||||
|
||||
# Convenience properties
|
||||
|
||||
|
|
|
|||
|
|
@ -40,9 +40,5 @@ class ReplaySimulation(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}({strategy} #{run} in {city})>".format(
|
||||
cls=self.__class__.__name__,
|
||||
strategy=self.strategy,
|
||||
run=self.run,
|
||||
city=self.city.name,
|
||||
)
|
||||
cls = self.__class__.__name__
|
||||
return f"<{cls}({self.strategy} #{self.run} in {self.city.name})>"
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Restaurant(meta.Base):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
"""Non-literal text representation."""
|
||||
return "<{cls}({name})>".format(cls=self.__class__.__name__, name=self.name)
|
||||
return f"<{self.__class__.__name__}({self.name})>"
|
||||
|
||||
def clear_map(self) -> Restaurant: # pragma: no cover
|
||||
"""Shortcut to the `.address.city.clear_map()` method.
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ def stl( # noqa:C901
|
|||
if nt % 2 == 0 or nt < default_nt:
|
||||
raise ValueError(
|
||||
"`nt` must be odd and `>= (1.5 * frequency) / [1 - (1.5 / ns)]`, "
|
||||
+ "which is {0}".format(default_nt),
|
||||
+ f"which is {default_nt}",
|
||||
)
|
||||
else:
|
||||
nt = default_nt
|
||||
|
|
|
|||
Loading…
Reference in a new issue