Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def decorator(klass: T, direct_call: bool = False) -> T:
steps_back = 3 if direct_call else 2
caller_filepath = get_caller_filepath(steps_back)
if caller_filepath == InjectionContainer.LOADING_FILEPATH:
InjectionContainer._register_injectable(
klass, caller_filepath, qualifier, primary, namespace, group, singleton
)
return klass