From a24ca520d1eafae302762a7b0f6eea0b01ef186a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 3 Sep 2019 14:12:05 -0700 Subject: better importer 'total' counting --- python/fatcat_tools/importers/common.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'python/fatcat_tools/importers') diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py index db483304..595ced47 100644 --- a/python/fatcat_tools/importers/common.py +++ b/python/fatcat_tools/importers/common.py @@ -286,7 +286,7 @@ class EntityImporter: self._pmid_id_map = dict() def reset(self): - self.counts = Counter({'skip': 0, 'insert': 0, 'update': 0, 'exists': 0}) + self.counts = Counter({'total': 0, 'skip': 0, 'insert': 0, 'update': 0, 'exists': 0}) self._edit_count = 0 self._editgroup_id = None self._entity_queue = [] @@ -296,6 +296,7 @@ class EntityImporter: """ Returns nothing. """ + self.counts['total'] += 1 if (not raw_record) or (not self.want(raw_record)): self.counts['skip'] += 1 return @@ -326,9 +327,6 @@ class EntityImporter: self.counts['insert'] += len(self._entity_queue) self._entity_queue = [] - self.counts['total'] = 0 - for key in ('skip', 'insert', 'update', 'exists'): - self.counts['total'] += self.counts[key] return self.counts def get_editgroup_id(self, edits=1): -- cgit v1.2.3