Context
PR #149 added `| None` to Figshare API return types but kept the
overly narrow `dict[str, int]` value type. The type-design-analyzer
and code-reviewer both flagged this.
Problem / Current Behaviour
Figshare API responses contain strings, lists, nested dicts, booleans,
and integers. The current `dict[str, int]` annotation is misleading
and causes downstream type issues (e.g., `list_article_versions`
needs `# type: ignore[return-value]`).
Additionally, `ParameterManager.get_parameter_set_details` can return
`None` but some callers (e.g., `download_files`) don't guard against
it.
Affected locations
| File |
Symbol |
Notes |
| `src/Hapi/parameters/parameters.py:59` |
`send_request` |
Returns `dict[str, int] | None` |
| `src/Hapi/parameters/parameters.py:92` |
`get_article_version` |
Same |
| `src/Hapi/parameters/parameters.py:116` |
`list_article_versions` |
Returns `list[dict]` |
| `src/Hapi/parameters/parameters.py:297` |
`get_parameter_set_details` |
Returns `dict | None` |
| `src/Hapi/parameters/parameters.py:351` |
`download_files` |
Calls details without None guard |
Proposed Solution
- Change return types to `dict[str, Any] | None`
- Add None guards in `download_files` and other callers
- Remove `# type: ignore[return-value]` from `list_article_versions`
Effort Estimate
Size: `S`
Definition of Done
Context
PR #149 added `| None` to Figshare API return types but kept the
overly narrow `dict[str, int]` value type. The type-design-analyzer
and code-reviewer both flagged this.
Problem / Current Behaviour
Figshare API responses contain strings, lists, nested dicts, booleans,
and integers. The current `dict[str, int]` annotation is misleading
and causes downstream type issues (e.g., `list_article_versions`
needs `# type: ignore[return-value]`).
Additionally, `ParameterManager.get_parameter_set_details` can return
`None` but some callers (e.g., `download_files`) don't guard against
it.
Affected locations
Proposed Solution
Effort Estimate
Size: `S`
Definition of Done