How to use the idutils.is_arxiv_pre_2007 function in idutils

To help you get started, we’ve selected a few idutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inspirehep / inspire-next / inspirehep / modules / references / processors.py View on Github external
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))