From 5eeb7a9d61beb8cb40fd89bd91fcd9dd820035aa Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 17 Dec 2020 16:01:04 -0800 Subject: update fuzzy helper to pass 'reason' through to import code The motivation for this change is to enable passing the 'reason' through to edit extra metadata, in cases where we merge or cluster releases. --- python/fatcat_tools/importers/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'python/fatcat_tools') diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py index 1cce5fd0..6dc2ab9e 100644 --- a/python/fatcat_tools/importers/common.py +++ b/python/fatcat_tools/importers/common.py @@ -446,13 +446,13 @@ class EntityImporter: existing.urls = [u for u in existing.urls if u.url not in redundant_urls] return existing - def match_existing_release_fuzzy(self, release: ReleaseEntity) -> Optional[Tuple[str, ReleaseEntity]]: + def match_existing_release_fuzzy(self, release: ReleaseEntity) -> Optional[Tuple[str, str, ReleaseEntity]]: """ This helper function uses fuzzycat (and elasticsearch) to look for existing release entities with similar metadata. Returns None if there was no match of any kind, or a single tuple - (status: str, existing: ReleaseEntity) if there was a match. + (status: str, reason: str, existing: ReleaseEntity) if there was a match. Status string is one of the fuzzycat.common.Status, with "strongest match" in this sorted order: @@ -491,7 +491,7 @@ class EntityImporter: elif closest[0].status == fuzzycat.common.Status.TODO: raise NotImplementedError("fuzzycat verify hit a Status.TODO") else: - return (closest[0].status.name, closest[1]) + return (closest[0].status.name, closest[0].reason.value, closest[1]) class RecordPusher: -- cgit v1.2.3