Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
singleton = 1
class Registration(NamedTuple):
service: str
scope: Scope
builder: Callable[[], Any]
needs: Any
args: List[Any]
class Empty:
pass
empty = Empty()
class Registry:
def __init__(self):
self.__registrations = defaultdict(list)
self._localns = dict()
def _get_needs_for_ctor(self, cls):
try:
return get_type_hints(cls.__init__, None, self._localns)
except NameError as e:
raise InvalidForwardReferenceException(str(e))
def register_service_and_impl(self, service, scope, impl, resolve_args):
"""Registers a concrete implementation of an abstract service.