Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
add_sciencewise_ping = _check_sciencewise_ping(abs_meta.arxiv_id_v)
response_data['formats'] = metadata.get_dissemination_formats(
abs_meta,
download_format_pref,
add_sciencewise_ping)
# Following are less critical and template must display without them
# try:
_non_critical_abs_data(abs_meta, arxiv_identifier, response_data)
# except Exception:
# logger.warning("Error getting non-critical abs page data",
# exc_info=app.debug)
except AbsNotFoundException:
if arxiv_identifier.is_old_id and arxiv_identifier.archive \
in taxonomy.ARCHIVES:
archive_name = taxonomy.ARCHIVES[arxiv_identifier.archive]['name']
raise AbsNotFound(data={'reason': 'old_id_not_found',
'arxiv_id': arxiv_id,
'archive_id': arxiv_identifier.archive,
'archive_name': archive_name})
raise AbsNotFound(data={'reason': 'not_found', 'arxiv_id': arxiv_id})
except AbsVersionNotFoundException:
raise AbsNotFound(data={'reason': 'version_not_found',
'arxiv_id': arxiv_identifier.idv,
'arxiv_id_latest': arxiv_identifier.id})
except AbsDeletedException as e:
raise AbsNotFound(data={'reason': 'deleted',
'arxiv_id_latest': arxiv_identifier.id,
'message': e})
except IdentifierIsArchiveException as e:
raise AbsNotFound(data={'reason': 'is_archive',
response_data['formats'] = metadata.get_dissemination_formats(
abs_meta,
download_format_pref,
add_sciencewise_ping)
# Following are less critical and template must display without them
# try:
_non_critical_abs_data(abs_meta, arxiv_identifier, response_data)
# except Exception:
# logger.warning("Error getting non-critical abs page data",
# exc_info=app.debug)
except AbsNotFoundException:
if arxiv_identifier.is_old_id and arxiv_identifier.archive \
in taxonomy.ARCHIVES:
archive_name = taxonomy.ARCHIVES[arxiv_identifier.archive]['name']
raise AbsNotFound(data={'reason': 'old_id_not_found',
'arxiv_id': arxiv_id,
'archive_id': arxiv_identifier.archive,
'archive_name': archive_name})
raise AbsNotFound(data={'reason': 'not_found', 'arxiv_id': arxiv_id})
except AbsVersionNotFoundException:
raise AbsNotFound(data={'reason': 'version_not_found',
'arxiv_id': arxiv_identifier.idv,
'arxiv_id_latest': arxiv_identifier.id})
except AbsDeletedException as e:
raise AbsNotFound(data={'reason': 'deleted',
'arxiv_id_latest': arxiv_identifier.id,
'message': e})
except IdentifierIsArchiveException as e:
raise AbsNotFound(data={'reason': 'is_archive',
'arxiv_id': arxiv_id,
year = thisYear
if year > thisYear:
# 307 because year might be valid in the future
return {}, status.HTTP_307_TEMPORARY_REDIRECT, {'Location': '/'}
if year < 100:
if year >= 91:
year = 1900 + year
else:
year = 2000 + year
if archive_id not in taxonomy.ARCHIVES:
raise BadRequest("Unknown archive.")
else:
archive = taxonomy.ARCHIVES[archive_id]
listing_service = get_listing_service()
month_listing = listing_service.monthly_counts(archive_id, year)
for month in month_listing['month_counts']:
month['art'] = ascii_art_month(archive_id, month) # type: ignore
month['yymm'] = f"{month['year']}-{month['month']:02}" # type: ignore
month['url'] = url_for('browse.list_articles', # type: ignore
context=archive_id,
subcontext=f"{month['year']}{month['month']:02}")
response_data: Dict[str, Any] = {
'archive_id': archive_id,
'archive': archive,
'months': month_listing['month_counts'],
'listing': month_listing,
def get_browse_context_list(self) -> List[str]:
"""Get the list of archive/category IDs to generate browse context."""
if self.arxiv_identifier.is_old_id:
if self.arxiv_identifier.archive is not None:
return [self.arxiv_identifier.archive]
else:
return []
if self.primary_category:
options = {
self.primary_category.id: True,
taxonomy.CATEGORIES[self.primary_category.id]['in_archive']: True
}
for category in self.secondary_categories:
options[category.id] = True
in_archive = taxonomy.CATEGORIES[category.id]['in_archive']
options[in_archive] = True
return sorted(options.keys())