wrapt
wrapt copied to clipboard
Functions with `synchronized` decorator doesn't preserved its typing signature
I'm using the amazing wrapt.synchronized decorator, but I've just realized that it breaks the typing signature of the wrapped function (using vscode).
I tested it with custom wrapt.decorator function and it works fine.
Does someone have a solution?
Example:
import wrapt
@wrapt.decorator
def pass_through(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)
@pass_through
def function(arg):
print(arg)
@wrapt.synchronized
def synced_function(arg):
print(arg)
The function signature:
The synced_function signature:
See https://github.com/GrahamDumpleton/wrapt/issues/164 and https://github.com/GrahamDumpleton/wrapt/pull/225. I still haven't got to properly understanding the types annotation mechanism in order to integrate suggested change.