documente_shared 0.1.65__py3-none-any.whl → 0.1.66__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,21 @@
1
+ from os import path
2
+ from typing import Tuple, Optional
3
+
4
+
5
+ def split_file_params(filepath: str) -> Tuple[str, str, str]:
6
+ folder_path = path.dirname(filepath)
7
+ filename = path.splitext(path.basename(filepath))[0]
8
+ extension = path.splitext(filepath)[1]
9
+ return folder_path, filename, extension
10
+
11
+
12
+ def get_filename_from_path(file_path: Optional[str]) -> Optional[str]:
13
+ if not file_path:
14
+ return None
15
+ return path.basename(file_path)
16
+
17
+
18
+ def remove_slash_from_path(file_path: str) -> str:
19
+ if file_path and file_path.startswith('/'):
20
+ return file_path[1:]
21
+ return file_path
@@ -4,6 +4,7 @@ from datetime import datetime, tzinfo
4
4
  from decimal import Decimal
5
5
  from typing import Optional, List
6
6
 
7
+ from documente_shared.application.files import remove_slash_from_path, split_file_params, get_filename_from_path
7
8
  from documente_shared.application.time_utils import get_datetime_from_data
8
9
  from documente_shared.domain.constants import la_paz_tz
9
10
  from documente_shared.domain.entities.document_metadata import DocumentProcessingMetadata
@@ -14,10 +15,6 @@ from documente_shared.domain.enums import (
14
15
  )
15
16
 
16
17
 
17
- def remove_slash_from_path(path: str) -> str:
18
- if path and path.startswith('/'):
19
- return path[1:]
20
- return path
21
18
 
22
19
 
23
20
  @dataclass
@@ -111,6 +108,18 @@ class DocumentProcessing(object):
111
108
  def processed_json_key(self) -> str:
112
109
  return remove_slash_from_path(self.processed_json_path)
113
110
 
111
+ @property
112
+ def processed_csv_filename(self) -> str:
113
+ return get_filename_from_path(self.processed_csv_path)
114
+
115
+ @property
116
+ def processed_xlsx_filename(self) -> str:
117
+ return get_filename_from_path(self.processed_xlsx_path)
118
+
119
+ @property
120
+ def processed_json_filename(self) -> str:
121
+ return get_filename_from_path(self.processed_json_path)
122
+
114
123
  @property
115
124
  def processed_metadata_key(self) -> str:
116
125
  return remove_slash_from_path(self.processed_metadata_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.65
3
+ Version: 0.1.66
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -2,13 +2,14 @@ documente_shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
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
4
  documente_shared/application/exceptions.py,sha256=lQM8m7wmI9OTLGva0gd7s7YT7ldaTk_Ln4t32PpzNf8,654
5
+ documente_shared/application/files.py,sha256=gd5An-mnCbyN2h76J9IVfnWTeg81B6X4QirrB2oKOQ4,606
5
6
  documente_shared/application/time_utils.py,sha256=_fxgh8VoGPkdsft47COJ16vFwt8pMbHIJCgDFHLSlrU,435
6
7
  documente_shared/application/timezone.py,sha256=NHpzTzOPD_fWQiJ4BrRqt_TIDs5XyB5ZMR7x8vUk8gQ,183
7
8
  documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
9
  documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
9
10
  documente_shared/domain/constants.py,sha256=jOlMKFq12FgiYMJcQHku8IVwuOE5t-HEPuSV_zEeIFo,56
10
11
  documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- documente_shared/domain/entities/document.py,sha256=_lkPGyG0suhpHmFrEYepvwIJaTMkEc-HOP5RJF-57Qo,12241
12
+ documente_shared/domain/entities/document.py,sha256=kaLuVJ-LVQMUdQhCReQ2Mkl7-Kmws6-TNxKnlXogYSk,12603
12
13
  documente_shared/domain/entities/document_metadata.py,sha256=ygyFIC5qwxlm8DUM5kvVFny9zJfPQS8vNLM2br5XsQ8,2353
13
14
  documente_shared/domain/enums.py,sha256=NltZA1YVgJ7dVfSQdJFIE0ZUGf9Y-nxNXsVQ6GiPLL4,1827
14
15
  documente_shared/domain/repositories.py,sha256=g3qLUy2kT8esmvU4VxxSVnDaXeySKKQ7mUvIvxOwh9A,757
@@ -17,6 +18,6 @@ documente_shared/infrastructure/dynamo_repositories.py,sha256=SEad_HLppp2h_BKDSz
17
18
  documente_shared/infrastructure/dynamo_table.py,sha256=dK05KgFvIYCmOdMpq9-OV_OBrP6cCngiUikCJrxlwt4,2112
18
19
  documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
19
20
  documente_shared/infrastructure/sqs_queue.py,sha256=PSiTAnjXvQ-W-9mzLpH2UjbQJTvYkMiaxNaMecF-cR4,1505
20
- documente_shared-0.1.65.dist-info/METADATA,sha256=K_Mif0a5T44Otpjqz5qK2gFmn0NWyTs1uuj29N8H-3o,800
21
- documente_shared-0.1.65.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
22
- documente_shared-0.1.65.dist-info/RECORD,,
21
+ documente_shared-0.1.66.dist-info/METADATA,sha256=gc3T4gSaIhMkxipJXnYcuJI6PvSqOWgBm4_hPYXe0m4,800
22
+ documente_shared-0.1.66.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
23
+ documente_shared-0.1.66.dist-info/RECORD,,