From ad8ea5d830bc82bae5d2a8c6e2f2a0141ebf4cc9 Mon Sep 17 00:00:00 2001 From: Mindee Date: Fri, 27 Dec 2024 12:09:06 +0100 Subject: [PATCH] :art: linting fixes --- docs/product/business_card_v1.rst | 2 +- docs/product/delivery_note_v1.rst | 2 +- docs/product/driver_license_v1.rst | 2 +- docs/product/financial_document_v1.rst | 2 +- docs/product/fr/energy_bill_v1.rst | 2 +- docs/product/fr/health_card_v1.rst | 2 +- docs/product/fr/payslip_v2.rst | 2 +- docs/product/fr/payslip_v3.rst | 2 +- docs/product/invoice_v4.rst | 2 +- docs/product/material_certificate_v1.rst | 2 +- docs/product/receipt_v5.rst | 2 +- docs/product/resume_v1.rst | 2 +- docs/product/us/healthcare_card_v1.rst | 2 +- .../extraction/pdf_extractor/pdf_extractor.py | 4 +--- tests/product/generated/test_generated_v1.py | 20 +++++++++---------- 15 files changed, 24 insertions(+), 26 deletions(-) diff --git a/docs/product/business_card_v1.rst b/docs/product/business_card_v1.rst index 7fa9c2d9..bab5ac7a 100644 --- a/docs/product/business_card_v1.rst +++ b/docs/product/business_card_v1.rst @@ -3,7 +3,7 @@ Business Card V1 **Sample Code:** -.. literalinclude:: /extras/code_samples/business_card_v1.txt +.. literalinclude:: /extras/code_samples/business_card_v1_async.txt :language: Python .. autoclass:: mindee.product.business_card.business_card_v1.BusinessCardV1 diff --git a/docs/product/delivery_note_v1.rst b/docs/product/delivery_note_v1.rst index 876ce41b..998b0154 100644 --- a/docs/product/delivery_note_v1.rst +++ b/docs/product/delivery_note_v1.rst @@ -3,7 +3,7 @@ Delivery note V1 **Sample Code:** -.. literalinclude:: /extras/code_samples/delivery_notes_v1.txt +.. literalinclude:: /extras/code_samples/delivery_notes_v1_async.txt :language: Python .. autoclass:: mindee.product.delivery_note.delivery_note_v1.DeliveryNoteV1 diff --git a/docs/product/driver_license_v1.rst b/docs/product/driver_license_v1.rst index d3eed17f..e5545c15 100644 --- a/docs/product/driver_license_v1.rst +++ b/docs/product/driver_license_v1.rst @@ -3,7 +3,7 @@ Driver License V1 **Sample Code:** -.. literalinclude:: /extras/code_samples/driver_license_v1.txt +.. literalinclude:: /extras/code_samples/driver_license_v1_async.txt :language: Python .. autoclass:: mindee.product.driver_license.driver_license_v1.DriverLicenseV1 diff --git a/docs/product/financial_document_v1.rst b/docs/product/financial_document_v1.rst index c224f132..0973a270 100644 --- a/docs/product/financial_document_v1.rst +++ b/docs/product/financial_document_v1.rst @@ -3,7 +3,7 @@ Financial Document V1 **Sample Code:** -.. literalinclude:: /extras/code_samples/financial_document_v1.txt +.. literalinclude:: /extras/code_samples/financial_document_v1_async.txt :language: Python .. autoclass:: mindee.product.financial_document.financial_document_v1.FinancialDocumentV1 diff --git a/docs/product/fr/energy_bill_v1.rst b/docs/product/fr/energy_bill_v1.rst index d2c7b3ae..b06d09b9 100644 --- a/docs/product/fr/energy_bill_v1.rst +++ b/docs/product/fr/energy_bill_v1.rst @@ -3,7 +3,7 @@ Energy Bill V1 **Sample Code:** -.. literalinclude:: /extras/code_samples/energy_bill_fra_v1.txt +.. literalinclude:: /extras/code_samples/energy_bill_fra_v1_async.txt :language: Python .. autoclass:: mindee.product.fr.energy_bill.energy_bill_v1.EnergyBillV1 diff --git a/docs/product/fr/health_card_v1.rst b/docs/product/fr/health_card_v1.rst index dceb3d4f..11b6464d 100644 --- a/docs/product/fr/health_card_v1.rst +++ b/docs/product/fr/health_card_v1.rst @@ -3,7 +3,7 @@ Health Card V1 **Sample Code:** -.. literalinclude:: /extras/code_samples/french_healthcard_v1.txt +.. literalinclude:: /extras/code_samples/french_healthcard_v1_async.txt :language: Python .. autoclass:: mindee.product.fr.health_card.health_card_v1.HealthCardV1 diff --git a/docs/product/fr/payslip_v2.rst b/docs/product/fr/payslip_v2.rst index 0ba285bc..e36fd523 100644 --- a/docs/product/fr/payslip_v2.rst +++ b/docs/product/fr/payslip_v2.rst @@ -3,7 +3,7 @@ Payslip V2 **Sample Code:** -.. literalinclude:: /extras/code_samples/payslip_fra_v2.txt +.. literalinclude:: /extras/code_samples/payslip_fra_v2_async.txt :language: Python .. autoclass:: mindee.product.fr.payslip.payslip_v2.PayslipV2 diff --git a/docs/product/fr/payslip_v3.rst b/docs/product/fr/payslip_v3.rst index fa27c4f1..ca26cd47 100644 --- a/docs/product/fr/payslip_v3.rst +++ b/docs/product/fr/payslip_v3.rst @@ -3,7 +3,7 @@ Payslip V3 **Sample Code:** -.. literalinclude:: /extras/code_samples/payslip_fra_v3.txt +.. literalinclude:: /extras/code_samples/payslip_fra_v3_async.txt :language: Python .. autoclass:: mindee.product.fr.payslip.payslip_v3.PayslipV3 diff --git a/docs/product/invoice_v4.rst b/docs/product/invoice_v4.rst index 4b93e088..03698156 100644 --- a/docs/product/invoice_v4.rst +++ b/docs/product/invoice_v4.rst @@ -3,7 +3,7 @@ Invoice V4 **Sample Code:** -.. literalinclude:: /extras/code_samples/invoices_v4.txt +.. literalinclude:: /extras/code_samples/invoices_v4_async.txt :language: Python .. autoclass:: mindee.product.invoice.invoice_v4.InvoiceV4 diff --git a/docs/product/material_certificate_v1.rst b/docs/product/material_certificate_v1.rst index 62dcf590..dfd25e8d 100644 --- a/docs/product/material_certificate_v1.rst +++ b/docs/product/material_certificate_v1.rst @@ -3,7 +3,7 @@ Material Certificate V1 **Sample Code:** -.. literalinclude:: /extras/code_samples/material_certificate_v1.txt +.. literalinclude:: /extras/code_samples/material_certificate_v1_async.txt :language: Python .. autoclass:: mindee.product.material_certificate.material_certificate_v1.MaterialCertificateV1 diff --git a/docs/product/receipt_v5.rst b/docs/product/receipt_v5.rst index f48ebae7..2003f064 100644 --- a/docs/product/receipt_v5.rst +++ b/docs/product/receipt_v5.rst @@ -3,7 +3,7 @@ Receipt V5 **Sample Code:** -.. literalinclude:: /extras/code_samples/expense_receipts_v5.txt +.. literalinclude:: /extras/code_samples/expense_receipts_v5_async.txt :language: Python .. autoclass:: mindee.product.receipt.receipt_v5.ReceiptV5 diff --git a/docs/product/resume_v1.rst b/docs/product/resume_v1.rst index b7d597c4..6a7459e3 100644 --- a/docs/product/resume_v1.rst +++ b/docs/product/resume_v1.rst @@ -3,7 +3,7 @@ Resume V1 **Sample Code:** -.. literalinclude:: /extras/code_samples/resume_v1.txt +.. literalinclude:: /extras/code_samples/resume_v1_async.txt :language: Python .. autoclass:: mindee.product.resume.resume_v1.ResumeV1 diff --git a/docs/product/us/healthcare_card_v1.rst b/docs/product/us/healthcare_card_v1.rst index 9b187ab9..ee6fd476 100644 --- a/docs/product/us/healthcare_card_v1.rst +++ b/docs/product/us/healthcare_card_v1.rst @@ -3,7 +3,7 @@ Healthcare Card V1 **Sample Code:** -.. literalinclude:: /extras/code_samples/us_healthcare_cards_v1.txt +.. literalinclude:: /extras/code_samples/us_healthcare_cards_v1_async.txt :language: Python .. autoclass:: mindee.product.us.healthcare_card.healthcare_card_v1.HealthcareCardV1 diff --git a/mindee/extraction/pdf_extractor/pdf_extractor.py b/mindee/extraction/pdf_extractor/pdf_extractor.py index 91685be2..1a2023ca 100644 --- a/mindee/extraction/pdf_extractor/pdf_extractor.py +++ b/mindee/extraction/pdf_extractor/pdf_extractor.py @@ -91,9 +91,7 @@ def extract_invoices( if not isinstance(page_indexes[0], InvoiceSplitterV1PageGroup): return self.extract_sub_documents(page_indexes) # type: ignore if not strict: - indexes_as_list = [ - page_index.page_indexes for page_index in page_indexes # type: ignore - ] + indexes_as_list = [page_index.page_indexes for page_index in page_indexes] # type: ignore return self.extract_sub_documents(indexes_as_list) correct_page_indexes: List[List[int]] = [] current_list: List[int] = [] diff --git a/tests/product/generated/test_generated_v1.py b/tests/product/generated/test_generated_v1.py index 84fee9a4..5caadbab 100644 --- a/tests/product/generated/test_generated_v1.py +++ b/tests/product/generated/test_generated_v1.py @@ -487,13 +487,13 @@ def test_invoice_v4_complete_doc(invoice_v4_complete_doc) -> None: invoice_v4_complete_doc.inference.prediction.fields["line_items"] .values[0] .product_code - == None + is None ) assert ( invoice_v4_complete_doc.inference.prediction.fields["line_items"] .values[0] .quantity - == None + is None ) assert ( invoice_v4_complete_doc.inference.prediction.fields["line_items"] @@ -505,13 +505,13 @@ def test_invoice_v4_complete_doc(invoice_v4_complete_doc) -> None: invoice_v4_complete_doc.inference.prediction.fields["line_items"] .values[0] .tax_amount - == None + is None ) assert ( invoice_v4_complete_doc.inference.prediction.fields["line_items"] .values[0] .tax_rate - == None + is None ) assert ( invoice_v4_complete_doc.inference.prediction.fields["line_items"] @@ -523,7 +523,7 @@ def test_invoice_v4_complete_doc(invoice_v4_complete_doc) -> None: invoice_v4_complete_doc.inference.prediction.fields["line_items"] .values[0] .unit_price - == None + is None ) assert ( invoice_v4_complete_doc.inference.prediction.fields["line_items"] @@ -705,19 +705,19 @@ def test_invoice_v4_page0(invoice_v4_page_0) -> None: == "S)BOIE 5X500 FEUILLES A4" ) assert ( - invoice_v4_page_0.prediction.fields["line_items"].values[0].product_code == None + invoice_v4_page_0.prediction.fields["line_items"].values[0].product_code is None ) - assert invoice_v4_page_0.prediction.fields["line_items"].values[0].quantity == None + assert invoice_v4_page_0.prediction.fields["line_items"].values[0].quantity is None assert ( - invoice_v4_page_0.prediction.fields["line_items"].values[0].tax_amount == None + invoice_v4_page_0.prediction.fields["line_items"].values[0].tax_amount is None ) - assert invoice_v4_page_0.prediction.fields["line_items"].values[0].tax_rate == None + assert invoice_v4_page_0.prediction.fields["line_items"].values[0].tax_rate is None assert ( invoice_v4_page_0.prediction.fields["line_items"].values[0].total_amount == "2.63" ) assert ( - invoice_v4_page_0.prediction.fields["line_items"].values[0].unit_price == None + invoice_v4_page_0.prediction.fields["line_items"].values[0].unit_price is None ) assert isinstance(