documente_shared 0.1.112__py3-none-any.whl → 0.1.114__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.

@@ -14,6 +14,10 @@ def camelize_string(value: str) -> str:
14
14
  return value[:1].lower() + value[1:]
15
15
 
16
16
 
17
+ def parse_bool(input_value: bool) -> str:
18
+ return str(input_value).lower()
19
+
20
+
17
21
  @dataclass
18
22
  class QueryParams(object):
19
23
  params: Union[dict]
@@ -8,11 +8,11 @@ from documente_shared.domain.enums.document import DocumentProcessingStatus
8
8
  class DocumentProcessingRepository(ABC):
9
9
 
10
10
  @abstractmethod
11
- def find(self, digest: str) -> Optional[DocumentProcessing]:
11
+ def find(self, digest: str, read_bytes: bool = False) -> Optional[DocumentProcessing]:
12
12
  raise NotImplementedError
13
13
 
14
14
  @abstractmethod
15
- def persist(self, instance: DocumentProcessing) -> DocumentProcessing:
15
+ def persist(self, instance: DocumentProcessing, read_bytes: bool = False) -> DocumentProcessing:
16
16
  raise NotImplementedError
17
17
 
18
18
  @abstractmethod
@@ -17,7 +17,11 @@ class ProcessingCaseRepository(ABC):
17
17
  raise NotImplementedError
18
18
 
19
19
  @abstractmethod
20
- def persist(self, instance: ProcessingCase) -> ProcessingCase:
20
+ def persist(
21
+ self,
22
+ instance: ProcessingCase,
23
+ persist_items: bool = False,
24
+ ) -> ProcessingCase:
21
25
  raise NotImplementedError
22
26
 
23
27
  @abstractmethod
@@ -8,15 +8,27 @@ from documente_shared.domain.entities.processing_case_item_filters import Proces
8
8
  class ProcessingCaseItemRepository(ABC):
9
9
 
10
10
  @abstractmethod
11
- def find(self, uuid: str) -> Optional[ProcessingCaseItem]:
11
+ def find(
12
+ self,
13
+ uuid: str,
14
+ read_bytes: bool = False,
15
+ ) -> Optional[ProcessingCaseItem]:
12
16
  raise NotImplementedError
13
17
 
14
18
  @abstractmethod
15
- def find_by_digest(self, digest: str) -> Optional[ProcessingCaseItem]:
19
+ def find_by_digest(
20
+ self,
21
+ digest: str,
22
+ read_bytes: bool = False,
23
+ ) -> Optional[ProcessingCaseItem]:
16
24
  raise NotImplementedError
17
25
 
18
26
  @abstractmethod
19
- def persist(self, instance: ProcessingCaseItem) -> ProcessingCaseItem:
27
+ def persist(
28
+ self,
29
+ instance: ProcessingCaseItem,
30
+ read_bytes: bool = False,
31
+ ) -> ProcessingCaseItem:
20
32
  raise NotImplementedError
21
33
 
22
34
  @abstractmethod
@@ -24,7 +24,11 @@ class DynamoProcessingCaseRepository(
24
24
  return ProcessingCase.from_dict(item)
25
25
  return None
26
26
 
27
- def persist(self, instance: ProcessingCase) -> ProcessingCase:
27
+ def persist(
28
+ self,
29
+ instance: ProcessingCase,
30
+ persist_items: bool = False,
31
+ ) -> ProcessingCase:
28
32
  self.put(instance.to_persist_dict)
29
33
  return instance
30
34
 
@@ -13,19 +13,19 @@ class DynamoProcessingCaseItemRepository(
13
13
  DynamoDBTable,
14
14
  ProcessingCaseItemRepository,
15
15
  ):
16
- def find(self, uuid: str) -> Optional[ProcessingCaseItem]:
16
+ def find(self, uuid: str, read_bytes: bool = False) -> Optional[ProcessingCaseItem]:
17
17
  item = self.get(key={'digest': uuid})
18
18
  if item:
19
19
  return ProcessingCaseItem.from_dict(item)
20
20
  return None
21
21
 
22
- def find_by_digest(self, digest: str) -> Optional[ProcessingCaseItem]:
22
+ def find_by_digest(self, digest: str, read_bytes: bool = False) -> Optional[ProcessingCaseItem]:
23
23
  item = self.get(key={'digest': digest})
24
24
  if item:
25
25
  return ProcessingCaseItem.from_dict(item)
26
26
  return None
27
27
 
28
- def persist(self, instance: ProcessingCaseItem) -> ProcessingCaseItem:
28
+ def persist(self, instance: ProcessingCaseItem, read_bytes: bool = False) -> ProcessingCaseItem:
29
29
  self.put(instance.to_simple_dict)
30
30
  return instance
31
31
 
@@ -27,10 +27,15 @@ class HttpProcessingCaseRepository(
27
27
  return None
28
28
  return self._build_processing_case(response)
29
29
 
30
- def persist(self, instance: ProcessingCase) -> ProcessingCase:
30
+ def persist(
31
+ self,
32
+ instance: ProcessingCase,
33
+ persist_items: bool = False,
34
+ ) -> ProcessingCase:
35
+ _persist_items = 'true' if persist_items else 'false'
31
36
  logger.info(f"PERSISTING_PROCESSING_CASE: data={instance.to_dict}")
32
37
  response = self.session.put(
33
- url=f"{self.api_url}/v1/processing-cases/{instance.uuid}/",
38
+ url=f"{self.api_url}/v1/processing-cases/{instance.uuid}/?persist_items={_persist_items}",
34
39
  json=instance.to_dict,
35
40
  )
36
41
  if response.status_code not in [200, 201]:
@@ -5,6 +5,7 @@ from loguru import logger
5
5
  from requests import Response
6
6
 
7
7
  from documente_shared.application.payloads import camel_to_snake
8
+ from documente_shared.application.query_params import parse_bool
8
9
  from documente_shared.domain.entities.processing_case_item import ProcessingCaseItem
9
10
  from documente_shared.domain.entities.processing_case_item_filters import ProcessingCaseItemFilters
10
11
  from documente_shared.domain.repositories.processing_case_item import ProcessingCaseItemRepository
@@ -16,22 +17,26 @@ class HttpProcessingCaseItemRepository(
16
17
  DocumenteClientMixin,
17
18
  ProcessingCaseItemRepository,
18
19
  ):
19
- def find(self, uuid: str) -> Optional[ProcessingCaseItem]:
20
- response = self.session.get(f"{self.api_url}/v1/processing-case-items/{uuid}/")
20
+ def find(self, uuid: str, read_bytes: bool = False) -> Optional[ProcessingCaseItem]:
21
+ response = self.session.get(
22
+ url=f"{self.api_url}/v1/processing-case-items/{uuid}/?read_bytes={parse_bool(read_bytes)}",
23
+ )
21
24
  if response.status_code not in [200, 201]:
22
25
  return None
23
26
  return self._build_processing_case_item(response)
24
27
 
25
- def find_by_digest(self, digest: str) -> Optional[ProcessingCaseItem]:
26
- response = self.session.get(f"{self.api_url}/v1/processing-case-items/{digest}/")
28
+ def find_by_digest(self, digest: str, read_bytes: bool = False) -> Optional[ProcessingCaseItem]:
29
+ response = self.session.get(
30
+ url=f"{self.api_url}/v1/processing-case-items/{digest}/?read_bytes={parse_bool(read_bytes)}",
31
+ )
27
32
  if response.status_code not in [200, 201]:
28
33
  return None
29
34
  return self._build_processing_case_item(response)
30
35
 
31
- def persist(self, instance: ProcessingCaseItem) -> ProcessingCaseItem:
36
+ def persist(self, instance: ProcessingCaseItem, read_bytes: bool = False) -> ProcessingCaseItem:
32
37
  logger.info(f"PERSISTING_PROCESSING_CASE_ITEM: data={instance.to_simple_dict}")
33
38
  response: Response = self.session.put(
34
- url=f"{self.api_url}/v1/processing-case-items/{instance.uuid}/",
39
+ url=f"{self.api_url}/v1/processing-case-items/{instance.uuid}/?read_bytes={parse_bool(read_bytes)}",
35
40
  json=instance.to_persist_dict,
36
41
  )
37
42
  if response.status_code not in [200, 201]:
@@ -24,7 +24,11 @@ class MemoryProcessingCaseRepository(ProcessingCaseRepository):
24
24
  return self.collection[uuid]
25
25
  return None
26
26
 
27
- def persist(self, instance: ProcessingCase) -> ProcessingCase:
27
+ def persist(
28
+ self,
29
+ instance: ProcessingCase,
30
+ persist_items: bool = False,
31
+ ) -> ProcessingCase:
28
32
  self.collection[instance.uuid] = instance
29
33
  return instance
30
34
 
@@ -17,20 +17,28 @@ class MemoryProcessingCaseItemRepository(ProcessingCaseItemRepository):
17
17
  def find(
18
18
  self,
19
19
  uuid: str,
20
- include_items: bool = False,
20
+ read_items: bool = False,
21
21
  ) -> Optional[ProcessingCaseItem]:
22
22
  if uuid in self.collection:
23
23
  return self.collection[uuid]
24
24
  return None
25
25
 
26
- def find_by_digest(self, digest: str) -> Optional[ProcessingCaseItem]:
26
+ def find_by_digest(
27
+ self,
28
+ digest: str,
29
+ read_bytes: bool = False
30
+ ) -> Optional[ProcessingCaseItem]:
27
31
  for item in self.collection.values():
28
32
  if item.digest == digest:
29
33
  return item
30
34
  return None
31
35
 
32
36
 
33
- def persist(self, instance: ProcessingCaseItem) -> ProcessingCaseItem:
37
+ def persist(
38
+ self,
39
+ instance: ProcessingCaseItem,
40
+ read_bytes: bool = False,
41
+ ) -> ProcessingCaseItem:
34
42
  self.collection[instance.uuid] = instance
35
43
  return instance
36
44
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.112
3
+ Version: 0.1.114
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -7,7 +7,7 @@ documente_shared/application/files.py,sha256=_qkpeFPVmHyNhD6_PFZdzhyYvshJVeeSiwu
7
7
  documente_shared/application/json.py,sha256=5y67-DoiJlq_fLefgJ8YBVsdyua4KykxbSUKQqcwnnQ,1223
8
8
  documente_shared/application/numbers.py,sha256=rik1SqMxLzXNL2S5Yh1Q8CSONdcjjoCBnByFasxR4_Q,212
9
9
  documente_shared/application/payloads.py,sha256=s6SjaNN18_aQ6IL083Zq2J8thRCZ_zC2sn7hkfjK_Go,453
10
- documente_shared/application/query_params.py,sha256=JscPqFBx28p-x9i2g6waY7Yl4FQM1zn2zSbEoTrkK1k,3938
10
+ documente_shared/application/query_params.py,sha256=hsYmRghwk9pgmzPww08eu_KS8JhCMtek_bxxCQ478l0,4018
11
11
  documente_shared/application/time_utils.py,sha256=_fxgh8VoGPkdsft47COJ16vFwt8pMbHIJCgDFHLSlrU,435
12
12
  documente_shared/application/timezone.py,sha256=NHpzTzOPD_fWQiJ4BrRqt_TIDs5XyB5ZMR7x8vUk8gQ,183
13
13
  documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -32,29 +32,29 @@ documente_shared/domain/exceptions.py,sha256=S2xkkFPiR8jVmA6UhRb-bPVrm6JvohXw2MU
32
32
  documente_shared/domain/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  documente_shared/domain/interfaces/scaling.py,sha256=yWAud0rcLKMMf2-QxEE__GRpzqUY0H9_qxlQTfnRYmw,249
34
34
  documente_shared/domain/repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- documente_shared/domain/repositories/document.py,sha256=vJzr6c92gqBzyhaEdjrvnoneKRrWmJ0AsvocPnhxiLU,767
36
- documente_shared/domain/repositories/processing_case.py,sha256=sLmvqj2zAUGellRran9WYXbJjyuEtU56h9rklqkOdzY,852
37
- documente_shared/domain/repositories/processing_case_item.py,sha256=uBgJN2fJnZDcKUk018P_Fv25dQRZD5FBxFxsCQNaGAQ,948
35
+ documente_shared/domain/repositories/document.py,sha256=EZCbz8ManC1C2JcGuQQIJKON28AUAnUITZjy2zotRbY,819
36
+ documente_shared/domain/repositories/processing_case.py,sha256=ruML2bciJ-3RShl0e6Ca09OXGtslBsH89j96ctnRC6I,912
37
+ documente_shared/domain/repositories/processing_case_item.py,sha256=Q3h0C1sGkMn41cmtzOhyz0yKzHqTe1MXd_ts3c6UZwo,1119
38
38
  documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  documente_shared/infrastructure/documente_client.py,sha256=u6k73yIefuEkCsHULMpVCydFzrSXclf_5oQd2D7CkKU,698
40
40
  documente_shared/infrastructure/dynamo_table.py,sha256=TMQbcuty7wjDMbuhI8PbT0IGXelgELsNTtqTEQeZ824,2112
41
41
  documente_shared/infrastructure/lambdas.py,sha256=sGgkw7Mhvuq2TpbW_RNdf5JvQnuzxWYH6gPOVtQ4DtE,357
42
42
  documente_shared/infrastructure/repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  documente_shared/infrastructure/repositories/dynamo_document.py,sha256=_Yp4gtA-n-hJ2w2wAM5BMCs2Mf46Q2Kq3eHqlxudkL4,1443
44
- documente_shared/infrastructure/repositories/dynamo_processing_case.py,sha256=UV4IIJXolCasMUQAXlFJ18qxsCpL2seY5v8ZYMOvFj0,1520
45
- documente_shared/infrastructure/repositories/dynamo_processing_case_item.py,sha256=B2ElsASpXNRkwwjdCqXyvDU-LBrLNdwPfHLMvvG9c-Y,1729
44
+ documente_shared/infrastructure/repositories/dynamo_processing_case.py,sha256=n99X6OGTG5bHtIJY_1Z9HqabgWz-jbFXnQeqzeas7R8,1580
45
+ documente_shared/infrastructure/repositories/dynamo_processing_case_item.py,sha256=tKmJl_bSZoQ8jrAbXHlv8f3JILgvxse4H-89A-FAMRQ,1807
46
46
  documente_shared/infrastructure/repositories/http_document.py,sha256=TQdjKmly1m0L26_ksq9ce0_jv5NxtXvN8AT3Zd06yCE,2289
47
- documente_shared/infrastructure/repositories/http_processing_case.py,sha256=J9aUgUI1xTysQEbM8K1LepVpzgQU8RlvJn56jVa-l-E,2430
48
- documente_shared/infrastructure/repositories/http_processing_case_item.py,sha256=rztS_5oE2VDN9LOUATrjCuiKBkxmIwKAakp9AFo8Obc,3185
47
+ documente_shared/infrastructure/repositories/http_processing_case.py,sha256=E4Rw2rBnwZl9a4GFlPddFSZO3ScwAe6UudLQiBryTYY,2583
48
+ documente_shared/infrastructure/repositories/http_processing_case_item.py,sha256=vwzFCSwcWQd80YRXD6ewkfBdakY0Xf-dQyOux-5aIDY,3490
49
49
  documente_shared/infrastructure/repositories/mem_document.py,sha256=jg4rIjgSZijymjY9o7Q1lLcaiW9h-O8j6XljO1bJI7c,1299
50
- documente_shared/infrastructure/repositories/mem_processing_case.py,sha256=WgOPednF0rpz7g9AIUExmRfGSAWRBBgbqH_bg0jp4-c,1190
51
- documente_shared/infrastructure/repositories/mem_processing_case_item.py,sha256=kQufzDTouu3agIXpEzRPdjltjTUFExrFbKkAZarGrUg,1419
50
+ documente_shared/infrastructure/repositories/mem_processing_case.py,sha256=59ZHCU32fu7MMvLvhxFfG7sKmJQ1R0449WVoTtfzpqY,1250
51
+ documente_shared/infrastructure/repositories/mem_processing_case_item.py,sha256=MShKyXrbwa1NOXhFPGsCieL7j2VhNg7cBLN77Kz7CJk,1529
52
52
  documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
53
53
  documente_shared/infrastructure/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  documente_shared/infrastructure/services/http_scaling.py,sha256=cIo-61nfIwbtO86EGi5r1tFi9g3VJXldhguddt4JUyc,906
55
55
  documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
56
56
  documente_shared/presentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  documente_shared/presentation/presenters.py,sha256=GGAEwefmjCIVepsUA2oZOVLxXbhhiISPM0Jgt6dT6O0,423
58
- documente_shared-0.1.112.dist-info/METADATA,sha256=kOijsDEs6Frxgtc95ms9lkfn1dxkVIYBa71-qnigBQ4,963
59
- documente_shared-0.1.112.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
60
- documente_shared-0.1.112.dist-info/RECORD,,
58
+ documente_shared-0.1.114.dist-info/METADATA,sha256=SEWBIouYqhb6waZP9rR6KYzxXlm39tPlBMrN2cjZBgY,963
59
+ documente_shared-0.1.114.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
60
+ documente_shared-0.1.114.dist-info/RECORD,,