documente_shared 0.1.65__tar.gz → 0.1.67__tar.gz

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.

Files changed (23) hide show
  1. {documente_shared-0.1.65 → documente_shared-0.1.67}/PKG-INFO +1 -1
  2. documente_shared-0.1.67/documente_shared/application/files.py +22 -0
  3. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/domain/entities/document.py +13 -4
  4. {documente_shared-0.1.65 → documente_shared-0.1.67}/pyproject.toml +1 -1
  5. {documente_shared-0.1.65 → documente_shared-0.1.67}/README.md +0 -0
  6. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/__init__.py +0 -0
  7. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/application/__init__.py +0 -0
  8. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/application/digest.py +0 -0
  9. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/application/exceptions.py +0 -0
  10. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/application/time_utils.py +0 -0
  11. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/application/timezone.py +0 -0
  12. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/domain/__init__.py +0 -0
  13. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/domain/base_enum.py +0 -0
  14. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/domain/constants.py +0 -0
  15. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/domain/entities/__init__.py +0 -0
  16. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/domain/entities/document_metadata.py +0 -0
  17. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/domain/enums.py +0 -0
  18. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/domain/repositories.py +0 -0
  19. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/infrastructure/__init__.py +0 -0
  20. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/infrastructure/dynamo_repositories.py +0 -0
  21. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/infrastructure/dynamo_table.py +0 -0
  22. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/infrastructure/s3_bucket.py +0 -0
  23. {documente_shared-0.1.65 → documente_shared-0.1.67}/documente_shared/infrastructure/sqs_queue.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.65
3
+ Version: 0.1.67
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -0,0 +1,22 @@
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
+ extension = extension.replace('.', '')
10
+ return folder_path, filename, extension
11
+
12
+
13
+ def get_filename_from_path(file_path: Optional[str]) -> Optional[str]:
14
+ if not file_path:
15
+ return None
16
+ return path.basename(file_path)
17
+
18
+
19
+ def remove_slash_from_path(file_path: str) -> str:
20
+ if file_path and file_path.startswith('/'):
21
+ return file_path[1:]
22
+ 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
  [tool.poetry]
2
2
  name = "documente_shared"
3
- version = "0.1.65"
3
+ version = "0.1.67"
4
4
  description = "Shared utilities for Documente AI projects"
5
5
  authors = ["Tech <tech@llamitai.com>"]
6
6
  license = "MIT"