Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@logger.catch(exception)
def a():
1 / 0
@logger.catch()
def a(n):
1 / n
a(n - 1)
def b_context_manager():
with logger.catch():
c_not_decorated()
@logger.catch
def nested(i):
1 / i
def a():
with logger.catch():
1 / 0
def f(n):
with logger.catch(message=""):
if n:
f(n - 1)
n / 0
@logger.catch
def c(a, b=0):
a / b
@logger.catch()
def a(x):
f(x)
@logger.catch
def crawl(self):
"""
crawl main method
"""
for url in self.urls:
logger.info(f'fetching {url}')
html = self.fetch(url)
for proxy in self.parse(html):
logger.info(f'fetched proxy {proxy.string()} from {url}')
yield proxy
@logger.catch
def resize_images(idx, filenames, in_dir, out_dir, algo, size, extension, log_path, verbose):
logger.add(log_path, enqueue=True)
logger.info("Thread {} starts!", idx)
count_error = 0
for file_idx, filename in enumerate(filenames):
if file_idx % verbose == 0:
logger.info("Thread {} processed {}/{}", idx, file_idx, len(filenames))
in_path = os.path.join(in_dir, filename)
if len(extension) > 0:
name, _ = os.path.splitext(filename)
out_path = os.path.join(out_dir, name + "." + extension)
else:
out_path = os.path.join(out_dir, filename)