megfile 5.0.5__py3-none-any.whl → 5.0.7__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.
- megfile/lib/base_prefetch_reader.py +5 -1
- megfile/s3_path.py +10 -0
- megfile/utils/__init__.py +1 -1
- megfile/version.py +1 -1
- {megfile-5.0.5.dist-info → megfile-5.0.7.dist-info}/METADATA +6 -1
- {megfile-5.0.5.dist-info → megfile-5.0.7.dist-info}/RECORD +11 -11
- {megfile-5.0.5.dist-info → megfile-5.0.7.dist-info}/WHEEL +1 -1
- {megfile-5.0.5.dist-info → megfile-5.0.7.dist-info}/entry_points.txt +0 -0
- {megfile-5.0.5.dist-info → megfile-5.0.7.dist-info}/licenses/LICENSE +0 -0
- {megfile-5.0.5.dist-info → megfile-5.0.7.dist-info}/licenses/LICENSE.pyre +0 -0
- {megfile-5.0.5.dist-info → megfile-5.0.7.dist-info}/top_level.txt +0 -0
|
@@ -274,7 +274,11 @@ class BasePrefetchReader(Readable[bytes], Seekable, ABC):
|
|
|
274
274
|
def _buffer(self) -> BytesIO:
|
|
275
275
|
if self._block_capacity == 0:
|
|
276
276
|
buffer = self._fetch_buffer(index=self._block_index)
|
|
277
|
-
|
|
277
|
+
if self._cached_offset is not None:
|
|
278
|
+
offset = self._cached_offset
|
|
279
|
+
else:
|
|
280
|
+
offset = self._offset % self._block_size
|
|
281
|
+
buffer.seek(offset)
|
|
278
282
|
self._cached_offset = None
|
|
279
283
|
return buffer
|
|
280
284
|
|
megfile/s3_path.py
CHANGED
|
@@ -13,6 +13,7 @@ import boto3
|
|
|
13
13
|
import botocore
|
|
14
14
|
from boto3.s3.transfer import TransferConfig
|
|
15
15
|
from botocore.awsrequest import AWSPreparedRequest, AWSResponse
|
|
16
|
+
from botocore.utils import calculate_md5 as botocore_calculate_md5
|
|
16
17
|
|
|
17
18
|
from megfile.config import (
|
|
18
19
|
GLOBAL_MAX_WORKERS,
|
|
@@ -114,6 +115,11 @@ endpoint_url = "https://s3.amazonaws.com"
|
|
|
114
115
|
max_retries = S3_MAX_RETRY_TIMES
|
|
115
116
|
max_keys = 1000
|
|
116
117
|
|
|
118
|
+
# Patch for https://github.com/aws/aws-cli/issues/9214
|
|
119
|
+
CALCULATE_MD5_FOR_OPERATIONS = {
|
|
120
|
+
"DeleteObjects",
|
|
121
|
+
}
|
|
122
|
+
|
|
117
123
|
|
|
118
124
|
def _patch_make_request(client: botocore.client.BaseClient, redirect: bool = False):
|
|
119
125
|
def after_callback(result: Tuple[AWSResponse, dict], *args, **kwargs):
|
|
@@ -140,6 +146,10 @@ def _patch_make_request(client: botocore.client.BaseClient, redirect: bool = Fal
|
|
|
140
146
|
request_dict["body"].seek(0)
|
|
141
147
|
|
|
142
148
|
def before_callback(operation_model, request_dict, request_context):
|
|
149
|
+
if operation_model.name in CALCULATE_MD5_FOR_OPERATIONS:
|
|
150
|
+
if "Content-MD5" not in request_dict["headers"]:
|
|
151
|
+
md5_digest = botocore_calculate_md5(request_dict["body"])
|
|
152
|
+
request_dict["headers"]["Content-MD5"] = md5_digest
|
|
143
153
|
_logger.debug(
|
|
144
154
|
"send s3 request: %r, with parameters: %s",
|
|
145
155
|
operation_model.name,
|
megfile/utils/__init__.py
CHANGED
|
@@ -266,7 +266,7 @@ def _get_class(cls_or_obj) -> type:
|
|
|
266
266
|
return type(cls_or_obj)
|
|
267
267
|
|
|
268
268
|
|
|
269
|
-
def calculate_md5(file_object):
|
|
269
|
+
def calculate_md5(file_object) -> str:
|
|
270
270
|
hash_md5 = hashlib.md5() # nosec
|
|
271
271
|
for chunk in iter(lambda: file_object.read(DEFAULT_HASH_BUFFER_SIZE), b""):
|
|
272
272
|
hash_md5.update(chunk)
|
megfile/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = "5.0.
|
|
1
|
+
VERSION = "5.0.7"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: megfile
|
|
3
|
-
Version: 5.0.
|
|
3
|
+
Version: 5.0.7
|
|
4
4
|
Summary: Megvii file operation library
|
|
5
5
|
Author-email: megvii-reng <megvii-reng@googlegroups.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/megvii-research/megfile
|
|
@@ -210,6 +210,11 @@ You can use alias in path, like `tos://bucket/key`, the same as `s3+tos://bucket
|
|
|
210
210
|
[](https://megvii-research.github.io/megfile/benchmark.html)
|
|
211
211
|
[](https://megvii-research.github.io/megfile/benchmark.html)
|
|
212
212
|
|
|
213
|
+
## Skill for AI coding
|
|
214
|
+
```bash
|
|
215
|
+
git clone -b gh-skill --single-branch https://github.com/megvii-research/megfile.git path/to/your/ai/skills/megfile
|
|
216
|
+
```
|
|
217
|
+
|
|
213
218
|
## How to Contribute
|
|
214
219
|
* We welcome everyone to contribute code to the `megfile` project, but the contributed code needs to meet the following conditions as much as possible:
|
|
215
220
|
|
|
@@ -7,17 +7,17 @@ megfile/hdfs_path.py,sha256=PWqws54Ou136VxaYp9K_UFRr5BoiZWsO330n9ig5IG0,26338
|
|
|
7
7
|
megfile/http_path.py,sha256=08OmzmRMyLSyq1Yr1K2HbzexesURJrIoA6AibwYzUiA,13844
|
|
8
8
|
megfile/interfaces.py,sha256=XU46U5pl4k1Gse63i4z5SvxcjWeKLj0xyB0Y6fYiWWo,9887
|
|
9
9
|
megfile/pathlike.py,sha256=4RuYHqUc5_6rZDCcVo_18il0Hy7BlOYt-rtYwCtp9Gg,31446
|
|
10
|
-
megfile/s3_path.py,sha256=
|
|
10
|
+
megfile/s3_path.py,sha256=yScDLBUomWqK7ph8n_xXN2nj1m8RjGxvnyQ2tMFjAZE,94954
|
|
11
11
|
megfile/sftp2_path.py,sha256=K90bnMVAx0MQPGXP6LogGuDRzaD4MPR6lMOfdY9C9-0,37942
|
|
12
12
|
megfile/sftp_path.py,sha256=zxuT1hk7sgoOUwq6KBXS__caX8Hk_LgPjINQheTZWAU,52063
|
|
13
13
|
megfile/smart.py,sha256=Lab2jxprj-zvPw5GqUWlWiEY8bcpRlviks_qp9r-km8,38224
|
|
14
14
|
megfile/smart_path.py,sha256=kGidkM5S58ChE3LVZMcUACs3IQgsqh9m04sp6-wxuhk,12615
|
|
15
15
|
megfile/stdio_path.py,sha256=cxaDr8rtisTPnN-rjtaEpqQnshwiqwXFUJBM9xWY7Cg,2711
|
|
16
|
-
megfile/version.py,sha256=
|
|
16
|
+
megfile/version.py,sha256=my9FRCmD9195OJwXusjWmUyOZeaGWmueiOoYCz7bChw,19
|
|
17
17
|
megfile/webdav_path.py,sha256=QrRYKBGWXkUZXEeHxAfVJkxnCfnczocBSRkVgDC_qC4,31421
|
|
18
18
|
megfile/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
megfile/lib/base_memory_handler.py,sha256=VEfw2RuynHFPtQ6KZv8hv8rnUwsj566Omg4cHajhARk,2863
|
|
20
|
-
megfile/lib/base_prefetch_reader.py,sha256=
|
|
20
|
+
megfile/lib/base_prefetch_reader.py,sha256=rURgAGFDbUx8M-5GnNfKJXPImq76WAZbHQYHyoLCqKQ,13451
|
|
21
21
|
megfile/lib/combine_reader.py,sha256=Kp2wEloOUpTlIU7dve87MBpSzmIM-F9OtpTawAjFkiU,4828
|
|
22
22
|
megfile/lib/compare.py,sha256=CPSbyqsQ396oSfxa7h0NdUUqBw5A3WOn6fHrNKkuinw,2188
|
|
23
23
|
megfile/lib/compat.py,sha256=SynEeHluys3tCK-lb_1oV3o_ft83yZvunqM_AjibLgE,207
|
|
@@ -40,13 +40,13 @@ megfile/lib/stdio_handler.py,sha256=IDdgENLQlhigEwkLL4zStueVSzdWg7xVcTF_koof_Ek,
|
|
|
40
40
|
megfile/lib/url.py,sha256=ER32pWy9Q2MAk3TraAaNEBWIqUeBmLuM57ol2cs7-Ks,103
|
|
41
41
|
megfile/lib/webdav_memory_handler.py,sha256=7nq4o69ck_7dFh6xlYTBG8-rj49Q7gxwa3V2bHXEQz4,2551
|
|
42
42
|
megfile/lib/webdav_prefetch_reader.py,sha256=M0X6E6t-DS5q9KiLvjVZx_AZuiW9SaIkBnIPLc774GQ,3941
|
|
43
|
-
megfile/utils/__init__.py,sha256=
|
|
43
|
+
megfile/utils/__init__.py,sha256=dCyiRgTYScx8FdxWOP2-N1gONbBg76Snrv8tuJ7Ykek,12747
|
|
44
44
|
megfile/utils/atomic.py,sha256=V3gqUQjHIx5j6LCrU2_0tLVlX1ossetxdJJK48g9-rc,4084
|
|
45
45
|
megfile/utils/mutex.py,sha256=asb8opGLgK22RiuBJUnfsvB8LnMmodP8KzCVHKmQBWA,2561
|
|
46
|
-
megfile-5.0.
|
|
47
|
-
megfile-5.0.
|
|
48
|
-
megfile-5.0.
|
|
49
|
-
megfile-5.0.
|
|
50
|
-
megfile-5.0.
|
|
51
|
-
megfile-5.0.
|
|
52
|
-
megfile-5.0.
|
|
46
|
+
megfile-5.0.7.dist-info/licenses/LICENSE,sha256=xuY_rHyygMLmf0LgkKj_-wb-BxveHp9rTN0VDE73PrE,11365
|
|
47
|
+
megfile-5.0.7.dist-info/licenses/LICENSE.pyre,sha256=9lf5nT-5ZH25JijpYAequ0bl8E8z5JmZB1qrjiUMp84,1080
|
|
48
|
+
megfile-5.0.7.dist-info/METADATA,sha256=kBUxkMNJ70BgXxloM5OwpsdLWZ8Y1QK03V2EOwG1UM8,9378
|
|
49
|
+
megfile-5.0.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
50
|
+
megfile-5.0.7.dist-info/entry_points.txt,sha256=M6ZWSSv5_5_QtIpZafy3vq7WuOJ_5dSGQQnEZbByt2Q,49
|
|
51
|
+
megfile-5.0.7.dist-info/top_level.txt,sha256=i3rMgdU1ZAJekAceojhA-bkm3749PzshtRmLTbeLUPQ,8
|
|
52
|
+
megfile-5.0.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|