Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def attr_or_none(self, name):
return or_none(self, name)
def __init__(self, image, mode, **kwargs):
assert Image.isImageType(image)
assert Mode.is_mode(mode)
if DEBUG:
label = or_none(image, 'filename') \
and os.path.basename(getattr(image, 'filename')) \
or str(image)
print(f"ModeContext.__init__: configured with image: {label}")
self.initial_image = image
self.image = None
self.final_image = None
self.original_mode = Mode.of(image)
self.mode = mode