aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers
diff options
context:
space:
mode:
authorMartin Czygan <martin@archive.org>2019-12-14 17:49:18 +0000
committerMartin Czygan <martin@archive.org>2019-12-14 17:49:18 +0000
commit47eaf6ae5b46e809bd2dc9a204bfa0db8f73dc17 (patch)
treefe16df5d7f3949ac614d172c8d1b51dbf0b05f79 /python/fatcat_tools/importers
parent037a77d507dc32feb7ac2efd8a27cc2c36761bc2 (diff)
parent44c0847758bd4326c168ce8b95cd3dbfdf9b5062 (diff)
downloadfatcat-47eaf6ae5b46e809bd2dc9a204bfa0db8f73dc17.tar.gz
fatcat-47eaf6ae5b46e809bd2dc9a204bfa0db8f73dc17.zip
Merge branch 'martin-importers-common-doc-fix' into 'master'
Update EntityImporter docstring. See merge request webgroup/fatcat!9
Diffstat (limited to 'python/fatcat_tools/importers')
-rw-r--r--python/fatcat_tools/importers/common.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py
index 5683ed73..d51a5ff4 100644
--- a/python/fatcat_tools/importers/common.py
+++ b/python/fatcat_tools/importers/common.py
@@ -257,7 +257,7 @@ class EntityImporter:
The API that implementations are expected to fill in are:
want(raw_record) -> boolean
- parse(raw_record) -> entity
+ parse_record(raw_record) -> entity
try_update(entity) -> boolean
insert_batch([entity]) -> None
@@ -327,6 +327,12 @@ class EntityImporter:
return
def parse_record(self, raw_record):
+ """
+ Returns an entity class type, or None if we should skip this one.
+
+ May have side-effects (eg, create related entities), but shouldn't
+ update/mutate the actual entity.
+ """
# implementations should fill this in
raise NotImplementedError
@@ -411,20 +417,11 @@ class EntityImporter:
"""
return True
- def parse(self, raw_record):
- """
- Returns an entity class type, or None if we should skip this one.
-
- May have side-effects (eg, create related entities), but shouldn't
- update/mutate the actual entity.
- """
- raise NotImplementedError
-
def try_update(self, raw_record):
"""
- Passed the output of parse(). Should try to find an existing entity and
- update it (PUT), decide we should do nothing (based on the existing
- record), or create a new one.
+ Passed the output of parse_record(). Should try to find an existing
+ entity and update it (PUT), decide we should do nothing (based on the
+ existing record), or create a new one.
Implementations must update the exists/updated/skip counts
appropriately in this method.