From 0c400f377bb02c3ea6290de865650f00f1f1abbd Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Aug 2018 02:22:32 -0700 Subject: python autoaccept implementation More to review: - duplicate containers getting created in batch mode? eg, if multiple releases with same container. should push+autoaccept those anyways? --- python/fatcat/crossref_importer.py | 2 +- python/fatcat/importer_common.py | 3 --- python/fatcat/issn_importer.py | 2 +- python/fatcat/orcid_importer.py | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) (limited to 'python') diff --git a/python/fatcat/crossref_importer.py b/python/fatcat/crossref_importer.py index d3e525a4..b12851dc 100644 --- a/python/fatcat/crossref_importer.py +++ b/python/fatcat/crossref_importer.py @@ -152,4 +152,4 @@ class FatcatCrossrefImporter(FatcatImporter): re.container_id = container.ident self._issnl_id_map[ce.issnl] = container.ident release_batch.append(re) - self.api.create_release_batch(release_batch) + self.api.create_release_batch(release_batch, autoaccept=True) diff --git a/python/fatcat/importer_common.py b/python/fatcat/importer_common.py index e084d8c4..9949d847 100644 --- a/python/fatcat/importer_common.py +++ b/python/fatcat/importer_common.py @@ -43,10 +43,7 @@ class FatcatImporter: def process_batch(self, source, size=50): """Reads and processes in batches (not API-call-per-)""" for rows in grouper(source, size): - eg = self.api.create_editgroup( - fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae')) self.create_batch(rows, eg.id) - self.api.accept_editgroup(eg.id) def process_csv_source(self, source, group_size=100, delimiter=','): reader = csv.DictReader(source, delimiter=delimiter) diff --git a/python/fatcat/issn_importer.py b/python/fatcat/issn_importer.py index 181137ac..6b806b40 100644 --- a/python/fatcat/issn_importer.py +++ b/python/fatcat/issn_importer.py @@ -70,4 +70,4 @@ class FatcatIssnImporter(FatcatImporter): objects = [o for o in objects if o != None] for o in objects: o.editgroup_id = editgroup_id - self.api.create_container_batch(objects) + self.api.create_container_batch(objects, autoaccept=True) diff --git a/python/fatcat/orcid_importer.py b/python/fatcat/orcid_importer.py index e57703d5..cc12d50d 100644 --- a/python/fatcat/orcid_importer.py +++ b/python/fatcat/orcid_importer.py @@ -71,4 +71,4 @@ class FatcatOrcidImporter(FatcatImporter): objects = [o for o in objects if o != None] for o in objects: o.editgroup_id = editgroup_id - self.api.create_creator_batch(objects) + self.api.create_creator_batch(objects, autoaccept=True) -- cgit v1.2.3