Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@concurrent
def _reddit_url_submissions_for(url):
data = _cached_reddit_submission_search(url=_sanitize_url_for_reddit(url), aggs='created_utc', frequency='5y')
if len(data['created_utc']) == 0:
return 0
return data['created_utc'][0]['doc_count']
@concurrent
def _update_source_worker(source_info):
# worker function to help update sources in parallel
user_mc = user_admin_mediacloud_client()
media_id = source_info['media_id']
logger.debug("Updating media {}".format(media_id))
source_no_metadata_no_id = {k: v for k, v in list(source_info.items()) if k != 'media_id'
and k not in SOURCE_LIST_CSV_METADATA_PROPS}
response = user_mc.mediaUpdate(media_id, source_no_metadata_no_id)
return response
@concurrent(processes=args.proc_number)
def run_concurrent_optimize(trader: RLTrader, args):
trader.optimize(args.trials, args.trials, args.parallel_jobs)