documente_shared 0.1.101__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]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.101
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
@@ -52,6 +53,6 @@ documente_shared/infrastructure/services/http_scaling.py,sha256=cIo-61nfIwbtO86E
52
53
  documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
53
54
  documente_shared/presentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
55
  documente_shared/presentation/presenters.py,sha256=GGAEwefmjCIVepsUA2oZOVLxXbhhiISPM0Jgt6dT6O0,423
55
- documente_shared-0.1.101.dist-info/METADATA,sha256=IZEXi-z2DgZ555MLaBNN86I3Z5aN9s0A4EHOUfH27xc,921
56
- documente_shared-0.1.101.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
57
- documente_shared-0.1.101.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,,