Treat corrupt-shape state files as missing in `load_state`
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
In overturemaps/state.py, read load_state and its current exception handling. Add tests for a JSON list state file and an unknown backend value, as described in the issue. Done means both invalid shapes return None without a traceback, and the docstring describes invalid state as well as missing files.
Written by the indexing model from the issue text.
Description
Context
A state file with valid JSON but the wrong shape (e.g. a top-level list, or an unknown backend value) makes overturemaps releases check crash with an unhandled AttributeError or ValueError traceback. Missing files, invalid JSON and missing keys already fall back to "no state"; wrong-shape files should do the same.
Proposed change
In state.py:
- Extend the except clause in
load_stateto also catchAttributeError,TypeErrorandValueErrorand returnNone. - Update the docstring to say
Noneis returned for invalid state, not just missing files. - Add tests for a JSON list state file and an unknown
backendvalue.
- Dominant language
- Python
- Stars
- 280
- Forks
- 48
- Avg merge
- 4h 28m
- Merged PRs (30d)
- 16
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OvertureMaps/overturemaps-py
-
external
Difficulty 4/5 3-5 days Newbie friendliness 47/100
OvertureMaps/overturemaps-py#148 · 1 comment ·
Maintainers usually reply within 1 day
-
Include theme/type in outputMay be free again @danabauer claimed this 283 days ago, and no pull request is open. Openenhancement
OvertureMaps/overturemaps-py#24 · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
-
Allow selecting specific columnsMay be free again @danabauer claimed this 283 days ago, and no pull request is open. Openenhancement
OvertureMaps/overturemaps-py#13 · 1 assignee ·
Maintainers usually reply within 1 day
-
Use pyogrioMay be free again @danabauer claimed this 283 days ago, and no pull request is open. Openenhancement
OvertureMaps/overturemaps-py#9 · 2 comments · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
All issues in OvertureMaps/overturemaps-py
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
awslabs/visual-asset-management-system#1278 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws-samples/sample-per-model-bedrock#835 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
plasma-umass/scalene#1123 ·
Maintainers usually reply within 1 day