Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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