Skip to content

Commit 51188ca

Browse files
committed
fix: review findings
1 parent 1f36f81 commit 51188ca

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ jobs:
149149
- name: Install runtime deps + mypy
150150
# Install from the pinned lock file for deterministic resolution,
151151
# then add mypy (dev-only; not in requirements-lock.txt).
152-
# Flask 3.1+ ships inline types — do not install types-Flask (conflicts).
152+
# Flask 3.1+ includes inline type hints — do not add or install types-Flask
153+
# (it will conflict with our pip installs). Preventative guidance for future
154+
# maintainers editing the steps below.
153155
run: |
154156
python -m pip install --upgrade pip
155157
python -m pip install -r requirements-lock.txt

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ __pycache__/
99
venv/
1010
.venv/
1111
env/
12-
.mypy-ci-test/
1312

1413
# Packaging
1514
*.egg-info/

api/export_api.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import zipfile
1313
from datetime import datetime
1414
from pathlib import Path
15-
from typing import Any, cast
15+
from typing import Any
1616

1717
from flask import Blueprint, Response, request
1818

@@ -45,7 +45,14 @@ def _get_export_state() -> dict[str, Any]:
4545
if os.path.isfile(state_path):
4646
try:
4747
with open(state_path, "r", encoding="utf-8") as f:
48-
return cast(dict[str, Any], json.load(f))
48+
parsed = json.load(f)
49+
if isinstance(parsed, dict):
50+
return parsed
51+
_logger.warning(
52+
"Export state in %s is not a JSON object (got %s); ignoring",
53+
state_path,
54+
type(parsed).__name__,
55+
)
4956
except (json.JSONDecodeError, ValueError, OSError) as e:
5057
_logger.warning(
5158
"Could not read export state from %s: %s",

0 commit comments

Comments
 (0)