Closed HacKanCuBa closed 4 years ago
There are two issues with this:
return wrapper
I believe the original code is actually correct and the autocomplete works. Perhaps the types should be updated to ones suggested here: https://github.com/tiangolo/fastapi/issues/200#issuecomment-525126712 which should work in PyCharm at least.
Damn, that's correct! Yeah, probably typing as suggested would work. I'm closing this PR :)
I still think a PR is needed to update types to similar to what was in that comment (which is the recommend way https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html#decorators). Right now all it says is that argument and return is a function, which in case of a decorator that's not saying much.
I still think a PR is needed to update types to similar to what was in that comment (which is the recommend way https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html#decorators). Right now all it says is that argument and return is a function, which in case of a decorator that's not saying much.
Agree, will fix one like that on a different PR
Rewriting the decorator using functools.wraps() allows for tab completion and correctly reflecting of attributes and signature of wrapped function.
Closes #11.