injectable icon indicating copy to clipboard operation
injectable copied to clipboard

Original function's signature overwrite

Open roo-oliv opened this issue 6 years ago • 0 comments

When a function decorated with @autowired is inspected to get it's signature the original function's signature with required kwargs should be overwritten by a signature exposing injectables as optional kwargs.

import inspect

@autowired
def foo(a: Autowired("A")):
    print(a)

inspect.signature(foo)
# <Signature (a: <injectable.autowiring.autowired_type._Autowired object at 0x7ff88eea53a0>)>

@autowired not overwriting the original signature may cause checks of uses vs signature to fail.

roo-oliv avatar Mar 06 '18 14:03 roo-oliv