cattrs icon indicating copy to clipboard operation
cattrs copied to clipboard

pyright says that type of cattrs.preconf.json.make_converter is partially unknown

Open declaresub opened this issue 1 year ago • 3 comments

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] = {}

declaresub avatar Oct 22 '24 14:10 declaresub