Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def close(self):
""" Free the memory for storing image data. """
api.close_image(self.img)
# Disable all public methods
def closed_warning():
raise RuntimeError('Do not operate on the closed image.')
for attr in dir(self):
if not attr.startswith('_') and callable(getattr(self, attr)):
setattr(self, attr, closed_warning)