From c642052f1b7df58ef38b5f16a5f2a198d9960666 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Fri, 13 Dec 2019 16:34:03 +0100 Subject: Update EntityImporter docstring. I believe the required method is `parse_record`, not `parse`. --- python/fatcat_tools/importers/common.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'python/fatcat_tools') diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py index c0740f94..c9648173 100644 --- a/python/fatcat_tools/importers/common.py +++ b/python/fatcat_tools/importers/common.py @@ -256,7 +256,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 @@ -389,20 +389,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. -- cgit v1.2.3 From 44c0847758bd4326c168ce8b95cd3dbfdf9b5062 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Sat, 14 Dec 2019 18:18:31 +0100 Subject: complete parse_record docstring --- python/fatcat_tools/importers/common.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'python/fatcat_tools') diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py index c9648173..073725ad 100644 --- a/python/fatcat_tools/importers/common.py +++ b/python/fatcat_tools/importers/common.py @@ -320,6 +320,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 -- cgit v1.2.3