Run new ruff format

This commit is contained in:
shamoon 2025-01-20 19:23:14 -08:00
parent f850743137
commit 9d8dcadaf8
9 changed files with 22 additions and 26 deletions

View File

@ -3,7 +3,7 @@ import os
# See https://docs.gunicorn.org/en/stable/settings.html for
# explanations of settings
bind = f'{os.getenv("PAPERLESS_BIND_ADDR", "[::]")}:{os.getenv("PAPERLESS_PORT", 8000)}'
bind = f"{os.getenv('PAPERLESS_BIND_ADDR', '[::]')}:{os.getenv('PAPERLESS_PORT', 8000)}"
workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 1))
worker_class = "paperless.workers.ConfigurableWorker"

View File

@ -32,8 +32,7 @@ def changed_password_check(app_configs, **kwargs):
if not settings.PASSPHRASE:
return [
Error(
"The database contains encrypted documents but no password "
"is set.",
"The database contains encrypted documents but no password is set.",
),
]

View File

@ -315,8 +315,7 @@ class DocumentClassifier:
else:
self.correspondent_classifier = None
logger.debug(
"There are no correspondents. Not training correspondent "
"classifier.",
"There are no correspondents. Not training correspondent classifier.",
)
if num_document_types > 0:
@ -326,8 +325,7 @@ class DocumentClassifier:
else:
self.document_type_classifier = None
logger.debug(
"There are no document types. Not training document type "
"classifier.",
"There are no document types. Not training document type classifier.",
)
if num_storage_paths > 0:

View File

@ -18,8 +18,7 @@ class Command(BaseCommand):
parser.add_argument(
"--passphrase",
help=(
"If PAPERLESS_PASSPHRASE isn't set already, you need to "
"specify it here"
"If PAPERLESS_PASSPHRASE isn't set already, you need to specify it here"
),
)

View File

@ -96,7 +96,7 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
doc = Document.objects.create(
checksum=str(i),
pk=i + 1,
title=f"Document {i+1}",
title=f"Document {i + 1}",
content="content",
)
index.update_document(writer, doc)
@ -131,7 +131,7 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
doc = Document.objects.create(
checksum=str(i),
pk=i + 1,
title=f"Document {i+1}",
title=f"Document {i + 1}",
content="content",
)
index.update_document(writer, doc)
@ -630,8 +630,8 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
doc = Document.objects.create(
checksum=str(i),
pk=i + 1,
title=f"Document {i+1}",
content=f"Things document {i+1}",
title=f"Document {i + 1}",
content=f"Things document {i + 1}",
)
index.update_document(writer, doc)

View File

@ -295,9 +295,9 @@ class TestMigrations(TransactionTestCase):
def setUp(self):
super().setUp()
assert (
self.migrate_from and self.migrate_to
), f"TestCase '{type(self).__name__}' must define migrate_from and migrate_to properties"
assert self.migrate_from and self.migrate_to, (
f"TestCase '{type(self).__name__}' must define migrate_from and migrate_to properties"
)
self.migrate_from = [(self.app, self.migrate_from)]
if self.dependencies is not None:
self.migrate_from.extend(self.dependencies)

View File

@ -552,8 +552,7 @@ class MailAccountHandler(LoggingMixin):
mailbox_login(M, account)
self.log.debug(
f"Account {account}: Processing "
f"{account.rules.count()} rule(s)",
f"Account {account}: Processing {account.rules.count()} rule(s)",
)
for rule in account.rules.order_by("order"):

View File

@ -129,9 +129,11 @@ class TestParserLive:
assert thumb.exists()
assert thumb.is_file()
assert (
self.imagehash(thumb) == self.imagehash(simple_txt_email_thumbnail_file)
), f"Created Thumbnail {thumb} differs from expected file {simple_txt_email_thumbnail_file}"
assert self.imagehash(thumb) == self.imagehash(
simple_txt_email_thumbnail_file,
), (
f"Created Thumbnail {thumb} differs from expected file {simple_txt_email_thumbnail_file}"
)
def test_tika_parse_successful(self, mail_parser: MailDocumentParser):
"""
@ -226,6 +228,6 @@ class TestParserLive:
# The created pdf is not reproducible. But the converted image should always look the same.
expected_hash = self.imagehash(html_email_thumbnail_file)
assert (
generated_thumbnail_hash == expected_hash
), f"PDF looks different. Check if {generated_thumbnail} looks weird."
assert generated_thumbnail_hash == expected_hash, (
f"PDF looks different. Check if {generated_thumbnail} looks weird."
)

View File

@ -455,8 +455,7 @@ class RasterisedDocumentParser(DocumentParser):
self.text = text_original
else:
self.log.warning(
f"No text was found in {document_path}, the content will "
f"be empty.",
f"No text was found in {document_path}, the content will be empty.",
)
self.text = ""