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
15 changes: 5 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
repos:
- repo: https://github.com/ambv/black
rev: 25.9.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.14.3
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 7.0.0
hooks:
- id: isort
args: [ "--profile", "black" , "--split-on-trailing-comma", "true"]
additional_dependencies: [toml]
- id: ruff
args: [ --fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
Expand Down
1 change: 1 addition & 0 deletions mindee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"PredictResponse",
"WorkflowResponse",
"JobResponse",
"Job",
"InferenceResponse",
"product",
]
16 changes: 16 additions & 0 deletions mindee/error/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,19 @@
)
from mindee.error.mindee_image_error import MindeeImageError
from mindee.error.mindee_pdf_error import MindeePDFError

__all__ = [
"MindeeError",
"MindeeApiError",
"MindeeApiV2Error",
"MindeeClientError",
"MindeeProductError",
"MindeeHTTPError",
"MindeeHTTPClientError",
"MindeeHTTPServerError",
"handle_error",
"MindeeImageError",
"MindeePDFError",
"GeometryError",
"MimeTypeError",
]
9 changes: 9 additions & 0 deletions mindee/extraction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@
from mindee.extraction.multi_receipts_extractor import multi_receipts_extractor
from mindee.extraction.pdf_extractor.extracted_pdf import ExtractedPdf
from mindee.extraction.pdf_extractor.pdf_extractor import PdfExtractor

__all__ = [
"ExtractedImage",
"ExtractedPdf",
"PdfExtractor",
"attach_image_as_new_file",
"extract_multiple_images_from_source",
"multi_receipts_extractor",
]
6 changes: 6 additions & 0 deletions mindee/extraction/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
attach_image_as_new_file,
extract_multiple_images_from_source,
)

__all__ = [
"ExtractedImage",
"attach_image_as_new_file",
"extract_multiple_images_from_source",
]
2 changes: 2 additions & 0 deletions mindee/extraction/multi_receipts_extractor/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from mindee.extraction.multi_receipts_extractor import multi_receipts_extractor

__all__ = ["multi_receipts_extractor"]
2 changes: 2 additions & 0 deletions mindee/extraction/pdf_extractor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from mindee.extraction.pdf_extractor.extracted_pdf import ExtractedPdf
from mindee.extraction.pdf_extractor.pdf_extractor import PdfExtractor

__all__ = ["ExtractedPdf", "PdfExtractor"]
21 changes: 21 additions & 0 deletions mindee/geometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,24 @@
get_bounding_box,
quadrilateral_from_prediction,
)

__all__ = [
"BBox",
"MinMax",
"Point",
"Points",
"Polygon",
"Quadrilateral",
"is_point_in_polygon_x",
"is_point_in_polygon_y",
"is_point_in_y",
"is_point_in_x",
"quadrilateral_from_prediction",
"get_bbox",
"get_min_max_x",
"get_min_max_y",
"get_bounding_box",
"get_centroid",
"polygon_from_prediction",
"merge_polygons",
]
2 changes: 2 additions & 0 deletions mindee/image_operations/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from mindee.image_operations.image_compressor import compress_image

__all__ = ["compress_image"]
14 changes: 14 additions & 0 deletions mindee/input/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@
from mindee.input.sources.path_input import PathInput
from mindee.input.sources.url_input_source import UrlInputSource
from mindee.input.workflow_options import WorkflowOptions

__all__ = [
"InputType",
"LocalInputSource",
"UrlInputSource",
"PathInput",
"FileInput",
"Base64Input",
"BytesInput",
"WorkflowOptions",
"PollingOptions",
"PageOptions",
"LocalResponse",
]
12 changes: 12 additions & 0 deletions mindee/mindee_http/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@
)
from mindee.mindee_http.workflow_endpoint import WorkflowEndpoint
from mindee.mindee_http.workflow_settings import WorkflowSettings

__all__ = [
"BaseEndpoint",
"CustomEndpoint",
"Endpoint",
"MindeeApi",
"clean_request_json",
"is_valid_async_response",
"is_valid_sync_response",
"WorkflowEndpoint",
"WorkflowSettings",
]
4 changes: 2 additions & 2 deletions mindee/mindee_http/response_validation_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def is_valid_post_response(response: requests.Response) -> bool:
if not is_valid_sync_response(response):
return False
response_json = json.loads(response.content)
if not "job" in response_json:
if "job" not in response_json:
return False
if (
"job" in response_json
Expand All @@ -36,6 +36,6 @@ def is_valid_get_response(response: requests.Response) -> bool:
if not is_valid_sync_response(response):
return False
response_json = json.loads(response.content)
if not "inference" in response_json and not "job" in response_json:
if "inference" not in response_json and "job" not in response_json:
return False
return True
8 changes: 7 additions & 1 deletion mindee/parsing/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
from mindee.parsing import common, custom, standard
from mindee.parsing import (
common,
custom,
standard,
)

__all__ = ["common", "custom", "standard"]
26 changes: 26 additions & 0 deletions mindee/parsing/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,29 @@
line_separator,
)
from mindee.parsing.common.workflow_response import WorkflowResponse

__all__ = [
"ApiRequest",
"ApiResponse",
"AsyncPredictResponse",
"Document",
"Execution",
"ExecutionFile",
"ExecutionPriority",
"CropperExtra",
"Extras",
"FeedbackResponse",
"Inference",
"TypeInference",
"WorkflowResponse",
"line_separator",
"clean_out_string",
"format_for_display",
"Prediction",
"Job",
"OrientationField",
"Page",
"PredictResponse",
"MVisionV1",
"Ocr",
]
5 changes: 5 additions & 0 deletions mindee/parsing/common/extras/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from mindee.parsing.common.extras.cropper_extra import CropperExtra
from mindee.parsing.common.extras.extras import Extras

__all__ = [
"Extras",
"CropperExtra",
]
2 changes: 2 additions & 0 deletions mindee/parsing/common/ocr/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from mindee.parsing.common.ocr.ocr import Ocr

__all__ = ["Ocr"]
2 changes: 1 addition & 1 deletion mindee/parsing/common/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
def __str__(self) -> str:
title = f"Page {self.id}"
dashes = "-" * len(title)
return f"{title}\n" f"{dashes}\n" f"{self.prediction}\n"
return f"{title}\n{dashes}\n{self.prediction}\n"


TypePage = TypeVar("TypePage", bound=Page)
2 changes: 1 addition & 1 deletion mindee/parsing/common/summary_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ def format_for_display(
return (
out_string
if len(out_string) <= max_col_size
else f"{out_string[:max_col_size-3]}..."
else f"{out_string[: max_col_size - 3]}..."
)
8 changes: 8 additions & 0 deletions mindee/parsing/custom/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from mindee.parsing.custom.classification import ClassificationField
from mindee.parsing.custom.line_items import CustomLine, get_line_items
from mindee.parsing.custom.list import ListField, ListFieldValue

__all__ = [
"ClassificationField",
"CustomLine",
"get_line_items",
"ListField",
"ListFieldValue",
]
6 changes: 6 additions & 0 deletions mindee/parsing/generated/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
GeneratedObjectField,
is_generated_object,
)

__all__ = [
"GeneratedListField",
"GeneratedObjectField",
"is_generated_object",
]
24 changes: 24 additions & 0 deletions mindee/parsing/standard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,27 @@
from mindee.parsing.standard.position import PositionField
from mindee.parsing.standard.tax import Taxes, TaxField
from mindee.parsing.standard.text import StringField

__all__ = [
"AddressField",
"AmountField",
"BaseField",
"FieldConfidenceMixin",
"FieldPositionMixin",
"bool_to_string",
"float_to_string",
"int_to_string",
"to_opt_bool",
"to_opt_float",
"to_opt_int",
"BooleanField",
"ClassificationField",
"CompanyRegistrationField",
"DateField",
"LocaleField",
"PaymentDetailsField",
"PositionField",
"Taxes",
"TaxField",
"StringField",
]
2 changes: 1 addition & 1 deletion mindee/parsing/v2/inference_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ def __init__(self, raw_response: StringDict) -> None:
self.id = raw_response["id"]

def __str__(self) -> str:
return f"Model\n=====" f"\n:ID: {self.id}"
return f"Model\n=====\n:ID: {self.id}"
8 changes: 8 additions & 0 deletions mindee/pdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
has_source_text,
lerp,
)

__all__ = [
"PDFCharData",
"compress_pdf",
"extract_text_from_pdf",
"has_source_text",
"lerp",
]
72 changes: 72 additions & 0 deletions mindee/product/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,75 @@
from mindee.product.resume.resume_v1_social_networks_url import (
ResumeV1SocialNetworksUrl,
)

__all__ = [
"fr",
"ind",
"us",
"BarcodeReaderV1",
"BarcodeReaderV1Document",
"BillOfLadingV1",
"BillOfLadingV1Carrier",
"BillOfLadingV1CarrierItem",
"BillOfLadingV1Consignee",
"BillOfLadingV1Document",
"BillOfLadingV1NotifyParty",
"BillOfLadingV1Shipper",
"BusinessCardV1",
"BusinessCardV1Document",
"CropperV1",
"CropperV1Document",
"CropperV1Page",
"CustomV1",
"CustomV1Document",
"CustomV1Page",
"DeliveryNoteV1",
"DeliveryNoteV1Document",
"DriverLicenseV1",
"DriverLicenseV1Document",
"FinancialDocumentV1",
"FinancialDocumentV1Document",
"FinancialDocumentV1LineItem",
"GeneratedV1",
"GeneratedV1Document",
"GeneratedV1Page",
"InternationalIdV2",
"InternationalIdV2Document",
"InvoiceV4",
"InvoiceV4Document",
"InvoiceV4LineItem",
"InvoiceSplitterV1",
"InvoiceSplitterV1Document",
"InvoiceSplitterV1InvoicePageGroup",
"MaterialCertificateV1",
"MaterialCertificateV1Document",
"MultiReceiptsDetectorV1",
"MultiReceiptsDetectorV1Document",
"NutritionFactsLabelV1",
"NutritionFactsLabelV1AddedSugar",
"NutritionFactsLabelV1Calorie",
"NutritionFactsLabelV1Cholesterol",
"NutritionFactsLabelV1DietaryFiber",
"NutritionFactsLabelV1Document",
"NutritionFactsLabelV1Nutrient",
"NutritionFactsLabelV1Protein",
"NutritionFactsLabelV1SaturatedFat",
"NutritionFactsLabelV1ServingSize",
"NutritionFactsLabelV1Sodium",
"NutritionFactsLabelV1TotalCarbohydrate",
"NutritionFactsLabelV1TotalFat",
"NutritionFactsLabelV1TotalSugar",
"NutritionFactsLabelV1TransFat",
"PassportV1",
"PassportV1Document",
"ReceiptV5",
"ReceiptV5Document",
"ReceiptV5LineItem",
"ResumeV1",
"ResumeV1Certificate",
"ResumeV1Document",
"ResumeV1Education",
"ResumeV1Language",
"ResumeV1ProfessionalExperience",
"ResumeV1SocialNetworksUrl",
]
5 changes: 5 additions & 0 deletions mindee/product/barcode_reader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
from mindee.product.barcode_reader.barcode_reader_v1_document import (
BarcodeReaderV1Document,
)

__all__ = [
"BarcodeReaderV1",
"BarcodeReaderV1Document",
]
4 changes: 2 additions & 2 deletions mindee/product/barcode_reader/barcode_reader_v1_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def __init__(
]

def __str__(self) -> str:
codes_1d = f"\n { ' ' * 13 }".join(
codes_1d = f"\n {' ' * 13}".join(
[str(item) for item in self.codes_1d],
)
codes_2d = f"\n { ' ' * 13 }".join(
codes_2d = f"\n {' ' * 13}".join(
[str(item) for item in self.codes_2d],
)
out_str: str = f":Barcodes 1D: {codes_1d}\n"
Expand Down
Loading