Remove flake8-expression-complexity ...
... from the dev dependencies. Longer queries in SQLAlchemy get flagged even though they are not complicated. Other expressions are generally not that complicated.
This commit is contained in:
parent
1c19da2f70
commit
3bef9ca38d
12 changed files with 19 additions and 53 deletions
|
|
@ -129,7 +129,7 @@ class DistanceMatrix(meta.Base):
|
|||
)
|
||||
|
||||
# If there is no `DistanceMatrix` object in the database ...
|
||||
distance = ( # noqa:ECE001
|
||||
distance = (
|
||||
db.session.query(db.DistanceMatrix)
|
||||
.filter(db.DistanceMatrix.first_address == first)
|
||||
.filter(db.DistanceMatrix.second_address == second)
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class City(meta.Base):
|
|||
`.map` for convenience in interactive usage
|
||||
"""
|
||||
# Obtain all primary `Address`es in the city that host `Restaurant`s.
|
||||
addresses = ( # noqa:ECE001
|
||||
addresses = (
|
||||
db.session.query(db.Address)
|
||||
.filter(
|
||||
db.Address.id.in_(
|
||||
|
|
@ -146,7 +146,7 @@ class City(meta.Base):
|
|||
for address in addresses:
|
||||
# Show the restaurant's name if there is only one.
|
||||
# Otherwise, list all the restaurants' ID's.
|
||||
restaurants = ( # noqa:ECE001
|
||||
restaurants = (
|
||||
db.session.query(db.Restaurant)
|
||||
.join(db.Address, db.Restaurant.address_id == db.Address.id)
|
||||
.filter(db.Address.primary_id == address.id)
|
||||
|
|
@ -161,7 +161,7 @@ class City(meta.Base):
|
|||
|
||||
if order_counts:
|
||||
# Calculate the number of orders for ALL restaurants ...
|
||||
n_orders = ( # noqa:ECE001
|
||||
n_orders = (
|
||||
db.session.query(db.Order.id)
|
||||
.join(db.Address, db.Order.pickup_address_id == db.Address.id)
|
||||
.filter(db.Address.primary_id == address.id)
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class Customer(meta.Base):
|
|||
|
||||
# Obtain all primary `Address`es where
|
||||
# at least one delivery was made to `self`.
|
||||
delivery_addresses = ( # noqa:ECE001
|
||||
delivery_addresses = (
|
||||
db.session.query(db.Address)
|
||||
.filter(
|
||||
db.Address.id.in_(
|
||||
|
|
@ -79,7 +79,7 @@ class Customer(meta.Base):
|
|||
|
||||
for address in delivery_addresses:
|
||||
if order_counts:
|
||||
n_orders = ( # noqa:ECE001
|
||||
n_orders = (
|
||||
db.session.query(db.Order)
|
||||
.join(db.Address, db.Order.delivery_address_id == db.Address.id)
|
||||
.filter(db.Order.customer_id == self.id)
|
||||
|
|
@ -111,7 +111,7 @@ class Customer(meta.Base):
|
|||
)
|
||||
|
||||
if restaurants:
|
||||
pickup_addresses = ( # noqa:ECE001
|
||||
pickup_addresses = (
|
||||
db.session.query(db.Address)
|
||||
.filter(
|
||||
db.Address.id.in_(
|
||||
|
|
@ -129,7 +129,7 @@ class Customer(meta.Base):
|
|||
# Show the restaurant's name if there is only one.
|
||||
# Otherwise, list all the restaurants' ID's.
|
||||
# We cannot show the `Order.restaurant.name` due to the aggregation.
|
||||
restaurants = ( # noqa:ECE001
|
||||
restaurants = (
|
||||
db.session.query(db.Restaurant)
|
||||
.join(db.Address, db.Restaurant.address_id == db.Address.id)
|
||||
.filter(db.Address.primary_id == address.id) # noqa:WPS441
|
||||
|
|
@ -145,7 +145,7 @@ class Customer(meta.Base):
|
|||
)
|
||||
|
||||
if order_counts:
|
||||
n_orders = ( # noqa:ECE001
|
||||
n_orders = (
|
||||
db.session.query(db.Order)
|
||||
.join(db.Address, db.Order.pickup_address_id == db.Address.id)
|
||||
.filter(db.Order.customer_id == self.id)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class Grid(meta.Base):
|
|||
# `Pixel`s grouped by `.n_x`-`.n_y` coordinates.
|
||||
pixels = {}
|
||||
|
||||
pickup_addresses = ( # noqa:ECE:001
|
||||
pickup_addresses = (
|
||||
db.session.query(db.Address)
|
||||
.join(db.Order, db.Address.id == db.Order.pickup_address_id)
|
||||
.filter(db.Address.city == city)
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class Pixel(meta.Base):
|
|||
@functools.cached_property
|
||||
def restaurants(self) -> List[db.Restaurant]: # pragma: no cover
|
||||
"""Obtain all `Restaurant`s in `self`."""
|
||||
return ( # noqa:ECE001
|
||||
return (
|
||||
db.session.query(db.Restaurant)
|
||||
.join(
|
||||
db.AddressPixelAssociation,
|
||||
|
|
@ -175,7 +175,7 @@ class Pixel(meta.Base):
|
|||
if restaurants:
|
||||
# Obtain all primary `Address`es in the city that host `Restaurant`s
|
||||
# and are in the `self` `Pixel`.
|
||||
addresses = ( # noqa:ECE001
|
||||
addresses = (
|
||||
db.session.query(db.Address)
|
||||
.filter(
|
||||
db.Address.id.in_(
|
||||
|
|
@ -201,7 +201,7 @@ class Pixel(meta.Base):
|
|||
for address in addresses:
|
||||
# Show the restaurant's name if there is only one.
|
||||
# Otherwise, list all the restaurants' ID's.
|
||||
restaurants = ( # noqa:ECE001
|
||||
restaurants = (
|
||||
db.session.query(db.Restaurant)
|
||||
.join(db.Address, db.Restaurant.address_id == db.Address.id)
|
||||
.filter(db.Address.primary_id == address.id)
|
||||
|
|
@ -218,7 +218,7 @@ class Pixel(meta.Base):
|
|||
|
||||
if order_counts:
|
||||
# Calculate the number of orders for ALL restaurants ...
|
||||
n_orders = ( # noqa:ECE001
|
||||
n_orders = (
|
||||
db.session.query(db.Order.id)
|
||||
.join(db.Address, db.Order.pickup_address_id == db.Address.id)
|
||||
.filter(db.Address.primary_id == address.id)
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class Restaurant(meta.Base):
|
|||
if customers:
|
||||
# Obtain all primary `Address`es in the city that
|
||||
# received at least one delivery from `self`.
|
||||
delivery_addresses = ( # noqa:ECE001
|
||||
delivery_addresses = (
|
||||
db.session.query(db.Address)
|
||||
.filter(
|
||||
db.Address.id.in_(
|
||||
|
|
@ -99,7 +99,7 @@ class Restaurant(meta.Base):
|
|||
|
||||
for address in delivery_addresses:
|
||||
if order_counts:
|
||||
n_orders = ( # noqa:ECE001
|
||||
n_orders = (
|
||||
db.session.query(db.Order)
|
||||
.join(db.Address, db.Order.delivery_address_id == db.Address.id)
|
||||
.filter(db.Order.restaurant_id == self.id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue