documente_shared 0.1.96__py3-none-any.whl → 0.1.97__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,37 @@
1
+ from dataclasses import dataclass
2
+ from typing import List, Optional
3
+
4
+ from documente_shared.domain.entities.document import DocumentProcessing
5
+ from documente_shared.domain.enums.document import DocumentProcessingStatus
6
+ from documente_shared.domain.repositories.document import DocumentProcessingRepository
7
+
8
+
9
+ @dataclass
10
+ class MemoryDocumentProcessingRepository(DocumentProcessingRepository):
11
+ collection: dict[str, DocumentProcessing] = None
12
+
13
+ def __post_init__(self):
14
+ self.collection = self.collection or {}
15
+
16
+ def find(self, digest: str) -> Optional[DocumentProcessing]:
17
+ if digest in self.collection:
18
+ return self.collection[digest]
19
+ return None
20
+
21
+
22
+ def persist(self, instance: DocumentProcessing) -> DocumentProcessing:
23
+ self.collection[instance.digest] = instance
24
+ return instance
25
+
26
+ def remove(self, instance: DocumentProcessing):
27
+ if instance.digest in self.collection:
28
+ del self.collection[instance.digest]
29
+ return None
30
+
31
+ def filter(self, statuses: List[DocumentProcessingStatus]) -> List[DocumentProcessing]:
32
+ items = []
33
+ for status in statuses:
34
+ items.extend(
35
+ [item for item in self.collection.values() if item.status == status]
36
+ )
37
+ return items
@@ -0,0 +1,36 @@
1
+ from dataclasses import dataclass
2
+ from typing import List, Optional
3
+
4
+ from documente_shared.domain.entities.processing_case import ProcessingCase
5
+ from documente_shared.domain.entities.processing_case_filters import ProcessingCaseFilters
6
+
7
+ from documente_shared.domain.repositories.processing_case import ProcessingCaseRepository
8
+
9
+
10
+ @dataclass
11
+ class MemoryProcessingCaseRepository(ProcessingCaseRepository):
12
+ collection: dict[str, ProcessingCase] = None
13
+
14
+ def __post_init__(self):
15
+ self.collection = self.collection or {}
16
+
17
+ def find(
18
+ self,
19
+ uuid: str,
20
+ include_items: bool = False,
21
+ ) -> Optional[ProcessingCase]:
22
+ if uuid in self.collection:
23
+ return self.collection[uuid]
24
+ return None
25
+
26
+ def persist(self, instance: ProcessingCase) -> ProcessingCase:
27
+ self.collection[instance.uuid] = instance
28
+ return instance
29
+
30
+ def remove(self, instance: ProcessingCase):
31
+ if instance.uuid in self.collection:
32
+ del self.collection[instance.uuid]
33
+ return None
34
+
35
+ def filter(self, filters: ProcessingCaseFilters) -> List[ProcessingCase]:
36
+ return []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.96
3
+ Version: 0.1.97
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -42,12 +42,14 @@ documente_shared/infrastructure/repositories/dynamo_processing_case_item.py,sha2
42
42
  documente_shared/infrastructure/repositories/http_document_processing.py,sha256=7n4lHgpN17CCr4_Dz9WRbsXeb4FDMJZNDUshFipA1B8,2179
43
43
  documente_shared/infrastructure/repositories/http_processing_case.py,sha256=n1NXJtROTfet2QCKSNnQtLmcNgkJDo6q0Hq48FSpwEU,2249
44
44
  documente_shared/infrastructure/repositories/http_processing_case_item.py,sha256=idciRUH3LGbD13TS6BlEpCpC-lWKqf1MssmjcdR3CKU,2971
45
+ documente_shared/infrastructure/repositories/mem_document.py,sha256=jg4rIjgSZijymjY9o7Q1lLcaiW9h-O8j6XljO1bJI7c,1299
46
+ documente_shared/infrastructure/repositories/mem_processing_case.py,sha256=ZAQwp4j0DXQMt92Z-ZR4h9MtbUp9IYy0OHz_sHgkZxY,1147
45
47
  documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
46
48
  documente_shared/infrastructure/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
49
  documente_shared/infrastructure/services/http_scaling.py,sha256=cIo-61nfIwbtO86EGi5r1tFi9g3VJXldhguddt4JUyc,906
48
50
  documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
49
51
  documente_shared/presentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
52
  documente_shared/presentation/presenters.py,sha256=GGAEwefmjCIVepsUA2oZOVLxXbhhiISPM0Jgt6dT6O0,423
51
- documente_shared-0.1.96.dist-info/METADATA,sha256=nWhol-EMMx-ilLt_ga76hGdF5bdlDsc4V0_8GcZSahU,920
52
- documente_shared-0.1.96.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
53
- documente_shared-0.1.96.dist-info/RECORD,,
53
+ documente_shared-0.1.97.dist-info/METADATA,sha256=bjl1H8EBDJcpKmzDZK77_hMeymmfZXmI0UagBzqG0Hc,920
54
+ documente_shared-0.1.97.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
55
+ documente_shared-0.1.97.dist-info/RECORD,,