aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-01-07 01:58:39 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-01-07 01:58:39 +0100
commit3b531d2f83e9fde67e3c45d751fb80b2d9c815be (patch)
tree5c707448cd62fd55949bc413fef26398b6ceaefe /python/fatcat_tools
parentd3a1382795d14ac77165fa6eb39e893b03b97215 (diff)
downloadfatcat-3b531d2f83e9fde67e3c45d751fb80b2d9c815be.tar.gz
fatcat-3b531d2f83e9fde67e3c45d751fb80b2d9c815be.zip
datacite: apply pylint suggestions
Diffstat (limited to 'python/fatcat_tools')
-rw-r--r--python/fatcat_tools/importers/datacite.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py
index 53f46bb4..d7fbd269 100644
--- a/python/fatcat_tools/importers/datacite.py
+++ b/python/fatcat_tools/importers/datacite.py
@@ -8,20 +8,22 @@ problems in content and structure. A few fields habe their own parsing
functions (parse_datacite_...), which can be tested more easily.
"""
-from .common import EntityImporter, clean
import collections
-import dateparser
import datetime
-import fatcat_openapi_client
import hashlib
import json
-import pycountry
-import langdetect
import sqlite3
import sys
-from fatcat_tools.transforms import entity_to_dict
+
+import dateparser
+import fatcat_openapi_client
+import langdetect
+import pycountry
+
from fatcat_tools.normal import clean_doi
+from fatcat_tools.transforms import entity_to_dict
+from .common import EntityImporter, clean
# Cutoff length for abstracts.
MAX_ABSTRACT_LENGTH = 2048
@@ -309,7 +311,7 @@ class DataciteImporter(EntityImporter):
for i, c in enumerate(attributes['creators']):
nameType = c.get('nameType', '') or ''
- if nameType == 'Personal' or nameType == '':
+ if nameType in ('', 'Personal'):
creator_id = None
for nid in c.get('nameIdentifiers', []):
name_scheme = nid.get('nameIdentifierScheme', '') or ''
@@ -493,7 +495,7 @@ class DataciteImporter(EntityImporter):
if first_page and last_page:
try:
- int(first_page) < int(last_page)
+ _ = int(first_page) < int(last_page)
pages = '{}-{}'.format(first_page, last_page)
except ValueError as err:
# TODO(martin): This is more debug than info.