Cleans up the docs, adds validation of the process count, include the test descriptions

This commit is contained in:
Trenton H
2023-09-11 17:10:09 -07:00
parent e82aaa7d85
commit 9e333bf91d
3 changed files with 73 additions and 4 deletions

View File

@@ -27,6 +27,10 @@ class _WorkResult:
def _process_and_match(work: _WorkPackage) -> _WorkResult:
"""
Does basic processing of document content, gets the basic ratio
and returns the result package
"""
# Normalize the string some, lower case, whitespace, etc
first_string = rapidfuzz.utils.default_process(work.first_doc.content)
second_string = rapidfuzz.utils.default_process(work.second_doc.content)
@@ -72,6 +76,9 @@ class Command(BaseCommand):
if opt_ratio < RATIO_MIN or opt_ratio > RATIO_MAX:
raise CommandError("The ratio must be between 0 and 100")
if options["processes"] < 1:
raise CommandError("There must be at least 1 process")
all_docs = Document.objects.all().order_by("id")
# Build work packages for processing