Chore: add pre-commit hook for codespell (#5324)

This commit is contained in:
shamoon
2024-01-08 13:03:05 -08:00
committed by GitHub
parent 58bf9c552b
commit f525ac0af6
33 changed files with 60 additions and 53 deletions

View File

@@ -204,10 +204,10 @@ class DocumentClassifier:
) and self.last_auto_type_hash == hasher.digest():
return False
# substract 1 since -1 (null) is also part of the classes.
# subtract 1 since -1 (null) is also part of the classes.
# union with {-1} accounts for cases where all documents have
# correspondents and types assigned, so -1 isnt part of labels_x, which
# correspondents and types assigned, so -1 isn't part of labels_x, which
# it usually is.
num_correspondents = len(set(labels_correspondent) | {-1}) - 1
num_document_types = len(set(labels_document_type) | {-1}) - 1

View File

@@ -33,7 +33,7 @@ from documents.utils import copy_file_with_basic_stats
# - XX MON ZZZZ with XX being 1 or 2 and ZZZZ being 4 digits. MONTH is 3 letters
# - XXPP MONTH ZZZZ with XX being 1 or 2 and PP being 2 letters and ZZZZ being 4 digits
# TODO: isnt there a date parsing library for this?
# TODO: isn't there a date parsing library for this?
DATE_REGEX = re.compile(
r"(\b|(?!=([_-])))([0-9]{1,2})[\.\/-]([0-9]{1,2})[\.\/-]([0-9]{4}|[0-9]{2})(\b|(?=([_-])))|"
@@ -113,8 +113,6 @@ def get_parser_class_for_mime_type(mime_type: str) -> Optional[type["DocumentPar
options = []
# Sein letzter Befehl war: KOMMT! Und sie kamen. Alle. Sogar die Parser.
for response in document_consumer_declaration.send(None):
parser_declaration = response[1]
supported_mime_types = parser_declaration["mime_types"]

View File

@@ -414,7 +414,7 @@ class TestClassifier(DirectoriesMixin, TestCase):
)
doc2 = Document.objects.create(
title="doc2",
content="this is a document from noone",
content="this is a document from no one",
checksum="B",
)

View File

@@ -665,7 +665,7 @@ class TestConsumer(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
@override_settings(FILENAME_FORMAT="{correspondent}/{title}")
@mock.patch("documents.signals.handlers.generate_unique_filename")
def testFilenameHandlingUnstableFormat(self, m):
filenames = ["this", "that", "now this", "i cant decide"]
filenames = ["this", "that", "now this", "i cannot decide"]
def get_filename():
f = filenames.pop()

View File

@@ -223,7 +223,7 @@ class TestMail(
attachments: Union[int, list[_AttachmentDef]] = 1,
body: str = "",
subject: str = "the subject",
from_: str = "noone@mail.com",
from_: str = "no_one@mail.com",
to: Optional[list[str]] = None,
seen: bool = False,
flagged: bool = False,