From 3ab970c3e7a19e17fcc9cefc88e75b3af7eda766 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 14 Nov 2025 15:54:26 +0000 Subject: [PATCH] style: Add trailing commas per ruff linting rules Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com> --- .../management/commands/scan_documents_ai.py | 16 ++++++------- .../tests/test_management_scan_ai.py | 24 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/documents/management/commands/scan_documents_ai.py b/src/documents/management/commands/scan_documents_ai.py index 2634a26ab..3f56fcb41 100644 --- a/src/documents/management/commands/scan_documents_ai.py +++ b/src/documents/management/commands/scan_documents_ai.py @@ -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']}", ), ) diff --git a/src/documents/tests/test_management_scan_ai.py b/src/documents/tests/test_management_scan_ai.py index cd8cb0352..eb1df9e1c 100644 --- a/src/documents/tests/test_management_scan_ai.py +++ b/src/documents/tests/test_management_scan_ai.py @@ -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