agi-med-common 4.0.3__py3-none-any.whl → 4.0.5__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.
- agi_med_common/__init__.py +1 -1
- agi_med_common/file_storage.py +11 -1
- {agi_med_common-4.0.3.dist-info → agi_med_common-4.0.5.dist-info}/METADATA +1 -1
- {agi_med_common-4.0.3.dist-info → agi_med_common-4.0.5.dist-info}/RECORD +6 -6
- {agi_med_common-4.0.3.dist-info → agi_med_common-4.0.5.dist-info}/WHEEL +1 -1
- {agi_med_common-4.0.3.dist-info → agi_med_common-4.0.5.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
agi_med_common/file_storage.py
CHANGED
@@ -21,7 +21,7 @@ def _validate_dtype(dtype: str):
|
|
21
21
|
class FileStorage:
|
22
22
|
def __init__(self, files_dir):
|
23
23
|
self.files_dir = Path(files_dir)
|
24
|
-
self.files_dir.mkdir(exist_ok=True)
|
24
|
+
self.files_dir.mkdir(exist_ok=True, parents=True)
|
25
25
|
_validate_exist(self.files_dir)
|
26
26
|
|
27
27
|
def _generate_fname_path(self, content, dtype):
|
@@ -30,6 +30,16 @@ class FileStorage:
|
|
30
30
|
fpath = self.files_dir / fname
|
31
31
|
return fpath
|
32
32
|
|
33
|
+
def upload_maybe(
|
34
|
+
self,
|
35
|
+
content: bytes | None,
|
36
|
+
dtype: str,
|
37
|
+
) -> ResourceId | None:
|
38
|
+
if not content:
|
39
|
+
return None
|
40
|
+
resource_id = self.file_storage.upload(content, dtype)
|
41
|
+
return resource_id
|
42
|
+
|
33
43
|
def upload(self, content: bytes, dtype: str) -> ResourceId | None:
|
34
44
|
_validate_dtype(dtype)
|
35
45
|
fpath = self._generate_fname_path(content, dtype)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
agi_med_common/__init__.py,sha256=
|
2
|
-
agi_med_common/file_storage.py,sha256=
|
1
|
+
agi_med_common/__init__.py,sha256=mOMk9BlqR11o4ZL3ul69Zyn6AgIbkCaur_t0AIOPJ-Q,575
|
2
|
+
agi_med_common/file_storage.py,sha256=ZMjC8wChL7Inu80Fl898GQON9Gh-XSnrRUbXzAUHN_M,1515
|
3
3
|
agi_med_common/parallel_map.py,sha256=Qx6xe7DqlEUDpSucp5Hm8r9y9Iquwh9JvX7lOqHhnOw,921
|
4
4
|
agi_med_common/utils.py,sha256=5iurKl5d1zZ_cN4yqtc0_FhrwuNBcDurbWilu28_saE,325
|
5
5
|
agi_med_common/validators.py,sha256=R678gjPp-5XbnocRuEtdOQgJyCCOurxwaOe2nT04kSg,705
|
@@ -23,7 +23,7 @@ agi_med_common/models/enums/moderation_label_enum.py,sha256=lbGG4Pu7cQp57uEyQEpt
|
|
23
23
|
agi_med_common/models/enums/mtrs_label_enum.py,sha256=6emBndt3SCsQVZZFKQYCV2_iyjjmZEhwejJKJu39ZAw,257
|
24
24
|
agi_med_common/models/enums/mtrs_xml_tag_enum.py,sha256=6OxuRsrx4b2uBjfrBgm4Y789Ly337_mQXL9VPRCpLyg,273
|
25
25
|
agi_med_common/models/enums/track_id_enum.py,sha256=N3KUd97a4xDet_NKZ5URm0qWAAv3ts1l_foOjdlGY4c,532
|
26
|
-
agi_med_common-4.0.
|
27
|
-
agi_med_common-4.0.
|
28
|
-
agi_med_common-4.0.
|
29
|
-
agi_med_common-4.0.
|
26
|
+
agi_med_common-4.0.5.dist-info/METADATA,sha256=C5ydvsvgmCg0PJiRvu6zC_9P5AHd0dto8IKukvEit6s,546
|
27
|
+
agi_med_common-4.0.5.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
28
|
+
agi_med_common-4.0.5.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
29
|
+
agi_med_common-4.0.5.dist-info/RECORD,,
|
File without changes
|