How to use the idutils.is_arxiv 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 _is_arxiv(obj):
    """Return ``True`` if ``obj`` contains an arXiv identifier.

    The ``idutils`` library only handles arXiv identifiers, e.g. strings
    of the form ``arXiv:yymm.xxxxx``, but we sometimes have to deal with
    arXiv references, which might contain more information separated by
    a space. Therefore this helper wraps ``idutils`` to support this case.
    """
    arxiv_test = obj.split()
    if not arxiv_test:
        return False
    return idutils.is_arxiv(arxiv_test[0])
github inspirehep / inspire-next / inspirehep / modules / forms / validators / simple_fields.py View on Github external
def arxiv_syntax_validation(form, field):
    """Validate ArXiv ID syntax."""
    message = "The provided ArXiv ID is invalid - it should look \
                similar to 'hep-th/9711200' or '1207.7235'."

    if field.data and not is_arxiv(field.data):
        raise StopValidation(message)
github inspirehep / inspire-next / inspire / modules / deposit / validators / simple_fields.py View on Github external
def arxiv_syntax_validation(form, field):
    """Validate ArXiv ID syntax."""
    message = "The provided ArXiv ID is invalid - it should look \
                similar to 'hep-th/9711200' or '1207.7235'."

    if field.data and not is_arxiv(field.data):
        raise StopValidation(message)