aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers/datacite.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-07-23 15:31:03 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-07-23 15:31:05 -0700
commit578ce63bd17df11d3ca7cd1083feebe4b92e457c (patch)
tree306d218688171edd41a768daf65926cd20df5102 /python/fatcat_tools/importers/datacite.py
parent1b28ba68e3b25a0cded2e88b88134d8d332f8d96 (diff)
downloadfatcat-578ce63bd17df11d3ca7cd1083feebe4b92e457c.tar.gz
fatcat-578ce63bd17df11d3ca7cd1083feebe4b92e457c.zip
simple lint (flake8) fixes over python codebase
These should not have any behavior changes, though a number of exception catches are now more general, and there may be long-tail exceptions getting thrown in these statements.
Diffstat (limited to 'python/fatcat_tools/importers/datacite.py')
-rw-r--r--python/fatcat_tools/importers/datacite.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py
index ebb29feb..50d73798 100644
--- a/python/fatcat_tools/importers/datacite.py
+++ b/python/fatcat_tools/importers/datacite.py
@@ -466,7 +466,7 @@ class DataciteImporter(EntityImporter):
try:
_ = int(first_page) < int(last_page)
pages = '{}-{}'.format(first_page, last_page)
- except ValueError as err:
+ except ValueError as err: # noqa: F841
# TODO(martin): This is more debug than info.
# print('[{}] {}'.format(doi, err), file=sys.stderr)
pass
@@ -478,11 +478,11 @@ class DataciteImporter(EntityImporter):
license_slug = None
license_extra = []
- for l in attributes.get('rightsList', []):
- slug = lookup_license_slug(l.get('rightsUri'))
+ for lic in attributes.get('rightsList', []):
+ slug = lookup_license_slug(lic.get('rightsUri'))
if slug:
license_slug = slug
- license_extra.append(l)
+ license_extra.append(lic)
# Release type. Try to determine the release type from a variety of
# types supplied in datacite. The "attributes.types.resourceType" is
@@ -524,7 +524,7 @@ class DataciteImporter(EntityImporter):
value = attributes.get('language', '') or ''
try:
language = pycountry.languages.lookup(value).alpha_2
- except (LookupError, AttributeError) as err:
+ except (LookupError, AttributeError) as err: # noqa: F841
pass
# TODO(martin): Print this on debug level, only.
# print('[{}] language lookup miss for {}: {}'.format(doi, value, err), file=sys.stderr)
@@ -549,7 +549,7 @@ class DataciteImporter(EntityImporter):
if isinstance(text, list):
try:
text = "\n".join(text)
- except TypeError as err:
+ except TypeError:
continue # Bail out, if it is not a list of strings.
# Limit length.
@@ -760,7 +760,7 @@ class DataciteImporter(EntityImporter):
i = 0
for c in creators:
if not set_index:
- i = None
+ i = None
nameType = c.get('nameType', '') or ''
if nameType in ('', 'Personal'):
creator_id = None