python-decopatch
python-decopatch copied to clipboard
Add type hints, to account for different call variants
I'm using pytest-cases, and using @fixture without parenthesis, and it produces errors in pyright.
@fixture
def some_fixture():
...
Argument of type "() -> str" cannot be assigned to parameter "scope" of type "str" in function "fixture"
There is @overload in typing to handle such cases
https://mypy.readthedocs.io/en/stable/generics.html#decorator-factories
Are you interested in adding support for type hinting?
Progress:
- [x] #23
- [x] #27
- [x] #30
- [ ] Typing for
class_decoratoranddecorator
Thanks @last-partizan ! Sure, that would be a good addition ! Would you like to have a try ?
Yes, i'll try to do it!
https://github.com/smarie/python-decopatch/pull/23
Please, take a look :)