def is_submission(obj, eng): """Check if a workflow contains a submission. Args: obj: a workflow object. eng: a workflow engine. Returns: bool: whether the workflow contains a submission. """ return get_method(obj.data) == 'submitter'
def test_get_method(): schema = load_schema('hep') subschema = schema['properties']['acquisition_source'] record = { 'acquisition_source': { 'method': 'oai', 'source': 'arxiv', }, } assert validate(record['acquisition_source'], subschema) is None expected = 'oai' result = get_method(record) assert expected == result
def is_arxiv_paper(obj, eng): """Check if a workflow contains a paper from arXiv. Args: obj: a workflow object. eng: a workflow engine. Returns: bool: whether the workflow contains a paper from arXiv. """ method = get_method(obj.data) source = get_source(obj.data) is_submission_with_arxiv = method == 'submitter' and 'arxiv_eprints' in obj.data is_harvested_from_arxiv = method == 'hepcrawl' and source.lower() == 'arxiv' return is_submission_with_arxiv or is_harvested_from_arxiv