mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-10 16:46:50 +01:00
style: Add trailing commas per ruff linting rules
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
This commit is contained in:
parent
879a65ed9f
commit
3ab970c3e7
2 changed files with 20 additions and 20 deletions
|
|
@ -128,7 +128,7 @@ class Command(ProgressBarMixin, BaseCommand):
|
|||
if document_count == 0:
|
||||
self.stdout.write(
|
||||
self.style.WARNING(
|
||||
"No documents found matching the specified filters."
|
||||
"No documents found matching the specified filters.",
|
||||
),
|
||||
)
|
||||
return
|
||||
|
|
@ -161,7 +161,7 @@ class Command(ProgressBarMixin, BaseCommand):
|
|||
options["filter_by_type"],
|
||||
options["date_range"],
|
||||
options["id_range"],
|
||||
]
|
||||
],
|
||||
):
|
||||
raise CommandError(
|
||||
"You must specify at least one filter: "
|
||||
|
|
@ -247,7 +247,7 @@ class Command(ProgressBarMixin, BaseCommand):
|
|||
self.stdout.write("\nProcessing mode:")
|
||||
if options["dry_run"]:
|
||||
self.stdout.write(
|
||||
self.style.WARNING(" • DRY RUN - No changes will be applied")
|
||||
self.style.WARNING(" • DRY RUN - No changes will be applied"),
|
||||
)
|
||||
elif options["auto_apply_high_confidence"]:
|
||||
self.stdout.write(" • Auto-apply high confidence suggestions (≥80%)")
|
||||
|
|
@ -346,7 +346,7 @@ class Command(ProgressBarMixin, BaseCommand):
|
|||
"title": document.title,
|
||||
"suggestions": filtered_result.to_dict(),
|
||||
"applied": applied if auto_apply else None,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
results["processed"] += 1
|
||||
|
|
@ -361,7 +361,7 @@ class Command(ProgressBarMixin, BaseCommand):
|
|||
"id": document.id,
|
||||
"title": document.title,
|
||||
"error": str(e),
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
return results
|
||||
|
|
@ -436,16 +436,16 @@ class Command(ProgressBarMixin, BaseCommand):
|
|||
self.stdout.write("Statistics:")
|
||||
self.stdout.write(f" • Documents processed: {results['processed']}")
|
||||
self.stdout.write(
|
||||
f" • Documents with suggestions: {len(results['documents_with_suggestions'])}"
|
||||
f" • Documents with suggestions: {len(results['documents_with_suggestions'])}",
|
||||
)
|
||||
self.stdout.write(
|
||||
f" • Total suggestions generated: {results['suggestions_generated']}"
|
||||
f" • Total suggestions generated: {results['suggestions_generated']}",
|
||||
)
|
||||
|
||||
if options["auto_apply_high_confidence"] and not options["dry_run"]:
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(
|
||||
f" • Suggestions auto-applied: {results['auto_applied']}"
|
||||
f" • Suggestions auto-applied: {results['auto_applied']}",
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
"""Test command with --all flag."""
|
||||
# Mock the AI scanner
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -98,7 +98,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
def test_command_filter_by_type(self):
|
||||
"""Test command with --filter-by-type option."""
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -134,7 +134,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
def test_command_date_range(self):
|
||||
"""Test command with --date-range option."""
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -189,7 +189,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
def test_command_id_range(self):
|
||||
"""Test command with --id-range option."""
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -214,7 +214,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
def test_command_confidence_threshold(self):
|
||||
"""Test command with custom confidence threshold."""
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -255,7 +255,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
def test_command_auto_apply(self):
|
||||
"""Test command with --auto-apply-high-confidence."""
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -290,7 +290,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
def test_command_dry_run_does_not_apply(self):
|
||||
"""Test that dry run mode does not apply changes."""
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -326,7 +326,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
)
|
||||
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -351,7 +351,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
def test_command_handles_scanner_error(self):
|
||||
"""Test that command handles scanner errors gracefully."""
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -384,7 +384,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
)
|
||||
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -409,7 +409,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
def test_command_displays_suggestions(self):
|
||||
"""Test that command displays suggestions in output."""
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
@ -444,7 +444,7 @@ class TestScanDocumentsAICommand(DirectoriesMixin, TestCase):
|
|||
def test_command_works_when_ai_disabled(self):
|
||||
"""Test that command can run even if AI scanner is disabled in settings."""
|
||||
with mock.patch(
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner"
|
||||
"documents.management.commands.scan_documents_ai.get_ai_scanner",
|
||||
) as mock_scanner:
|
||||
mock_instance = mock.Mock()
|
||||
mock_scanner.return_value = mock_instance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue