roo-oliv/injectable

Original function's signature overwrite

Opened this issue · 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.