You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Spurious Type failure on register_structure_hook_factory? #578
When attempting to use register_structure_hook_factory for my custom structure hook, I get a type error that the decorator expects 1 more positional argument:
The structure factory works in that it creates the correct methods and that my_converter.structure(a_dict, MyClass) - does what it's supposed to but I'm wondering if I'm missing something or if the type error is spurious.
@Tinche, thank you for the prompt response. Using the tin/fix-type-hints branch (resolved to commit dc50023) worked for me. No more mypy errors using the same code as before.
EDIT: For a quick reference, it can be installed locally using pip install git+https://github.com/python-attrs/cattrs.git@tin/fix-type-hints
Activity
ericbn commentedon Sep 4, 2024
Also getting an error with mypy. For the following code:
mypy will fail with:
Tinche commentedon Sep 5, 2024
You folks are right, the type hints need improvement here. This might be more complex than I thought.
Tinche commentedon Sep 5, 2024
Can you folks try https://github.com/python-attrs/cattrs/tree/tin/fix-type-hints and see if it helps?
ericbn commentedon Sep 5, 2024
@Tinche, thank you for the prompt response. Using the tin/fix-type-hints branch (resolved to commit dc50023) worked for me. No more mypy errors using the same code as before.
EDIT: For a quick reference, it can be installed locally using
pip install git+https://github.com/python-attrs/cattrs.git@tin/fix-type-hintsTinche commentedon Sep 9, 2024
Yeah, according to my tests this is a big improvement. I'm planning on releasing this as a minor release in a few days.
Tinche commentedon Sep 11, 2024
Fix released!