documente_shared 0.1.104__py3-none-any.whl → 0.1.105__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,7 @@
1
+ from decimal import Decimal
2
+
3
+
4
+ def normalize_number(number: str | float | Decimal) -> str:
5
+ if not isinstance(number, Decimal):
6
+ number = Decimal(number)
7
+ return str(number.quantize(Decimal('0.001')))
@@ -5,6 +5,7 @@ from decimal import Decimal
5
5
  from typing import Optional, List
6
6
 
7
7
  from documente_shared.application.files import remove_slash_from_path, get_filename_from_path
8
+ from documente_shared.application.numbers import normalize_number
8
9
  from documente_shared.application.time_utils import get_datetime_from_data
9
10
  from documente_shared.domain.constants import la_paz_tz
10
11
  from documente_shared.domain.entities.document_metadata import DocumentProcessingMetadata
@@ -248,11 +249,11 @@ class DocumentProcessing(object):
248
249
  'processed_json_path': self.processed_json_path,
249
250
  'processed_metadata_path': self.processed_metadata_path,
250
251
  'processing_time': (
251
- str(self.processing_time.quantize(Decimal('0.00001')))
252
+ normalize_number(self.processing_time)
252
253
  if self.processing_time else None
253
254
  ),
254
255
  'processing_accuracy': (
255
- str(self.processing_accuracy.quantize(Decimal('0.00001')))
256
+ normalize_number(self.processing_accuracy)
256
257
  if self.processing_accuracy else None
257
258
  ),
258
259
  'issued_at': self.issued_at.isoformat() if self.issued_at else None,
@@ -3,6 +3,7 @@ from datetime import datetime, tzinfo
3
3
  from decimal import Decimal
4
4
  from typing import Optional, List
5
5
 
6
+ from documente_shared.application.numbers import normalize_number
6
7
  from documente_shared.application.time_utils import get_datetime_from_data
7
8
  from documente_shared.domain.constants import la_paz_tz
8
9
  from documente_shared.domain.entities.in_memory_document import InMemoryDocument
@@ -143,11 +144,11 @@ class ProcessingCaseItem(object):
143
144
  if self.processed_json else None
144
145
  ),
145
146
  'processing_time': (
146
- str(self.processing_time.quantize(Decimal('0.001')))
147
+ normalize_number(self.processing_time)
147
148
  if self.processing_time else None
148
149
  ),
149
150
  'processing_confidence': (
150
- str(self.processing_confidence.quantize(Decimal('0.001')))
151
+ normalize_number(self.processing_confidence)
151
152
  if self.processing_confidence else None
152
153
  ),
153
154
  'uploaded_at': (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.104
3
+ Version: 0.1.105
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -5,6 +5,7 @@ documente_shared/application/digest.py,sha256=Um6E8WfFri2_lly4RFWydJyvSfPZGFcOX-
5
5
  documente_shared/application/exceptions.py,sha256=lQM8m7wmI9OTLGva0gd7s7YT7ldaTk_Ln4t32PpzNf8,654
6
6
  documente_shared/application/files.py,sha256=ADiWi6Mk3YQGx3boGsDqdb5wk8qmabkGRy7bhNFa1OY,649
7
7
  documente_shared/application/json.py,sha256=5y67-DoiJlq_fLefgJ8YBVsdyua4KykxbSUKQqcwnnQ,1223
8
+ documente_shared/application/numbers.py,sha256=rik1SqMxLzXNL2S5Yh1Q8CSONdcjjoCBnByFasxR4_Q,212
8
9
  documente_shared/application/payloads.py,sha256=s6SjaNN18_aQ6IL083Zq2J8thRCZ_zC2sn7hkfjK_Go,453
9
10
  documente_shared/application/query_params.py,sha256=JscPqFBx28p-x9i2g6waY7Yl4FQM1zn2zSbEoTrkK1k,3938
10
11
  documente_shared/application/time_utils.py,sha256=_fxgh8VoGPkdsft47COJ16vFwt8pMbHIJCgDFHLSlrU,435
@@ -13,12 +14,12 @@ documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
13
14
  documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
14
15
  documente_shared/domain/constants.py,sha256=NG5BGaXBr_FnzudjTRPxpDpyiSDdaB_PLCdlYlFUQeU,187
15
16
  documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- documente_shared/domain/entities/document.py,sha256=2OHn9mNjzqKSpw9fY6xCHIMRw3D4nZmmUTZZj_K4ISc,12885
17
+ documente_shared/domain/entities/document.py,sha256=v0ZM3qmdk6zuGt7UqMseD1aN3RA8KjTtsGZuJq1dDGI,12919
17
18
  documente_shared/domain/entities/document_metadata.py,sha256=ygyFIC5qwxlm8DUM5kvVFny9zJfPQS8vNLM2br5XsQ8,2353
18
19
  documente_shared/domain/entities/in_memory_document.py,sha256=5MFG5V4EtNr-wwrLEFZusZPWvla52g5wuI6es5nQ4tM,1999
19
20
  documente_shared/domain/entities/processing_case.py,sha256=NwGGGMyXnNprtO1lCP6rkPbhGhZ6C_z30OeHi_LHXDY,5706
20
21
  documente_shared/domain/entities/processing_case_filters.py,sha256=harKyu7QEuL1bI_Z8_UxkVCMo5r9vHeNHyi_Ja07vjs,1953
21
- documente_shared/domain/entities/processing_case_item.py,sha256=VbVOqAUHtcCHfAF5VpG47IWkM8t6eSX4VuDifJe7ZzA,10108
22
+ documente_shared/domain/entities/processing_case_item.py,sha256=xmeN99qiGfVptIAs6t2DOksAJhkfnhzOaP9p5yiPR1s,10146
22
23
  documente_shared/domain/entities/processing_case_item_filters.py,sha256=R_AvDCB496Lww1qn2OwtltqULKE3IpcJB0ejnmRkg7Q,2009
23
24
  documente_shared/domain/entities/processing_documents.py,sha256=YYuTkdCNkqlO8cA0onJsZYtstxGt9M5NMuIO_87lB14,352
24
25
  documente_shared/domain/entities/processing_event.py,sha256=izdBXEz0TMNjxxZVjcM3YclzOv250JOV-amSpqmtQ9c,2180
@@ -54,6 +55,6 @@ documente_shared/infrastructure/services/http_scaling.py,sha256=cIo-61nfIwbtO86E
54
55
  documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
55
56
  documente_shared/presentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
57
  documente_shared/presentation/presenters.py,sha256=GGAEwefmjCIVepsUA2oZOVLxXbhhiISPM0Jgt6dT6O0,423
57
- documente_shared-0.1.104.dist-info/METADATA,sha256=GNOOWWV0lMU1B_D6PfrbouFMmtFwh0zXHOEc707xSeU,963
58
- documente_shared-0.1.104.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
59
- documente_shared-0.1.104.dist-info/RECORD,,
58
+ documente_shared-0.1.105.dist-info/METADATA,sha256=OcevFbclqyMWrlddbpe3VYcHa8pzTF46VxIBmu9Rqcg,963
59
+ documente_shared-0.1.105.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
60
+ documente_shared-0.1.105.dist-info/RECORD,,