diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-09-03 14:12:05 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-09-03 14:12:05 -0700 |
commit | a24ca520d1eafae302762a7b0f6eea0b01ef186a (patch) | |
tree | db951e5cdfa8d935031e9140a8e48fa8d49cbc22 | |
parent | 535c6a26e478746249c722b09facf985fd7d116f (diff) | |
download | fatcat-a24ca520d1eafae302762a7b0f6eea0b01ef186a.tar.gz fatcat-a24ca520d1eafae302762a7b0f6eea0b01ef186a.zip |
better importer 'total' counting
-rw-r--r-- | python/fatcat_tools/importers/common.py | 6 |
1 files changed, 2 insertions, 4 deletions
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): |