Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_crawler(name):
crawler = manager.get(name)
if crawler is None:
abort(404)
return crawler
def get_crawler(name):
crawler = manager.get(name)
if crawler is None:
msg = 'Crawler [%s] not found.' % name
raise click.BadParameter(msg, param=crawler)
return crawler
def get_crawler(name):
return manager.get(name)
def get_stages(self):
return list({str(stage) for _, stage in manager.stages})
def from_state(cls, state, stage):
state_crawler = state.get('crawler')
crawler = manager.get(state_crawler)
if crawler is None:
raise RuntimeError("Missing crawler: [%s]" % state_crawler)
stage = crawler.get(stage)
if stage is None:
raise RuntimeError('[%r] has no stage: %s' % (crawler, stage))
return cls(crawler, stage, state)
def context():
return {
'version': settings.VERSION,
'num_crawlers': len(manager),
'state_change': state_change
}
def run_cleanup():
manager.run_cleanup()