Skip to content

Commit 456c749

Browse files
authored
Converter parameter type hints (#594)
* Change type of unstruct_collection_overrides from Mapping[type, Callable] to Mapping[type, UnstructureHookT] in Converter.__init__. With this change, pyright no longer complains that the type of make_converter is partially unknown. * In Converter.__init__, change type of unstruct_collection_overrides to Mapping[type, UnstructureHook]. * Add item describing PR594.
1 parent 7235f7b commit 456c749

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

HISTORY.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Our backwards-compatibility policy can be found [here](https://github.com/python
2222
- Python 3.13 is now supported.
2323
([#543](https://github.com/python-attrs/cattrs/pull/543) [#547](https://github.com/python-attrs/cattrs/issues/547))
2424
- Python 3.8 is no longer supported, as it is end-of-life. Use previous versions on this Python version.
25+
- Change type of Converter.__init__.unstruct_collection_overrides from Callable to Mapping[type, UnstructureHook] ([#594](https://github.com/python-attrs/cattrs/pull/594).
2526

2627
## 24.1.2 (2024-09-22)
2728

src/cattrs/converters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ def __init__(
10461046
omit_if_default: bool = False,
10471047
forbid_extra_keys: bool = False,
10481048
type_overrides: Mapping[type, AttributeOverride] = {},
1049-
unstruct_collection_overrides: Mapping[type, Callable] = {},
1049+
unstruct_collection_overrides: Mapping[type, UnstructureHook] = {},
10501050
prefer_attrib_converters: bool = False,
10511051
detailed_validation: bool = True,
10521052
unstructure_fallback_factory: HookFactory[UnstructureHook] = lambda _: identity,

0 commit comments

Comments
 (0)