summaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-24 16:45:09 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-24 16:45:09 -0800
commit105fb88c4b32dd7428a4aa2c7a63607256d749ae (patch)
treee02da1c40021d4f469275c369857fe68491a2a50 /python/fatcat_tools/importers
parentcc2aecf897eb80211fae5b57a07d2f98890dee78 (diff)
downloadfatcat-105fb88c4b32dd7428a4aa2c7a63607256d749ae.tar.gz
fatcat-105fb88c4b32dd7428a4aa2c7a63607256d749ae.zip
refactor _get_editgroup => get_editgroup_id
Diffstat (limited to 'python/fatcat_tools/importers')
-rw-r--r--python/fatcat_tools/importers/common.py9
-rw-r--r--python/fatcat_tools/importers/matched.py2
2 files changed, 6 insertions, 5 deletions
diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py
index 2856b88e..ebdce56f 100644
--- a/python/fatcat_tools/importers/common.py
+++ b/python/fatcat_tools/importers/common.py
@@ -126,6 +126,7 @@ class EntityImporter:
This class exposes helpers for implementations:
self.api
+ self.get_editgroup_id()
self.create_<entity>(entity) -> EntityEdit
for related entity types
self.push_entity(entity)
@@ -194,7 +195,7 @@ class EntityImporter:
self.counts['total'] += self.counts[key]
return self.counts
- def _get_editgroup(self, edits=1):
+ def get_editgroup_id(self, edits=1):
if self._edit_count >= self.edit_batch_size:
self.api.accept_editgroup(self._editgroup_id)
self._editgroup_id = None
@@ -211,17 +212,17 @@ class EntityImporter:
return self._editgroup_id
def create_container(self, entity):
- eg_id = self._get_editgroup()
+ eg_id = self.get_editgroup_id()
self.counts['inserted.container'] += 1
return self.api.create_container(entity, editgroup_id=eg_id)
def create_release(self, entity):
- eg_id = self._get_editgroup()
+ eg_id = self.get_editgroup_id()
self.counts['inserted.release'] += 1
return self.api.create_release(entity, editgroup_id=eg_id)
def create_file(self, entity):
- eg_id = self._get_editgroup()
+ eg_id = self.get_editgroup_id()
self.counts['inserted.file'] += 1
return self.api.create_file(entity, editgroup_id=eg_id)
diff --git a/python/fatcat_tools/importers/matched.py b/python/fatcat_tools/importers/matched.py
index aca2cc34..423c3ef3 100644
--- a/python/fatcat_tools/importers/matched.py
+++ b/python/fatcat_tools/importers/matched.py
@@ -126,7 +126,7 @@ class MatchedImporter(EntityImporter):
existing.size = existing.size or fe.size
existing.md5 = existing.md5 or fe.md5
existing.sha256 = existing.sha256 or fe.sha256
- self.api.update_file(existing.ident, existing, editgroup_id=self._get_editgroup())
+ self.api.update_file(existing.ident, existing, editgroup_id=self.get_editgroup_id())
self.counts['update'] += 1
return False