style: apply ruff format so ci-python-app lint passes

This commit is contained in:
Adam Moussa 2026-09-21 15:06:24 -04:00
parent 8879028a95
commit 19cbddd2fc
No known key found for this signature in database
4 changed files with 19 additions and 15 deletions

View file

@ -81,11 +81,16 @@ def create_app() -> Flask:
qs = request.args.to_dict(flat=True) qs = request.args.to_dict(flat=True)
path_params = {} path_params = {}
parts = path.strip("/").split("/") parts = path.strip("/").split("/")
if len(parts) >= 3 and parts[0] == "api" and parts[1] in { if (
"menu", len(parts) >= 3
"orders", and parts[0] == "api"
"form-status", and parts[1]
}: in {
"menu",
"orders",
"form-status",
}
):
path_params["week"] = parts[2] path_params["week"] = parts[2]
event = { event = {
"requestContext": {"http": {"method": request.method, "path": path}}, "requestContext": {"http": {"method": request.method, "path": path}},

View file

@ -183,15 +183,13 @@ def main():
with open(output_file, "w") as f: with open(output_file, "w") as f:
f.write(html) f.write(html)
mode = ( mode = "cloud" if args.api_url else ("same-origin" if google_client_id else "local")
"cloud"
if args.api_url
else ("same-origin" if google_client_id else "local")
)
print(f"Generated order form ({mode} mode): {output_file}") print(f"Generated order form ({mode} mode): {output_file}")
print(f" {menu['meal_count']} meals from menu scraped {menu['scraped_at'][:10]}") print(f" {menu['meal_count']} meals from menu scraped {menu['scraped_at'][:10]}")
if mode == "local": if mode == "local":
print(" Start the server with: PYTHONPATH=src:src/shared python3 -m server.app") print(
" Start the server with: PYTHONPATH=src:src/shared python3 -m server.app"
)
elif mode == "same-origin": elif mode == "same-origin":
print(" API paths are relative /api/* on the form origin") print(" API paths are relative /api/* on the form origin")
else: else:

View file

@ -350,9 +350,7 @@ def _require_publish_key(event) -> dict | None:
return response(403, {"error": "Forbidden"}) return response(403, {"error": "Forbidden"})
headers = event.get("headers") or {} headers = event.get("headers") or {}
provided = ( provided = (
headers.get("x-meals-publish-key") headers.get("x-meals-publish-key") or headers.get("X-Meals-Publish-Key") or ""
or headers.get("X-Meals-Publish-Key")
or ""
) )
if not _keys_match(provided, expected): if not _keys_match(provided, expected):
return response(403, {"error": "Forbidden"}) return response(403, {"error": "Forbidden"})

View file

@ -40,4 +40,7 @@ def test_email_report_not_in_remaining_config():
def test_job_schedules_disabled_outside_prod(): def test_job_schedules_disabled_outside_prod():
scheduler = (TERRAFORM / "scheduler.tf").read_text() scheduler = (TERRAFORM / "scheduler.tf").read_text()
assert 'state = local.is_prod ? "ENABLED" : "DISABLED"' in scheduler assert (
'state = local.is_prod ? "ENABLED" : "DISABLED"'
in scheduler
)