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 # See https://docs.gunicorn.org/en/stable/settings.html for
# explanations of settings # 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)) workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 1))
worker_class = "paperless.workers.ConfigurableWorker" worker_class = "paperless.workers.ConfigurableWorker"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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