fiuai-s3 0.3.8__py3-none-any.whl → 0.4.1__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 fiuai-s3 might be problematic. Click here for more details.
- fiuai_s3/__init__.py +1 -1
- fiuai_s3/minio/minio_storage.py +6 -12
- fiuai_s3/object_storage.py +1 -3
- {fiuai_s3-0.3.8.dist-info → fiuai_s3-0.4.1.dist-info}/METADATA +1 -1
- fiuai_s3-0.4.1.dist-info/RECORD +11 -0
- fiuai_s3-0.3.8.dist-info/RECORD +0 -11
- {fiuai_s3-0.3.8.dist-info → fiuai_s3-0.4.1.dist-info}/WHEEL +0 -0
- {fiuai_s3-0.3.8.dist-info → fiuai_s3-0.4.1.dist-info}/licenses/LICENSE +0 -0
fiuai_s3/__init__.py
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
from .object_storage import ObjectStorage, ObjectStorageFactory, StorageConfig
|
|
9
9
|
from .type import DocFileObject, DocSourceFrom, DocFileType
|
|
10
10
|
|
|
11
|
-
__version__ = "0.3.
|
|
11
|
+
__version__ = "0.3.9"
|
|
12
12
|
__all__ = ["ObjectStorage", "ObjectStorageFactory", "StorageConfig", "DocFileObject", "DocSourceFrom", "DocFileType"]
|
fiuai_s3/minio/minio_storage.py
CHANGED
|
@@ -12,7 +12,7 @@ from minio import Minio
|
|
|
12
12
|
from minio.error import S3Error
|
|
13
13
|
from minio.commonconfig import Tags
|
|
14
14
|
from ..object_storage import ObjectStorage, StorageConfig
|
|
15
|
-
from ..type import DocFileObject
|
|
15
|
+
from ..type import DocFileObject
|
|
16
16
|
|
|
17
17
|
logger = logging.getLogger(__name__)
|
|
18
18
|
|
|
@@ -78,7 +78,7 @@ class MinioStorage(ObjectStorage):
|
|
|
78
78
|
object_key: 对象存储中的key
|
|
79
79
|
tmppath: 临时文件路径, 如果为空,则使用默认临时目录
|
|
80
80
|
"""
|
|
81
|
-
_path = f"{self.config.temp_dir}/{object_key}" if not tmppath else f"{tmppath}/{object_key}"
|
|
81
|
+
_path = f"{self.config.temp_dir}/{object_key}" if not tmppath else f"{tmppath.rstrip('/')}/{object_key}"
|
|
82
82
|
return self.upload_file(_path, data)
|
|
83
83
|
|
|
84
84
|
def download_temp_file(self, object_key: str, tmppath: str = None) -> bool:
|
|
@@ -88,7 +88,7 @@ class MinioStorage(ObjectStorage):
|
|
|
88
88
|
object_key: 对象存储中的key
|
|
89
89
|
tmppath: 临时文件路径, 如果为空,则使用默认临时目录
|
|
90
90
|
"""
|
|
91
|
-
_path = f"{self.config.temp_dir}/{object_key}" if not tmppath else f"{tmppath}/{object_key}"
|
|
91
|
+
_path = f"{self.config.temp_dir}/{object_key}" if not tmppath else f"{tmppath.rstrip('/')}/{object_key}"
|
|
92
92
|
return self.download_file(_path)
|
|
93
93
|
|
|
94
94
|
def upload_file(self, object_key: str, data: bytes) -> bool:
|
|
@@ -186,8 +186,6 @@ class MinioStorage(ObjectStorage):
|
|
|
186
186
|
def upload_doc_file(self,
|
|
187
187
|
filename: str,
|
|
188
188
|
data: bytes,
|
|
189
|
-
doc_source_from: Optional[DocSourceFrom] = None,
|
|
190
|
-
doc_file_type: Optional[DocFileType] = None,
|
|
191
189
|
tags: Optional[Dict[str, str]] = None,
|
|
192
190
|
auth_tenant_id: Optional[str] = None,
|
|
193
191
|
auth_company_id: Optional[str] = None,
|
|
@@ -199,13 +197,9 @@ class MinioStorage(ObjectStorage):
|
|
|
199
197
|
object_key = self._build_doc_path(filename, auth_tenant_id, auth_company_id, doc_id)
|
|
200
198
|
# 将tags转换为Tags对象
|
|
201
199
|
tags_obj = Tags()
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
doc_source_from = doc_source_from if doc_source_from else DocSourceFrom.OTHER
|
|
206
|
-
doc_file_type = doc_file_type if doc_file_type else DocFileType.OTHER
|
|
207
|
-
tags_obj["doc_source_from"] = doc_source_from.value
|
|
208
|
-
tags_obj["doc_file_type"] = doc_file_type.value
|
|
200
|
+
if tags:
|
|
201
|
+
for k, v in tags.items():
|
|
202
|
+
tags_obj[k] = v
|
|
209
203
|
|
|
210
204
|
self.client.put_object(
|
|
211
205
|
bucket_name=self.bucket_name,
|
fiuai_s3/object_storage.py
CHANGED
|
@@ -120,8 +120,6 @@ class ObjectStorage(ABC):
|
|
|
120
120
|
def upload_doc_file(self,
|
|
121
121
|
filename: str,
|
|
122
122
|
data: bytes,
|
|
123
|
-
doc_source_from: Optional[DocSourceFrom] = None,
|
|
124
|
-
doc_file_type: Optional[DocFileType] = None,
|
|
125
123
|
tags: Optional[Dict[str, str]] = None,
|
|
126
124
|
auth_tenant_id: Optional[str] = None, auth_company_id: Optional[str] = None, doc_id: Optional[str] = None) -> bool:
|
|
127
125
|
"""
|
|
@@ -197,7 +195,7 @@ class ObjectStorageFactory:
|
|
|
197
195
|
endpoint=endpoint,
|
|
198
196
|
access_key=access_key,
|
|
199
197
|
secret_key=secret_key,
|
|
200
|
-
temp_dir=temp_dir,
|
|
198
|
+
temp_dir=temp_dir.rstrip("/").lstrip("/"),
|
|
201
199
|
use_https=use_https
|
|
202
200
|
)
|
|
203
201
|
cls._instance = None
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
fiuai_s3/__init__.py,sha256=tLlqnMEl4K7R4jg2GbvGZanRsis1vm7KFKSc5R_wRUE,421
|
|
2
|
+
fiuai_s3/object_storage.py,sha256=jbXQJ8SBZNMoLQz4OXs6vWwY1cVON2d_5a3LolzcqD8,9335
|
|
3
|
+
fiuai_s3/type.py,sha256=L1h3SQh7_NhWfjWPa1MMgGoxM7g6wQF26qg5WsERt6U,981
|
|
4
|
+
fiuai_s3/alicloud/__init__.py,sha256=mmrCrFp5DzRF5fViJDq7_LpsqCViwTPXOPz4qoaSscI,218
|
|
5
|
+
fiuai_s3/alicloud/alicloud_storage.py,sha256=d24AFYDs7RsTsfL9IiVOxYlGyLzsaUa_WUYD5VPLP4s,6035
|
|
6
|
+
fiuai_s3/minio/__init__.py,sha256=hOmpUkTq8TPgYOxfeOMcWq1_YsJ2r8Zf9VTX3w_v1Lk,209
|
|
7
|
+
fiuai_s3/minio/minio_storage.py,sha256=k0IKpifeUP8JwfDCry0yuFTzrnaHA9ZWYQToNhGS99s,9563
|
|
8
|
+
fiuai_s3-0.4.1.dist-info/METADATA,sha256=0ye44O-YuXc3ZCwvvUBRDQdr7f-owyyp3FHQLaa5Yf4,18727
|
|
9
|
+
fiuai_s3-0.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
+
fiuai_s3-0.4.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
11
|
+
fiuai_s3-0.4.1.dist-info/RECORD,,
|
fiuai_s3-0.3.8.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
fiuai_s3/__init__.py,sha256=jsG1aylQ_FnU7hVXkD9gLW0wmyYl3avahiwSZPu3SDA,421
|
|
2
|
-
fiuai_s3/object_storage.py,sha256=ZreKO0la1VB24GVtM5TYrndhulpEJC0RiHLtdJU7WG0,9455
|
|
3
|
-
fiuai_s3/type.py,sha256=L1h3SQh7_NhWfjWPa1MMgGoxM7g6wQF26qg5WsERt6U,981
|
|
4
|
-
fiuai_s3/alicloud/__init__.py,sha256=mmrCrFp5DzRF5fViJDq7_LpsqCViwTPXOPz4qoaSscI,218
|
|
5
|
-
fiuai_s3/alicloud/alicloud_storage.py,sha256=d24AFYDs7RsTsfL9IiVOxYlGyLzsaUa_WUYD5VPLP4s,6035
|
|
6
|
-
fiuai_s3/minio/__init__.py,sha256=hOmpUkTq8TPgYOxfeOMcWq1_YsJ2r8Zf9VTX3w_v1Lk,209
|
|
7
|
-
fiuai_s3/minio/minio_storage.py,sha256=EVRSGO_2tfSY7cxWy0hdQTkazH2Cqvca6ub5Ms-97Fg,9979
|
|
8
|
-
fiuai_s3-0.3.8.dist-info/METADATA,sha256=Ufv3mcto20zrI7aztK-zymiiw1BJnzR6Tqdbjxs89OI,18727
|
|
9
|
-
fiuai_s3-0.3.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
-
fiuai_s3-0.3.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
11
|
-
fiuai_s3-0.3.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|