Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 2 additions & 38 deletions .github/workflows/tag-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,5 @@ on:
- main

jobs:
tag-version:
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, ':bookmark:')"

steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Tag version
run: |
msg_start=':bookmark: Version '
version_format='[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}'
version=$(git log -1 --skip=0 --pretty=%s | grep -oP "(?<=${msg_start})${version_format}")

if [ -z "${version}" ]; then
echo 'Version not found, aborting.'
exit 1
fi

echo "Found version: ${version}";
tag="v${version}";

echo "Would tag: ${tag}";
existing_tag=$(git tag -l "${tag}");

if [ "${existing_tag}" ]; then
echo "Tag '${existing_tag}' already exists, aborting.";
exit 1;
fi

git config user.name "Mindee";
git config user.email "opensource@mindee.com"

git tag -a "${tag}" -m"Version ${version}";
git push origin "${tag}"

echo "Tagged and pushed: ${tag}"
tag:
uses: mindee/client-lib-actions/.github/workflows/tag-version.yml@main
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.13.0
hooks:
- id: mypy
args: []
Expand Down
2 changes: 1 addition & 1 deletion docs/product/business_card_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/delivery_note_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/driver_license_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/financial_document_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/fr/energy_bill_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/fr/health_card_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/fr/payslip_v2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/fr/payslip_v3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/invoice_v4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/material_certificate_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/receipt_v5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/resume_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/product/us/healthcare_card_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 5 additions & 9 deletions mindee/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,11 @@ def __init__(
parser if parser else MindeeArgumentParser(description="Mindee_API")
)
self.parsed_args = parsed_args if parsed_args else self._set_args()
self.client = (
client
if client
else Client(
api_key=(
self.parsed_args.api_key if "api_key" in self.parsed_args else None
)
)
)
if client:
self.client = client
else:
api_key = self.parsed_args.api_key if "api_key" in self.parsed_args else ""
self.client = Client(api_key=api_key)
self._set_input()
self.document_info = (
document_info if document_info else DOCUMENTS[self.parsed_args.product_name]
Expand Down
8 changes: 4 additions & 4 deletions mindee/error/mindee_http_error.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Union
from typing import Optional, Union

from mindee.error.mindee_error import MindeeError
from mindee.parsing.common.string_dict import StringDict
Expand All @@ -8,9 +8,9 @@ class MindeeHTTPError(RuntimeError):
"""An exception relating to HTTP calls."""

status_code: int
api_code: str
api_details: str
api_message: str
api_code: Optional[str]
api_details: Optional[str]
api_message: Optional[str]

def __init__(self, http_error: StringDict, url: str, code: int) -> None:
"""
Expand Down
4 changes: 1 addition & 3 deletions mindee/extraction/pdf_extractor/pdf_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []
Expand Down
20 changes: 10 additions & 10 deletions tests/product/generated/test_generated_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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"]
Expand All @@ -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"]
Expand Down Expand Up @@ -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(
Expand Down
Loading