Format code with black, remove unused import.

This commit is contained in:
Edward Betts 2025-07-16 12:12:27 +02:00
parent 29d5145b87
commit 46091779f0

View file

@ -7,7 +7,6 @@ import inspect
import json import json
import operator import operator
import os.path import os.path
import pprint
import sys import sys
import time import time
import traceback import traceback
@ -260,7 +259,9 @@ async def weekends() -> str:
trip_list = agenda.trip.build_trip_list() trip_list = agenda.trip.build_trip_list()
busy_events = agenda.busy.get_busy_events(start, app.config, trip_list) busy_events = agenda.busy.get_busy_events(start, app.config, trip_list)
weekends = agenda.busy.weekends(start, busy_events, trip_list, app.config["PERSONAL_DATA"]) weekends = agenda.busy.weekends(
start, busy_events, trip_list, app.config["PERSONAL_DATA"]
)
return flask.render_template( return flask.render_template(
"weekends.html", "weekends.html",
items=weekends, items=weekends,
@ -614,23 +615,36 @@ def trip_debug_page(start: str) -> str:
"computed_properties": { "computed_properties": {
"title": trip.title, "title": trip.title,
"end": trip.end.isoformat() if trip.end else None, "end": trip.end.isoformat() if trip.end else None,
"countries": [{"name": c.name, "alpha_2": c.alpha_2, "flag": c.flag} for c in trip.countries], "countries": [
"locations": [{"location": loc, "country": {"name": country.name, "alpha_2": country.alpha_2}} for loc, country in trip.locations()], {"name": c.name, "alpha_2": c.alpha_2, "flag": c.flag}
for c in trip.countries
],
"locations": [
{
"location": loc,
"country": {"name": country.name, "alpha_2": country.alpha_2},
}
for loc, country in trip.locations()
],
"total_distance": trip.total_distance(), "total_distance": trip.total_distance(),
"total_co2_kg": trip.total_co2_kg(), "total_co2_kg": trip.total_co2_kg(),
"distances_by_transport_type": trip.distances_by_transport_type(), "distances_by_transport_type": trip.distances_by_transport_type(),
"co2_by_transport_type": trip.co2_by_transport_type(), "co2_by_transport_type": trip.co2_by_transport_type(),
}, },
"schengen_compliance": { "schengen_compliance": (
"total_days_used": trip.schengen_compliance.total_days_used, {
"days_remaining": trip.schengen_compliance.days_remaining, "total_days_used": trip.schengen_compliance.total_days_used,
"is_compliant": trip.schengen_compliance.is_compliant, "days_remaining": trip.schengen_compliance.days_remaining,
"current_180_day_period": [ "is_compliant": trip.schengen_compliance.is_compliant,
trip.schengen_compliance.current_180_day_period[0].isoformat(), "current_180_day_period": [
trip.schengen_compliance.current_180_day_period[1].isoformat() trip.schengen_compliance.current_180_day_period[0].isoformat(),
], trip.schengen_compliance.current_180_day_period[1].isoformat(),
"days_over_limit": trip.schengen_compliance.days_over_limit, ],
} if trip.schengen_compliance else None, "days_over_limit": trip.schengen_compliance.days_over_limit,
}
if trip.schengen_compliance
else None
),
} }
# Convert to JSON for pretty printing # Convert to JSON for pretty printing