A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
add trailing commas
florian on nixos (Florian Brandes)78ca2ffabac1
diff --git a/src/documents/tasks.py b/src/documents/tasks.pyindex a5d2d26ca..2f0fe30c4 100644--- a/src/documents/tasks.py+++ b/src/documents/tasks.py@@ -86,7 +86,7 @@ def barcode_reader(image) -> list:if barcode.data != "":barcodes = barcodes + [str(barcode.data)]logger.debug(- f"Barcode of type {str(barcode.type)} found: {str(barcode.data)}"+ f"Barcode of type {str(barcode.type)} found: {str(barcode.data)}",)return barcodesdiff --git a/src/documents/tests/test_tasks.py b/src/documents/tests/test_tasks.pyindex 17a36e5cb..2cf68c216 100644--- a/src/documents/tests/test_tasks.py+++ b/src/documents/tests/test_tasks.py@@ -93,7 +93,7 @@ class TestTasks(DirectoriesMixin, TestCase):def test_barcode_reader(self):test_file = os.path.join(- os.path.dirname(__file__), "samples", "patch-code-t.pbm"+ os.path.dirname(__file__), "samples", "patch-code-t.pbm",)img = Image.open(test_file)self.assertEqual(tasks.barcode_reader(img), ["b'PATCHT'"])@@ -105,7 +105,7 @@ class TestTasks(DirectoriesMixin, TestCase):def test_scan_file_for_separating_barcodes(self):test_file = os.path.join(- os.path.dirname(__file__), "samples", "patch-code-t.pdf"+ os.path.dirname(__file__), "samples", "patch-code-t.pdf",)pages = tasks.scan_file_for_separating_barcodes(test_file)self.assertEqual(pages, [0])@@ -117,21 +117,21 @@ class TestTasks(DirectoriesMixin, TestCase):def test_scan_file_for_separating_barcodes3(self):test_file = os.path.join(- os.path.dirname(__file__), "samples", "patch-code-t-middle.pdf"+ os.path.dirname(__file__), "samples", "patch-code-t-middle.pdf",)pages = tasks.scan_file_for_separating_barcodes(test_file)self.assertEqual(pages, [1])def test_separate_pages(self):test_file = os.path.join(- os.path.dirname(__file__), "samples", "patch-code-t-middle.pdf"+ os.path.dirname(__file__), "samples", "patch-code-t-middle.pdf",)pages = tasks.separate_pages(test_file, [1])self.assertEqual(len(pages), 2)def test_save_to_dir(self):test_file = os.path.join(- os.path.dirname(__file__), "samples", "patch-code-t.pdf"+ os.path.dirname(__file__), "samples", "patch-code-t.pdf",)tempdir = tempfile.mkdtemp(prefix="paperless-", dir=settings.SCRATCH_DIR)tasks.save_to_dir(test_file, tempdir)@@ -140,7 +140,7 @@ class TestTasks(DirectoriesMixin, TestCase):def test_save_to_dir2(self):test_file = os.path.join(- os.path.dirname(__file__), "samples", "patch-code-t.pdf"+ os.path.dirname(__file__), "samples", "patch-code-t.pdf",)nonexistingdir = "/nowhere"if os.path.isdir(nonexistingdir):@@ -151,13 +151,13 @@ class TestTasks(DirectoriesMixin, TestCase):self.assertEqual(cm.output,[- f"WARNING:paperless.tasks:{str(test_file)} or {str(nonexistingdir)} don't exist."+ f"WARNING:paperless.tasks:{str(test_file)} or {str(nonexistingdir)} don't exist.",],)def test_barcode_splitter(self):test_file = os.path.join(- os.path.dirname(__file__), "samples", "patch-code-t-middle.pdf"+ os.path.dirname(__file__), "samples", "patch-code-t-middle.pdf",)tempdir = tempfile.mkdtemp(prefix="paperless-", dir=settings.SCRATCH_DIR)separators = tasks.scan_file_for_separating_barcodes(test_file)