Skip to content

Commit e85ce1c

Browse files
♻️ misc fixes for newest additions
1 parent e9f0106 commit e85ce1c

File tree

6 files changed

+31
-12
lines changed

6 files changed

+31
-12
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ attr-naming-style=snake_case
418418
# Regular expression matching correct attribute names. Overrides attr-naming-
419419
# style. If left empty, attribute names will be checked with the set naming
420420
# style.
421-
attr-rgx=[a-z_][a-z0-9_]{1,30}$
421+
attr-rgx=[a-z_][a-z0-9_]{1,40}$
422422

423423
# Bad variable names which should always be refused, separated by a comma.
424424
bad-names=foo,

mindee/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ class CommandConfig(Generic[TypeDoc]):
7979
help="FR Bank Account Details",
8080
doc_class=documents.fr.TypeBankAccountDetailsV1,
8181
),
82+
"multi-receipts-detector": CommandConfig(
83+
help="Multi Receipts Detector",
84+
doc_class=documents.TypeMultiReceiptsDetectorV1,
85+
),
8286
"invoice-splitter": CommandConfig(
8387
help="Invoice Splitter",
8488
doc_class=documents.TypeInvoiceSplitterV1,
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
from .multi_receipts_detector_v1 import MultiReceiptsDetectorV1, TypeMultiReceiptsDetectorV1
1+
from .multi_receipts_detector_v1 import (
2+
MultiReceiptsDetectorV1,
3+
TypeMultiReceiptsDetectorV1,
4+
)

mindee/documents/us/w9/w9_v1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class W9V1(Document):
2828
"""The federal tax classification, which can vary depending on the revision date."""
2929
tax_classification_llc: TextField
3030
"""Depending on revision year, among S, C, P or D for Limited Liability Company Classification."""
31-
tax_classif_other_details: TextField
31+
tax_classification_other_details: TextField
3232
"""Tax Classification Other Details."""
3333
w9_revision_date: TextField
3434
"""The Revision month and year of the W9 form."""
@@ -103,7 +103,7 @@ def _build_from_api_prediction(
103103
api_prediction.get("tax_classification_llc", {}),
104104
page_id=page_n,
105105
)
106-
self.tax_classif_other_details = TextField(
106+
self.tax_classification_other_details = TextField(
107107
api_prediction.get("tax_classification_other_details", {}),
108108
page_id=page_n,
109109
)
@@ -124,7 +124,7 @@ def __str__(self) -> str:
124124
f":Business Name: {self.business_name}\n"
125125
f":EIN: {self.ein}\n"
126126
f":Tax Classification: {self.tax_classification}\n"
127-
f":Tax Classification Other Details: {self.tax_classif_other_details}\n"
127+
f":Tax Classification Other Details: {self.tax_classification_other_details}\n"
128128
f":W9 Revision Date: {self.w9_revision_date}\n"
129129
f":Signature Position: {self.signature_position}\n"
130130
f":Signature Date Position: {self.signature_date_position}\n"

tests/documents/test_multi_receipts_detector_v1.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,38 @@
55
from mindee.documents import MultiReceiptsDetectorV1
66

77
MULTI_RECEIPTS_DETECTOR_DATA_DIR = "./tests/data/products/multi_receipts_detector"
8-
FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_COMPLETE = f"{ MULTI_RECEIPTS_DETECTOR_DATA_DIR }/response_v1/complete.json"
9-
FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_EMPTY = f"{ MULTI_RECEIPTS_DETECTOR_DATA_DIR }/response_v1/empty.json"
8+
FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_COMPLETE = (
9+
f"{ MULTI_RECEIPTS_DETECTOR_DATA_DIR }/response_v1/complete.json"
10+
)
11+
FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_EMPTY = (
12+
f"{ MULTI_RECEIPTS_DETECTOR_DATA_DIR }/response_v1/empty.json"
13+
)
1014

1115

1216
@pytest.fixture
1317
def multi_receipts_detector_v1_doc() -> MultiReceiptsDetectorV1:
14-
json_data = json.load(open(FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_COMPLETE, encoding="utf-8"))
18+
json_data = json.load(
19+
open(FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_COMPLETE, encoding="utf-8")
20+
)
1521
return MultiReceiptsDetectorV1(json_data["document"]["inference"], page_n=None)
1622

1723

1824
@pytest.fixture
1925
def multi_receipts_detector_v1_doc_empty() -> MultiReceiptsDetectorV1:
20-
json_data = json.load(open(FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_EMPTY, encoding="utf-8"))
26+
json_data = json.load(
27+
open(FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_EMPTY, encoding="utf-8")
28+
)
2129
return MultiReceiptsDetectorV1(json_data["document"]["inference"], page_n=None)
2230

2331

2432
@pytest.fixture
2533
def multi_receipts_detector_v1_page0():
26-
json_data = json.load(open(FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_COMPLETE, encoding="utf-8"))
27-
return MultiReceiptsDetectorV1(json_data["document"]["inference"]["pages"][0], page_n=0)
34+
json_data = json.load(
35+
open(FILE_PATH_MULTI_RECEIPTS_DETECTOR_V1_COMPLETE, encoding="utf-8")
36+
)
37+
return MultiReceiptsDetectorV1(
38+
json_data["document"]["inference"]["pages"][0], page_n=0
39+
)
2840

2941

3042
def test_empty_doc_constructor(multi_receipts_detector_v1_doc_empty):

tests/documents/us/test_w9_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_empty_doc_constructor(w9_v1_doc_empty):
3535
assert w9_v1_doc_empty.business_name.value is None
3636
assert w9_v1_doc_empty.ein.value is None
3737
assert w9_v1_doc_empty.tax_classification.value is None
38-
assert w9_v1_doc_empty.tax_classif_other_details.value is None
38+
assert w9_v1_doc_empty.tax_classification_other_details.value is None
3939
assert w9_v1_doc_empty.w9_revision_date.value is None
4040
assert w9_v1_doc_empty.signature_position.value is None
4141
assert w9_v1_doc_empty.signature_date_position.value is None

0 commit comments

Comments
 (0)