diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-01 18:35:24 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-01 18:35:24 -0700 |
commit | 30905f1effb33c3ef193d084120aa3fbd75d0b9b (patch) | |
tree | 7d460a16c6fc7099fdfd99225ba4de48adc1e820 /python/fatcat_tools/transforms | |
parent | a6e515dfe8f07410e7c71fa826995e5172b19731 (diff) | |
download | fatcat-30905f1effb33c3ef193d084120aa3fbd75d0b9b.tar.gz fatcat-30905f1effb33c3ef193d084120aa3fbd75d0b9b.zip |
lint (flake8) tool python files
Diffstat (limited to 'python/fatcat_tools/transforms')
-rw-r--r-- | python/fatcat_tools/transforms/csl.py | 14 | ||||
-rw-r--r-- | python/fatcat_tools/transforms/elasticsearch.py | 12 | ||||
-rw-r--r-- | python/fatcat_tools/transforms/entities.py | 1 | ||||
-rw-r--r-- | python/fatcat_tools/transforms/ingest.py | 1 |
4 files changed, 10 insertions, 18 deletions
diff --git a/python/fatcat_tools/transforms/csl.py b/python/fatcat_tools/transforms/csl.py index 832ad6aa..ba199efb 100644 --- a/python/fatcat_tools/transforms/csl.py +++ b/python/fatcat_tools/transforms/csl.py @@ -1,6 +1,5 @@ import json -import collections from citeproc import CitationStylesStyle, CitationStylesBibliography from citeproc import Citation, CitationItem @@ -8,8 +7,6 @@ from citeproc import formatter from citeproc.source.json import CiteProcJSON from citeproc_styles import get_style_filepath -from fatcat_openapi_client import ApiClient - def contribs_by_role(contribs, role): ret = [c.copy() for c in contribs if c['role'] == role] @@ -214,14 +211,13 @@ def citeproc_csl(csl_json, style, html=False): lines = bib.bibliography()[0] if style == "bibtex": out = "" - for l in lines: - if l.startswith(" @"): + for line in lines: + if line.startswith(" @"): out += "@" - elif l.startswith(" "): - out += "\n " + l + elif line.startswith(" "): + out += "\n " + line else: - out += l + out += line return ''.join(out) else: return ''.join(lines) - diff --git a/python/fatcat_tools/transforms/elasticsearch.py b/python/fatcat_tools/transforms/elasticsearch.py index 1d35141b..8ec9c164 100644 --- a/python/fatcat_tools/transforms/elasticsearch.py +++ b/python/fatcat_tools/transforms/elasticsearch.py @@ -1,7 +1,5 @@ -import collections import tldextract -from fatcat_openapi_client import ApiClient def check_kbart(year, archive): @@ -14,11 +12,11 @@ def check_kbart(year, archive): def test_check_kbart(): - assert check_kbart(1990, dict()) == None - assert check_kbart(1990, dict(year_spans=[[2000, 2000]])) == False - assert check_kbart(2000, dict(year_spans=[[2000, 2000]])) == True - assert check_kbart(1950, dict(year_spans=[[1900, 1920], [1990, 2000]])) == False - assert check_kbart(1950, dict(year_spans=[[1900, 1920], [1930, 2000]])) == True + assert check_kbart(1990, dict()) is None + assert check_kbart(1990, dict(year_spans=[[2000, 2000]])) is False + assert check_kbart(2000, dict(year_spans=[[2000, 2000]])) is True + assert check_kbart(1950, dict(year_spans=[[1900, 1920], [1990, 2000]])) is False + assert check_kbart(1950, dict(year_spans=[[1900, 1920], [1930, 2000]])) is True def release_to_elasticsearch(entity, force_bool=True): diff --git a/python/fatcat_tools/transforms/entities.py b/python/fatcat_tools/transforms/entities.py index ae666413..53455e85 100644 --- a/python/fatcat_tools/transforms/entities.py +++ b/python/fatcat_tools/transforms/entities.py @@ -32,4 +32,3 @@ def entity_from_json(json_str, entity_type, api_client=None): def entity_from_dict(obj, entity_type, api_client=None): json_str = json.dumps(obj) return entity_from_json(json_str, entity_type, api_client=api_client) - diff --git a/python/fatcat_tools/transforms/ingest.py b/python/fatcat_tools/transforms/ingest.py index 22b5154e..2f4e2271 100644 --- a/python/fatcat_tools/transforms/ingest.py +++ b/python/fatcat_tools/transforms/ingest.py @@ -61,4 +61,3 @@ def release_ingest_request(release, ingest_request_source='fatcat', ingest_type= ingest_request['link_source_id'] = link_source_id return ingest_request - |