summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-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