Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _normalize_arxiv(obj):
"""Return a normalized arXiv identfier.
As in ``_is_arxiv``, we need to handle arXiv references as well
as arXiv identifiers. We also need to return a simpler arXiv
identifier than what ``idutils`` would output, so we use some
of its helpers instead of ``normalize_arxiv``.
"""
obj = obj.split()[0]
m = idutils.is_arxiv_pre_2007(obj)
if m:
return ''.join(m.group(2, 4, 5))
m = idutils.is_arxiv_post_2007(obj)
if m:
return '.'.join(m.group(2, 3))