diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-11-15 16:35:41 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-11-15 16:35:41 -0800 |
commit | f47260eff9e5905e412d33126607fbe0eadcde68 (patch) | |
tree | 0a0dfb53ebe98ae1a9e4946bfce02f7a6d473c4e /python/fatcat_tools/importers/issn.py | |
parent | 1f0574bb0265fe7e06f5e327a57ce9575cb41d5d (diff) | |
download | fatcat-f47260eff9e5905e412d33126607fbe0eadcde68.tar.gz fatcat-f47260eff9e5905e412d33126607fbe0eadcde68.zip |
bunch of pylint cleanup
Diffstat (limited to 'python/fatcat_tools/importers/issn.py')
-rw-r--r-- | python/fatcat_tools/importers/issn.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/python/fatcat_tools/importers/issn.py b/python/fatcat_tools/importers/issn.py index 0b0efccb..f702dc60 100644 --- a/python/fatcat_tools/importers/issn.py +++ b/python/fatcat_tools/importers/issn.py @@ -17,6 +17,7 @@ def truthy(s): if s is None: return None s = s.lower() + if s in ('true', 't', 'yes', 'y', '1'): return True elif s in ('false', 'f', 'no', 'n', '0'): @@ -37,12 +38,12 @@ class IssnImporter(FatcatImporter): def parse_issn_row(self, row): """ row is a python dict (parsed from CSV). - returns a ContainerEntity + returns a ContainerEntity (or None if invalid or couldn't parse) """ title = or_none(row['title']) issnl = or_none(row['ISSN-L']) if title is None or issnl is None: - return + return None extra = dict( in_doaj=truthy(row['in_doaj']), in_road=truthy(row['in_road']), @@ -72,7 +73,7 @@ class IssnImporter(FatcatImporter): def create_batch(self, batch, editgroup=None): """Reads and processes in batches (not API-call-per-line)""" objects = [self.parse_issn_row(l) - for l in batch if l != None] - objects = [o for o in objects if o != None] + for l in batch if (l is not None)] + objects = [o for o in objects if (o is not None)] self.api.create_container_batch(objects, autoaccept="true", editgroup=editgroup) self.counts['insert'] += len(objects) |