documente_shared 0.1.20__py3-none-any.whl → 0.1.22__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.
- documente_shared/application/time_utils.py +10 -0
- documente_shared/domain/entities.py +11 -21
- {documente_shared-0.1.20.dist-info → documente_shared-0.1.22.dist-info}/METADATA +1 -1
- {documente_shared-0.1.20.dist-info → documente_shared-0.1.22.dist-info}/RECORD +5 -4
- {documente_shared-0.1.20.dist-info → documente_shared-0.1.22.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Union
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def get_datetime_from_data(input_datetime: Union[datetime, str]):
|
|
6
|
+
if isinstance(input_datetime, datetime):
|
|
7
|
+
return input_datetime
|
|
8
|
+
elif isinstance(input_datetime, str):
|
|
9
|
+
return datetime.fromisoformat(input_datetime)
|
|
10
|
+
return None
|
|
@@ -3,6 +3,7 @@ from datetime import datetime
|
|
|
3
3
|
from decimal import Decimal
|
|
4
4
|
from typing import Optional, List
|
|
5
5
|
|
|
6
|
+
from documente_shared.application.time_utils import get_datetime_from_data
|
|
6
7
|
from documente_shared.domain.enums import (
|
|
7
8
|
DocumentProcessStatus,
|
|
8
9
|
DocumentProcessSubCategory,
|
|
@@ -76,9 +77,13 @@ class DocumentProcess(object):
|
|
|
76
77
|
def deleted(self):
|
|
77
78
|
self.status = DocumentProcessStatus.DELETED
|
|
78
79
|
|
|
80
|
+
@property
|
|
81
|
+
def extended_filename(self) -> str:
|
|
82
|
+
return self.file_path.split('/')[-1]
|
|
83
|
+
|
|
79
84
|
@property
|
|
80
85
|
def filename(self) -> str:
|
|
81
|
-
filename_with_extension = self.
|
|
86
|
+
filename_with_extension = self.extended_filename
|
|
82
87
|
return filename_with_extension.split('.')[0]
|
|
83
88
|
|
|
84
89
|
@property
|
|
@@ -146,24 +151,9 @@ class DocumentProcess(object):
|
|
|
146
151
|
Decimal(data.get('processing_time'))
|
|
147
152
|
if data.get('processing_time') else None
|
|
148
153
|
),
|
|
149
|
-
uploaded_at=(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
),
|
|
153
|
-
|
|
154
|
-
datetime.fromisoformat(data.get('enqueued_at'))
|
|
155
|
-
if data.get('enqueued_at') else None
|
|
156
|
-
),
|
|
157
|
-
started_at=(
|
|
158
|
-
datetime.fromisoformat(data.get('started_at'))
|
|
159
|
-
if data.get('started_at') else None
|
|
160
|
-
),
|
|
161
|
-
failed_at=(
|
|
162
|
-
datetime.fromisoformat(data.get('failed_at'))
|
|
163
|
-
if data.get('failed_at') else None
|
|
164
|
-
),
|
|
165
|
-
completed_at=(
|
|
166
|
-
datetime.fromisoformat(data.get('completed_at'))
|
|
167
|
-
if data.get('processed_at') else None
|
|
168
|
-
),
|
|
154
|
+
uploaded_at=get_datetime_from_data(input_datetime=data.get('uploaded_at')),
|
|
155
|
+
enqueued_at=get_datetime_from_data(input_datetime=data.get('enqueued_at')),
|
|
156
|
+
started_at=get_datetime_from_data(input_datetime=data.get('started_at')),
|
|
157
|
+
failed_at=get_datetime_from_data(input_datetime=data.get('failed_at')),
|
|
158
|
+
completed_at=get_datetime_from_data(input_datetime=data.get('completed_at')),
|
|
169
159
|
)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
documente_shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
documente_shared/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
documente_shared/application/digest.py,sha256=Um6E8WfFri2_lly4RFWydJyvSfPZGFcOX-opEOzDCWc,172
|
|
4
|
+
documente_shared/application/time_utils.py,sha256=XDH27cKgoTFO8ad1JgrxKaeT7sZ1fduuJqLkvHUjy-Q,309
|
|
4
5
|
documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
6
|
documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
|
|
6
|
-
documente_shared/domain/entities.py,sha256=
|
|
7
|
+
documente_shared/domain/entities.py,sha256=OhOBlcVzAFFE5xr49wt1NGQtSlChxTkVs9J259gkjhU,5744
|
|
7
8
|
documente_shared/domain/enums.py,sha256=wrMpM-1KgXFkd-He-3onNcqR3Zf53Q-_axjXGjx7MIY,435
|
|
8
9
|
documente_shared/domain/repositories.py,sha256=EekvB2BE4AnT5myEhU3DfwHfF9MkNJZRbqRVGFxCEWM,509
|
|
9
10
|
documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -11,6 +12,6 @@ documente_shared/infrastructure/dynamo_repositories.py,sha256=A26S6ghyAsjKk8ySXI
|
|
|
11
12
|
documente_shared/infrastructure/dynamo_table.py,sha256=5yF5EVQkHTZe4tLYZsfEDS8tp_iorMlMjNu-qn3Oj9E,2095
|
|
12
13
|
documente_shared/infrastructure/s3_bucket.py,sha256=s4VWcl0HK6uhjjZmKefOYW5A3Dx74R9KCuMmXQKUXnQ,1582
|
|
13
14
|
documente_shared/infrastructure/sqs_queue.py,sha256=PSiTAnjXvQ-W-9mzLpH2UjbQJTvYkMiaxNaMecF-cR4,1505
|
|
14
|
-
documente_shared-0.1.
|
|
15
|
-
documente_shared-0.1.
|
|
16
|
-
documente_shared-0.1.
|
|
15
|
+
documente_shared-0.1.22.dist-info/METADATA,sha256=J6vnvWyBnaC50_rF43TH-NgVeiizQ4XNNIZ5kP7ss6U,640
|
|
16
|
+
documente_shared-0.1.22.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
17
|
+
documente_shared-0.1.22.dist-info/RECORD,,
|
|
File without changes
|