diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-12-17 16:01:04 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-12-17 16:01:06 -0800 |
commit | 5eeb7a9d61beb8cb40fd89bd91fcd9dd820035aa (patch) | |
tree | 1532f36e1284210c13584e9a4e57dfed61b3142c /python/fatcat_tools | |
parent | d5c8b54aaf600764bc59855c4529952195c87fb5 (diff) | |
download | fatcat-5eeb7a9d61beb8cb40fd89bd91fcd9dd820035aa.tar.gz fatcat-5eeb7a9d61beb8cb40fd89bd91fcd9dd820035aa.zip |
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.
Diffstat (limited to 'python/fatcat_tools')
-rw-r--r-- | python/fatcat_tools/importers/common.py | 6 |
1 files changed, 3 insertions, 3 deletions
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: |