agi-med-common 3.5.7__py3-none-any.whl → 3.5.8__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 +6 -2
- {agi_med_common-3.5.7.dist-info → agi_med_common-3.5.8.dist-info}/METADATA +1 -1
- {agi_med_common-3.5.7.dist-info → agi_med_common-3.5.8.dist-info}/RECORD +6 -6
- {agi_med_common-3.5.7.dist-info → agi_med_common-3.5.8.dist-info}/WHEEL +0 -0
- {agi_med_common-3.5.7.dist-info → agi_med_common-3.5.8.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
agi_med_common/file_storage.py
CHANGED
@@ -24,11 +24,15 @@ class FileStorage:
|
|
24
24
|
self.files_dir.mkdir(exist_ok=True)
|
25
25
|
_validate_exist(self.files_dir)
|
26
26
|
|
27
|
-
def
|
28
|
-
_validate_dtype(dtype)
|
27
|
+
def _generate_fname_path(self, content, dtype):
|
29
28
|
fname_hash = md5(content).hexdigest()
|
30
29
|
fname = f'{fname_hash}.{dtype}'
|
31
30
|
fpath = self.files_dir / fname
|
31
|
+
return fpath
|
32
|
+
|
33
|
+
def upload(self, content: bytes, dtype: str) -> ResourceId | None:
|
34
|
+
_validate_dtype(dtype)
|
35
|
+
fpath = self._generate_fname_path(content, dtype)
|
32
36
|
fpath.write_bytes(content)
|
33
37
|
return str(fpath)
|
34
38
|
|
@@ -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=yAMlhMYxrwmdrO-UvtUprWxYN8cbVAM9Mu5nljTmvcM,536
|
2
|
+
agi_med_common/file_storage.py,sha256=GR6_jKZ0o9uwUkOKZd1XaCVOSw0YmFlCOlC6EX8zz0I,1247
|
3
3
|
agi_med_common/utils.py,sha256=5iurKl5d1zZ_cN4yqtc0_FhrwuNBcDurbWilu28_saE,325
|
4
4
|
agi_med_common/validators.py,sha256=R678gjPp-5XbnocRuEtdOQgJyCCOurxwaOe2nT04kSg,705
|
5
5
|
agi_med_common/xml_parser.py,sha256=VvLIX_XCZao9i0qqpTVx8nx0vbFXSe8pEbdJdXnj97g,568
|
@@ -24,7 +24,7 @@ agi_med_common/models/enums/mtrs_label_enum.py,sha256=6emBndt3SCsQVZZFKQYCV2_iyj
|
|
24
24
|
agi_med_common/models/enums/mtrs_xml_tag_enum.py,sha256=6OxuRsrx4b2uBjfrBgm4Y789Ly337_mQXL9VPRCpLyg,273
|
25
25
|
agi_med_common/models/enums/state_enum.py,sha256=p7XhDxBxPeeSgbLWitq6JpJLKntS3XMHon_EevbnhEs,163
|
26
26
|
agi_med_common/models/enums/track_id_enum.py,sha256=KM4DbJ6fzK4xPSghKBaTdAhz_SlTSLxJvnKJoMjc9QE,501
|
27
|
-
agi_med_common-3.5.
|
28
|
-
agi_med_common-3.5.
|
29
|
-
agi_med_common-3.5.
|
30
|
-
agi_med_common-3.5.
|
27
|
+
agi_med_common-3.5.8.dist-info/METADATA,sha256=5-cU5faZ27iscWVGRDA-nsZcc6CuD0X_7_zivgXAWQM,520
|
28
|
+
agi_med_common-3.5.8.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
29
|
+
agi_med_common-3.5.8.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
30
|
+
agi_med_common-3.5.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|