diff options
Diffstat (limited to 'python/fatcat_tools/importers')
-rw-r--r-- | python/fatcat_tools/importers/common.py | 23 |
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. |