Add ruff to the "format" session

`ruff format` adds parentheses around multi-line lambda bodies
and removes blank lines after block openers,
both of which `black` accepts.

Lines with `# type:ignore` are shortened
because `black` counts pragma comments toward the line length
and `ruff` does not.
This commit is contained in:
Alexander Hess 2026-11-28 04:43:49 +01:00
commit e451f03d0f
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
2 changed files with 123 additions and 79 deletions

View file

@ -140,13 +140,11 @@ class Customer(meta.Base):
.all()
)
if len(restaurants) == 1: # type:ignore
tooltip = (
f"{restaurants[0].name} (#{restaurants[0].id})" # type:ignore
)
restaurant = restaurants[0] # type:ignore
tooltip = f"{restaurant.name} (#{restaurant.id})"
else:
tooltip = "Restaurants " + ", ".join(
f"#{restaurant.id}" for restaurant in restaurants # type:ignore
)
ids = ", ".join(f"#{r.id}" for r in restaurants) # type:ignore
tooltip = f"Restaurants {ids}"
if order_counts:
n_orders = (

View file

@ -215,13 +215,11 @@ class Pixel(meta.Base):
.all()
)
if len(restaurants) == 1: # type:ignore
tooltip = (
f"{restaurants[0].name} (#{restaurants[0].id})" # type:ignore
)
restaurant = restaurants[0] # type:ignore
tooltip = f"{restaurant.name} (#{restaurant.id})"
else:
tooltip = "Restaurants " + ", ".join(
f"#{restaurant.id}" for restaurant in restaurants # type:ignore
)
ids = ", ".join(f"#{r.id}" for r in restaurants) # type:ignore
tooltip = f"Restaurants {ids}"
if order_counts:
# Calculate the number of orders for ALL restaurants ...