python-attrs / python-attrs/cattrs
pyright says that type of cattrs.preconf.json.make_converter is partially unknown
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 159
- Avg merge
- 12h 21m
- Merged PRs (30d)
- 6
Description
Pyright flags the code below with "Type of "make_converter" is partially unknown".
converter = cattrs.preconf.json.make_converter()
The problem is the type of the parameter unstruct_collection_overrides: Mapping[type, (...) -> Unknown].
Poking around in the cattrs code, this error can be resolved by changing the type of unstruct_collection_overrides in Converter.Init from
unstruct_collection_overrides: Mapping[type, Callable] = {}
to
unstruct_collection_overrides: Mapping[type, UnstructureHookT] = {}
Contributor 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.
Research direction
Start by inspecting Converter.Init and the unstruct_collection_overrides annotation, then trace how cattrs.preconf.json.make_converter() uses it. Compare the annotation with UnstructureHookT and verify that the reported partially unknown type is resolved without changing the converter's behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100