Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, key, impls):
self.targets = {key: ResolutionTarget(key, impls)}
self.cache = {}
self.service = key
def build_context(self, key, existing=None):
if existing is None:
return ResolutionContext(key, list(self.__getitem__(key)))
if key not in existing.targets:
existing.targets[key] = ResolutionTarget(key, list(self.__getitem__(key)))
return existing