documente_shared 0.1.100__py3-none-any.whl → 0.1.102__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of documente_shared might be problematic. Click here for more details.

@@ -0,0 +1,45 @@
1
+ import re
2
+ from typing import Any
3
+
4
+ import unicodedata
5
+ from unidecode import unidecode
6
+
7
+
8
+ def underscoreize(data: Any) -> Any:
9
+ if isinstance(data, dict):
10
+ new_dict = {}
11
+ for key, value in data.items():
12
+ new_key = re.sub(r"(?<!^)(?=[A-Z])", "_", key).lower()
13
+ new_dict[new_key] = underscoreize(value)
14
+ return new_dict
15
+ elif isinstance(data, list):
16
+ return [underscoreize(item) for item in data]
17
+ else:
18
+ return data
19
+
20
+
21
+ def safe_format(data: Any) -> Any:
22
+ if isinstance(data, dict):
23
+ new_dict = {}
24
+ for key, value in data.items():
25
+ new_key = unidecode(key.replace(" ", "_"))
26
+ new_dict[new_key] = safe_format(value)
27
+ return new_dict
28
+ elif isinstance(data, list):
29
+ return [safe_format(item) for item in data]
30
+ else:
31
+ return data
32
+
33
+
34
+ def normalize_key(key: str) -> str:
35
+ normalized = unicodedata.normalize('NFC', key)
36
+ underscored = re.sub(r'\s+', '_', normalized)
37
+ return underscored
38
+
39
+
40
+ def normalize_dict_keys(data: dict) -> dict:
41
+ return {normalize_key(k): v for k, v in data.items()}
42
+
43
+
44
+ def normalize_list_keys(data: list) -> list:
45
+ return [normalize_dict_keys(item) for item in data]
@@ -0,0 +1,11 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional
3
+
4
+ from documente_shared.domain.entities.in_memory_document import InMemoryDocument
5
+
6
+
7
+ @dataclass
8
+ class ProcessedDocuments(object):
9
+ processed_csv: Optional[InMemoryDocument] = None
10
+ processed_xlsx: Optional[InMemoryDocument] = None
11
+ processed_json: Optional[InMemoryDocument] = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.100
3
+ Version: 0.1.102
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -17,6 +17,7 @@ Requires-Dist: loguru (>=0.7.3,<0.8.0)
17
17
  Requires-Dist: pytz (>=2025.2,<2026.0)
18
18
  Requires-Dist: requests (>=2.32.3,<3.0.0)
19
19
  Requires-Dist: sentry-sdk (>=2.19.2,<3.0.0)
20
+ Requires-Dist: unidecode (>=1.3.8,<2.0.0)
20
21
  Description-Content-Type: text/markdown
21
22
 
22
23
 
@@ -4,6 +4,7 @@ documente_shared/application/dates.py,sha256=uExNddWmX9VEX_u420JGoC7fL-ieJ4956I0
4
4
  documente_shared/application/digest.py,sha256=Um6E8WfFri2_lly4RFWydJyvSfPZGFcOX-opEOzDCWc,172
5
5
  documente_shared/application/exceptions.py,sha256=lQM8m7wmI9OTLGva0gd7s7YT7ldaTk_Ln4t32PpzNf8,654
6
6
  documente_shared/application/files.py,sha256=ADiWi6Mk3YQGx3boGsDqdb5wk8qmabkGRy7bhNFa1OY,649
7
+ documente_shared/application/json.py,sha256=5y67-DoiJlq_fLefgJ8YBVsdyua4KykxbSUKQqcwnnQ,1223
7
8
  documente_shared/application/payloads.py,sha256=s6SjaNN18_aQ6IL083Zq2J8thRCZ_zC2sn7hkfjK_Go,453
8
9
  documente_shared/application/query_params.py,sha256=JscPqFBx28p-x9i2g6waY7Yl4FQM1zn2zSbEoTrkK1k,3938
9
10
  documente_shared/application/time_utils.py,sha256=_fxgh8VoGPkdsft47COJ16vFwt8pMbHIJCgDFHLSlrU,435
@@ -19,6 +20,7 @@ documente_shared/domain/entities/processing_case.py,sha256=2wD256_ra5szb8LVmGsau
19
20
  documente_shared/domain/entities/processing_case_filters.py,sha256=harKyu7QEuL1bI_Z8_UxkVCMo5r9vHeNHyi_Ja07vjs,1953
20
21
  documente_shared/domain/entities/processing_case_item.py,sha256=VbVOqAUHtcCHfAF5VpG47IWkM8t6eSX4VuDifJe7ZzA,10108
21
22
  documente_shared/domain/entities/processing_case_item_filters.py,sha256=R_AvDCB496Lww1qn2OwtltqULKE3IpcJB0ejnmRkg7Q,2009
23
+ documente_shared/domain/entities/processing_documents.py,sha256=YYuTkdCNkqlO8cA0onJsZYtstxGt9M5NMuIO_87lB14,352
22
24
  documente_shared/domain/entities/processing_event.py,sha256=izdBXEz0TMNjxxZVjcM3YclzOv250JOV-amSpqmtQ9c,2180
23
25
  documente_shared/domain/entities/scaling.py,sha256=Me1z3X-5NjzPMX-TBQ4xHwE_44tIJegi1QSCHQRNtx4,745
24
26
  documente_shared/domain/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -51,6 +53,6 @@ documente_shared/infrastructure/services/http_scaling.py,sha256=cIo-61nfIwbtO86E
51
53
  documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
52
54
  documente_shared/presentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
55
  documente_shared/presentation/presenters.py,sha256=GGAEwefmjCIVepsUA2oZOVLxXbhhiISPM0Jgt6dT6O0,423
54
- documente_shared-0.1.100.dist-info/METADATA,sha256=1KKQjyPWPCtuChtiVXn5tORQsB1c3wDrH-wgGlTPR_Y,921
55
- documente_shared-0.1.100.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
56
- documente_shared-0.1.100.dist-info/RECORD,,
56
+ documente_shared-0.1.102.dist-info/METADATA,sha256=tARdyWoX4aCrlJZct2j4vbaoP3fYoTXbILizBCpfDHM,963
57
+ documente_shared-0.1.102.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
58
+ documente_shared-0.1.102.dist-info/RECORD,,