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:
parent
318dff8fc8
commit
e451f03d0f
3 changed files with 123 additions and 79 deletions
|
|
@ -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 = (
|
||||
|
|
|
|||
|
|
@ -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 ...
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ class HorizontalSMAModel(base.ForecastingModelABC):
|
|||
if (
|
||||
predictions[["actual", "prediction"]].isnull().any().any()
|
||||
): # pragma: no cover
|
||||
|
||||
raise RuntimeError("missing predictions in hsma model")
|
||||
if predict_at not in predictions.index: # pragma: no cover
|
||||
raise RuntimeError("missing prediction for `predict_at`")
|
||||
|
|
|
|||
Loading…
Reference in a new issue