From 578ce63bd17df11d3ca7cd1083feebe4b92e457c Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 23 Jul 2020 15:31:03 -0700 Subject: 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. --- python/fatcat_tools/importers/crossref.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'python/fatcat_tools/importers/crossref.py') diff --git a/python/fatcat_tools/importers/crossref.py b/python/fatcat_tools/importers/crossref.py index 854e3d9f..71f08952 100644 --- a/python/fatcat_tools/importers/crossref.py +++ b/python/fatcat_tools/importers/crossref.py @@ -278,15 +278,15 @@ class CrossrefImporter(EntityImporter): # license slug license_slug = None license_extra = [] - for l in obj.get('license', []): - if l['content-version'] not in ('vor', 'unspecified'): + for lic in obj.get('license', []): + if lic['content-version'] not in ('vor', 'unspecified'): continue - slug = lookup_license_slug(l['URL']) + slug = lookup_license_slug(lic['URL']) if slug: license_slug = slug - if 'start' in l: - l['start'] = l['start']['date-time'] - license_extra.append(l) + if 'start' in lic: + lic['start'] = lic['start']['date-time'] + license_extra.append(lic) # references refs = [] @@ -297,7 +297,7 @@ class CrossrefImporter(EntityImporter): # NOTE: are there crossref works with year < 100? if year > 2025 or year < 100: year = None - except: + except (TypeError, ValueError): year = None ref_extra = dict() key = rm.get('key') -- cgit v1.2.3