Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_log_level(level=2):
"""
Set the level of handling logs. There are five levels of handling logs:
0 : debug
1 : info
2 : warn
3 : error
4 : mute
"""
if level in [0, 1, 2, 3, 4]:
api.set_log_level(level)
else:
raise ValueError('Invalid log level.')
api.init()
set_log_level(2)
def __init__(self, filename, encoding='utf-8'):
""" Open an image and load its metadata. """
self.img = api.open_image(filename.encode(encoding))