From 0988ac6fed7f1d1ba41233bde56b455ba6cba204 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 21 May 2019 11:48:28 -0700 Subject: fix lint errors in JSTOR importer --- python/fatcat_tools/importers/jstor.py | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/python/fatcat_tools/importers/jstor.py b/python/fatcat_tools/importers/jstor.py index 4531d926..7d630b6b 100644 --- a/python/fatcat_tools/importers/jstor.py +++ b/python/fatcat_tools/importers/jstor.py @@ -49,6 +49,21 @@ class JstorImporter(EntityImporter): extra = dict() extra_jstor = dict() + release_type = "article-journal" + if "[Abstract]" in title: + # TODO: strip the "[Abstract]" bit? + release_type = "abstract" + elif "[Editorial" in title: + release_type = "editorial" + elif "[Letter" in title: + release_type = "letter" + elif "[Poem" in title or "[Photograph" in title: + release_type = None + + if title.startswith("[") and title.endswith("]"): + # strip brackets if that is all that is there (eg, translation or non-english) + title = title[1:-1] + # JSTOR journal-id journal_ids = [j.string for j in journal_meta.find_all('journal-id')] if journal_ids: @@ -76,8 +91,7 @@ class JstorImporter(EntityImporter): issnl=issnl, publisher=publisher, container_type=self.map_container_type(release_type), - name=clean(journal_title, force_xml=True), - extra=journal_extra) + name=clean(journal_title, force_xml=True)) ce_edit = self.create_container(ce) container_id = ce_edit.ident self._issnl_id_map[issnl] = container_id @@ -155,21 +169,6 @@ class JstorImporter(EntityImporter): if not language: warnings.warn("MISSING MARC LANG: {}".format(cm.find("meta-value").string)) - release_type = "article-journal" - if "[Abstract]" in title: - # TODO: strip the "[Abstract]" bit? - release_type = "abstract" - elif "[Editorial" in title: - release_type = "editorial" - elif "[Letter" in title: - release_type = "letter" - elif "[Poem" in title or "[Photograph" in title: - release_type = None - - if title.startswith("[") and title.endswith("]"): - # strip brackets if that is all that is there (eg, translation or non-english) - title = title[1:-1] - # JSTOR issue-id if article_meta.find('issue-id'): issue_id = clean(article_meta.find('issue-id').string) -- cgit v1.2.3