p115client 0.0.5.11.1__tar.gz → 0.0.5.11.2__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.
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/PKG-INFO +2 -2
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/_upload.py +4 -4
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/client.py +25 -25
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/attr.py +1 -1
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/download.py +38 -40
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/edit.py +2 -2
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/export_dir.py +13 -13
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/fs_files.py +3 -3
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/history.py +4 -4
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/iterdir.py +73 -74
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/life.py +10 -10
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/pool.py +5 -5
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/upload.py +13 -9
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/xys.py +7 -7
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/pyproject.toml +2 -2
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/LICENSE +0 -0
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/__init__.py +0 -0
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/const.py +0 -0
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/exception.py +0 -0
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/py.typed +0 -0
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/__init__.py +0 -0
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/request.py +0 -0
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/tool/util.py +0 -0
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/p115client/type.py +0 -0
- {p115client-0.0.5.11.1 → p115client-0.0.5.11.2}/readme.md +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: p115client
|
3
|
-
Version: 0.0.5.11.
|
3
|
+
Version: 0.0.5.11.2
|
4
4
|
Summary: Python 115 webdisk client.
|
5
5
|
Home-page: https://github.com/ChenyangGao/p115client
|
6
6
|
License: MIT
|
@@ -40,7 +40,7 @@ Requires-Dist: python-filewrap (>=0.2.8)
|
|
40
40
|
Requires-Dist: python-hashtools (>=0.0.3.3)
|
41
41
|
Requires-Dist: python-http_request (>=0.0.6)
|
42
42
|
Requires-Dist: python-httpfile (>=0.0.5.2)
|
43
|
-
Requires-Dist: python-iterutils (>=0.2)
|
43
|
+
Requires-Dist: python-iterutils (>=0.2.1)
|
44
44
|
Requires-Dist: python-property (>=0.0.3)
|
45
45
|
Requires-Dist: python-startfile (>=0.0.2)
|
46
46
|
Requires-Dist: python-undefined (>=0.0.3)
|
@@ -281,11 +281,11 @@ def oss_multipart_part_iter(
|
|
281
281
|
**request_kwargs,
|
282
282
|
)
|
283
283
|
for el in etree.iterfind("Part"):
|
284
|
-
yield Yield({sel.tag: maybe_integer(sel.text) for sel in el}
|
284
|
+
yield Yield({sel.tag: maybe_integer(sel.text) for sel in el})
|
285
285
|
if getattr(etree.find("IsTruncated"), "text") == "false":
|
286
286
|
break
|
287
287
|
params["part-number-marker"] = getattr(etree.find("NextPartNumberMarker"), "text")
|
288
|
-
return run_gen_step_iter(gen_step,
|
288
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
289
289
|
|
290
290
|
|
291
291
|
@overload
|
@@ -679,7 +679,7 @@ def oss_multipart_upload_part_iter(
|
|
679
679
|
))
|
680
680
|
if part["Size"] < partsize:
|
681
681
|
break
|
682
|
-
return run_gen_step_iter(gen_step,
|
682
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
683
683
|
|
684
684
|
|
685
685
|
@overload
|
@@ -927,7 +927,7 @@ def oss_multipart_upload(
|
|
927
927
|
finally:
|
928
928
|
if close_reporthook is not None:
|
929
929
|
yield close_reporthook()
|
930
|
-
return run_gen_step(gen_step,
|
930
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
931
931
|
|
932
932
|
|
933
933
|
# class MultipartUploader:
|
@@ -1101,7 +1101,7 @@ def normalize_attr_simple[D: dict[str, Any]](
|
|
1101
1101
|
*,
|
1102
1102
|
dict_cls: None | type[D] = None,
|
1103
1103
|
) -> dict[str, Any] | D:
|
1104
|
-
return normalize_attr(info,
|
1104
|
+
return normalize_attr(info, may_call=False, keep_raw=keep_raw, dict_cls=dict_cls)
|
1105
1105
|
|
1106
1106
|
|
1107
1107
|
class IgnoreCaseDict[V](dict[str, V]):
|
@@ -2317,7 +2317,7 @@ class ClientRequestMixin:
|
|
2317
2317
|
)
|
2318
2318
|
else:
|
2319
2319
|
return qrcode_token
|
2320
|
-
return run_gen_step(gen_step,
|
2320
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
2321
2321
|
|
2322
2322
|
@overload
|
2323
2323
|
@classmethod
|
@@ -2417,7 +2417,7 @@ class ClientRequestMixin:
|
|
2417
2417
|
async_=async_,
|
2418
2418
|
**request_kwargs,
|
2419
2419
|
)
|
2420
|
-
return run_gen_step(gen_step,
|
2420
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
2421
2421
|
|
2422
2422
|
########## Upload API ##########
|
2423
2423
|
|
@@ -2800,7 +2800,7 @@ class ClientRequestMixin:
|
|
2800
2800
|
async_=async_,
|
2801
2801
|
**request_kwargs,
|
2802
2802
|
)
|
2803
|
-
return run_gen_step(gen_step,
|
2803
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
2804
2804
|
|
2805
2805
|
@overload
|
2806
2806
|
def read_bytes_range(
|
@@ -2915,7 +2915,7 @@ class ClientRequestMixin:
|
|
2915
2915
|
async_=async_,
|
2916
2916
|
**request_kwargs,
|
2917
2917
|
)
|
2918
|
-
return run_gen_step(gen_step,
|
2918
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
2919
2919
|
|
2920
2920
|
|
2921
2921
|
class P115OpenClient(ClientRequestMixin):
|
@@ -3011,7 +3011,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
3011
3011
|
self.refresh_token = data["refresh_token"]
|
3012
3012
|
self.access_token = data["access_token"]
|
3013
3013
|
return self
|
3014
|
-
return run_gen_step(gen_step,
|
3014
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
3015
3015
|
|
3016
3016
|
@classmethod
|
3017
3017
|
def from_token(cls, /, access_token: str, refresh_token: str) -> P115OpenClient:
|
@@ -3078,7 +3078,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
3078
3078
|
self.refresh_token = data["refresh_token"]
|
3079
3079
|
access_token = self.access_token = data["access_token"]
|
3080
3080
|
return access_token
|
3081
|
-
return run_gen_step(gen_step,
|
3081
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
3082
3082
|
|
3083
3083
|
@overload
|
3084
3084
|
def download_url(
|
@@ -4804,7 +4804,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
4804
4804
|
check_response(resp)
|
4805
4805
|
resp["data"] = {**payload, **resp["data"], "sha1": filesha1, "cid": pid}
|
4806
4806
|
return resp
|
4807
|
-
return run_gen_step(gen_step,
|
4807
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
4808
4808
|
|
4809
4809
|
@overload
|
4810
4810
|
def upload_file(
|
@@ -5148,7 +5148,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
5148
5148
|
async_=async_, # type: ignore
|
5149
5149
|
**request_kwargs,
|
5150
5150
|
)
|
5151
|
-
return run_gen_step(gen_step,
|
5151
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
5152
5152
|
|
5153
5153
|
@overload
|
5154
5154
|
def user_info(
|
@@ -5529,7 +5529,7 @@ class P115Client(P115OpenClient):
|
|
5529
5529
|
)
|
5530
5530
|
setattr(self, "check_for_relogin", check_for_relogin)
|
5531
5531
|
return self
|
5532
|
-
return run_gen_step(gen_step,
|
5532
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
5533
5533
|
|
5534
5534
|
@locked_cacheproperty
|
5535
5535
|
def request_lock(self, /) -> Lock:
|
@@ -5701,7 +5701,7 @@ class P115Client(P115OpenClient):
|
|
5701
5701
|
check_response(resp)
|
5702
5702
|
setattr(self, "cookies", resp["data"]["cookie"])
|
5703
5703
|
return self
|
5704
|
-
return run_gen_step(gen_step,
|
5704
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
5705
5705
|
|
5706
5706
|
@overload
|
5707
5707
|
def login_with_app(
|
@@ -5833,7 +5833,7 @@ class P115Client(P115OpenClient):
|
|
5833
5833
|
async_=async_,
|
5834
5834
|
**request_kwargs,
|
5835
5835
|
)
|
5836
|
-
return run_gen_step(gen_step,
|
5836
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
5837
5837
|
|
5838
5838
|
@overload
|
5839
5839
|
def login_without_app(
|
@@ -5891,7 +5891,7 @@ class P115Client(P115OpenClient):
|
|
5891
5891
|
)
|
5892
5892
|
check_response(resp)
|
5893
5893
|
return uid
|
5894
|
-
return run_gen_step(gen_step,
|
5894
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
5895
5895
|
|
5896
5896
|
@overload
|
5897
5897
|
def login_with_open(
|
@@ -5943,7 +5943,7 @@ class P115Client(P115OpenClient):
|
|
5943
5943
|
resp = yield self.login_qrcode_scan_confirm(login_uid, async_=async_, **request_kwargs)
|
5944
5944
|
check_response(resp)
|
5945
5945
|
return self.login_qrcode_access_token_open(login_uid, async_=async_, **request_kwargs)
|
5946
|
-
return run_gen_step(gen_step,
|
5946
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
5947
5947
|
|
5948
5948
|
@overload
|
5949
5949
|
def login_another_app(
|
@@ -6087,7 +6087,7 @@ class P115Client(P115OpenClient):
|
|
6087
6087
|
if self is not inst and ssoent == inst.login_ssoent:
|
6088
6088
|
warn(f"login with the same ssoent {ssoent!r}, {self!r} will expire within 60 seconds", category=P115Warning)
|
6089
6089
|
return inst
|
6090
|
-
return run_gen_step(gen_step,
|
6090
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
6091
6091
|
|
6092
6092
|
@overload
|
6093
6093
|
def login_another_open(
|
@@ -6181,7 +6181,7 @@ class P115Client(P115OpenClient):
|
|
6181
6181
|
inst.access_token = data["access_token"]
|
6182
6182
|
inst.app_id = app_id
|
6183
6183
|
return inst
|
6184
|
-
return run_gen_step(gen_step,
|
6184
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
6185
6185
|
|
6186
6186
|
@overload
|
6187
6187
|
@classmethod
|
@@ -6300,7 +6300,7 @@ class P115Client(P115OpenClient):
|
|
6300
6300
|
resp = yield cls.login_qrcode_scan_result(uid, app, async_=async_, **request_kwargs)
|
6301
6301
|
cookies = check_response(resp)["data"]["cookie"]
|
6302
6302
|
return cls(cookies, check_for_relogin=check_for_relogin)
|
6303
|
-
return run_gen_step(gen_step,
|
6303
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
6304
6304
|
|
6305
6305
|
@overload
|
6306
6306
|
def logout(
|
@@ -6575,7 +6575,7 @@ class P115Client(P115OpenClient):
|
|
6575
6575
|
if check and isinstance(resp, dict):
|
6576
6576
|
check_response(resp)
|
6577
6577
|
return resp
|
6578
|
-
return run_gen_step(gen_step,
|
6578
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
6579
6579
|
|
6580
6580
|
def request(
|
6581
6581
|
self,
|
@@ -7434,7 +7434,7 @@ class P115Client(P115OpenClient):
|
|
7434
7434
|
async_=async_,
|
7435
7435
|
**request_kwargs,
|
7436
7436
|
)
|
7437
|
-
return run_gen_step(gen_step,
|
7437
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
7438
7438
|
|
7439
7439
|
########## Download API ##########
|
7440
7440
|
|
@@ -16009,7 +16009,7 @@ class P115Client(P115OpenClient):
|
|
16009
16009
|
if device is None:
|
16010
16010
|
return None
|
16011
16011
|
return device["icon"]
|
16012
|
-
return run_gen_step(gen_step,
|
16012
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
16013
16013
|
|
16014
16014
|
@overload
|
16015
16015
|
def login_open_auth_detail(
|
@@ -16533,7 +16533,7 @@ class P115Client(P115OpenClient):
|
|
16533
16533
|
return get_default_request()(url=api, async_=async_, **request_kwargs)
|
16534
16534
|
else:
|
16535
16535
|
return request(url=api, **request_kwargs)
|
16536
|
-
return run_gen_step(gen_step,
|
16536
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
16537
16537
|
|
16538
16538
|
@overload
|
16539
16539
|
def logout_by_ssoent(
|
@@ -20427,7 +20427,7 @@ class P115Client(P115OpenClient):
|
|
20427
20427
|
if resp["state"]:
|
20428
20428
|
self.user_key = resp["data"]["userkey"]
|
20429
20429
|
return resp
|
20430
|
-
return run_gen_step(gen_step,
|
20430
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
20431
20431
|
|
20432
20432
|
@overload
|
20433
20433
|
def upload_resume(
|
@@ -20794,7 +20794,7 @@ class P115Client(P115OpenClient):
|
|
20794
20794
|
"pickcode": resp["pickcode"],
|
20795
20795
|
}
|
20796
20796
|
return resp
|
20797
|
-
return run_gen_step(gen_step,
|
20797
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
20798
20798
|
|
20799
20799
|
@overload
|
20800
20800
|
def upload_file_sample(
|
@@ -20930,7 +20930,7 @@ class P115Client(P115OpenClient):
|
|
20930
20930
|
async_=async_,
|
20931
20931
|
**request_kwargs,
|
20932
20932
|
)
|
20933
|
-
return run_gen_step(gen_step,
|
20933
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
20934
20934
|
|
20935
20935
|
@overload # type: ignore
|
20936
20936
|
def upload_file(
|
@@ -21289,7 +21289,7 @@ class P115Client(P115OpenClient):
|
|
21289
21289
|
async_=async_, # type: ignore
|
21290
21290
|
**request_kwargs,
|
21291
21291
|
)
|
21292
|
-
return run_gen_step(gen_step,
|
21292
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
21293
21293
|
|
21294
21294
|
########## User API ##########
|
21295
21295
|
|
@@ -72,7 +72,7 @@ def get_attr(
|
|
72
72
|
resp = yield client.fs_file(id, async_=async_, **request_kwargs)
|
73
73
|
check_response(resp)
|
74
74
|
return normalize_attr_web(resp["data"][0])
|
75
|
-
return run_gen_step(gen_step,
|
75
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
76
76
|
|
77
77
|
|
78
78
|
def type_of_attr(attr: Mapping, /) -> int:
|
@@ -145,7 +145,7 @@ def batch_get_url(
|
|
145
145
|
for id, info in resp["data"].items()
|
146
146
|
if info["url"]
|
147
147
|
}
|
148
|
-
return run_gen_step(gen_step,
|
148
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
149
149
|
|
150
150
|
|
151
151
|
@overload
|
@@ -227,8 +227,8 @@ def iter_url_batches(
|
|
227
227
|
sha1=info["sha1"],
|
228
228
|
is_directory=False,
|
229
229
|
headers=headers,
|
230
|
-
)
|
231
|
-
return run_gen_step_iter(gen_step,
|
230
|
+
))
|
231
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
232
232
|
|
233
233
|
|
234
234
|
@overload
|
@@ -376,8 +376,7 @@ def iter_files_with_url(
|
|
376
376
|
app=app,
|
377
377
|
user_agent=user_agent,
|
378
378
|
**params, # type: ignore
|
379
|
-
)
|
380
|
-
may_await=False,
|
379
|
+
)
|
381
380
|
)
|
382
381
|
return
|
383
382
|
if headers := request_kwargs.get("headers"):
|
@@ -403,8 +402,8 @@ def iter_files_with_url(
|
|
403
402
|
async_=async_,
|
404
403
|
**request_kwargs,
|
405
404
|
)
|
406
|
-
yield Yield(attr
|
407
|
-
return run_gen_step_iter(gen_step,
|
405
|
+
yield Yield(attr)
|
406
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
408
407
|
|
409
408
|
|
410
409
|
@overload
|
@@ -536,8 +535,7 @@ def iter_images_with_url(
|
|
536
535
|
suffixes=suffix,
|
537
536
|
app=app,
|
538
537
|
**params, # type: ignore
|
539
|
-
)
|
540
|
-
may_await=False,
|
538
|
+
)
|
541
539
|
)
|
542
540
|
return
|
543
541
|
with with_iter_next(it) as get_next:
|
@@ -562,8 +560,8 @@ def iter_images_with_url(
|
|
562
560
|
async_=async_,
|
563
561
|
**request_kwargs,
|
564
562
|
)
|
565
|
-
yield Yield(attr
|
566
|
-
return run_gen_step_iter(gen_step,
|
563
|
+
yield Yield(attr)
|
564
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
567
565
|
|
568
566
|
|
569
567
|
@overload
|
@@ -728,7 +726,7 @@ def iter_subtitles_with_url(
|
|
728
726
|
if subtitles:
|
729
727
|
for attr in items:
|
730
728
|
attr["url"] = subtitles[attr["sha1"]]
|
731
|
-
yield Yield(attr
|
729
|
+
yield Yield(attr)
|
732
730
|
else:
|
733
731
|
for attr in items:
|
734
732
|
if attr.get("violated", False):
|
@@ -747,8 +745,8 @@ def iter_subtitles_with_url(
|
|
747
745
|
async_=async_,
|
748
746
|
**request_kwargs,
|
749
747
|
)
|
750
|
-
yield Yield(attr
|
751
|
-
return run_gen_step_iter(gen_step,
|
748
|
+
yield Yield(attr)
|
749
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
752
750
|
|
753
751
|
|
754
752
|
@overload
|
@@ -832,14 +830,13 @@ def iter_subtitle_batches(
|
|
832
830
|
)
|
833
831
|
check_response(resp)
|
834
832
|
yield YieldFrom(
|
835
|
-
filter(lambda info: "file_id" in info, resp["data"]["list"])
|
836
|
-
may_await=False,
|
833
|
+
filter(lambda info: "file_id" in info, resp["data"]["list"])
|
837
834
|
)
|
838
835
|
except (StopIteration, StopAsyncIteration):
|
839
836
|
pass
|
840
837
|
finally:
|
841
838
|
yield client.fs_delete(scid, async_=async_, **request_kwargs)
|
842
|
-
return run_gen_step_iter(gen_step,
|
839
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
843
840
|
|
844
841
|
|
845
842
|
@overload
|
@@ -1080,7 +1077,7 @@ def make_strm(
|
|
1080
1077
|
if use_abspath is not None:
|
1081
1078
|
params["path_already"] = path_already
|
1082
1079
|
yield (async_batch if async_ else thread_batch)(
|
1083
|
-
lambda attr: run_gen_step(save(attr),
|
1080
|
+
lambda attr: run_gen_step(save(attr), may_call=False, async_=async_),
|
1084
1081
|
(iter_files if use_abspath is None else iter_files_with_path)(
|
1085
1082
|
client,
|
1086
1083
|
cid,
|
@@ -1117,7 +1114,7 @@ def make_strm(
|
|
1117
1114
|
"ignore": ignored,
|
1118
1115
|
"remove": removed,
|
1119
1116
|
}
|
1120
|
-
return run_gen_step(gen_step,
|
1117
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
1121
1118
|
|
1122
1119
|
|
1123
1120
|
@overload
|
@@ -1185,7 +1182,7 @@ def iter_download_nodes(
|
|
1185
1182
|
resp = yield get_nodes(payload)
|
1186
1183
|
check_response(resp)
|
1187
1184
|
data = resp["data"]
|
1188
|
-
yield YieldFrom(data["list"]
|
1185
|
+
yield YieldFrom(data["list"])
|
1189
1186
|
if not data["has_next_page"]:
|
1190
1187
|
break
|
1191
1188
|
else:
|
@@ -1264,11 +1261,11 @@ def iter_download_nodes(
|
|
1264
1261
|
break
|
1265
1262
|
elif isinstance(ls, BaseException):
|
1266
1263
|
raise ls
|
1267
|
-
yield YieldFrom(ls
|
1264
|
+
yield YieldFrom(ls)
|
1268
1265
|
finally:
|
1269
1266
|
yield shutdown()
|
1270
1267
|
if pickcode:
|
1271
|
-
return run_gen_step_iter(gen_step(pickcode),
|
1268
|
+
return run_gen_step_iter(gen_step(pickcode), may_call=False, async_=async_)
|
1272
1269
|
else:
|
1273
1270
|
def chain():
|
1274
1271
|
with with_iter_next(iterdir(
|
@@ -1284,14 +1281,14 @@ def iter_download_nodes(
|
|
1284
1281
|
attr = yield get_next()
|
1285
1282
|
if not files:
|
1286
1283
|
yield Yield(
|
1287
|
-
{"fid": str(attr["id"]), "pid": "0", "fn": attr["name"]}
|
1288
|
-
may_await=False,
|
1284
|
+
{"fid": str(attr["id"]), "pid": "0", "fn": attr["name"]}
|
1289
1285
|
)
|
1290
|
-
yield YieldFrom(
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1286
|
+
yield YieldFrom(run_gen_step_iter(
|
1287
|
+
gen_step(attr["pickcode"]),
|
1288
|
+
may_call=False,
|
1289
|
+
async_=async_,
|
1290
|
+
))
|
1291
|
+
return run_gen_step_iter(chain, may_call=False, async_=async_)
|
1295
1292
|
|
1296
1293
|
|
1297
1294
|
@overload
|
@@ -1436,12 +1433,13 @@ def iter_download_files(
|
|
1436
1433
|
"pickcode": attr["pickcode"],
|
1437
1434
|
"size": attr["size"],
|
1438
1435
|
**defaults,
|
1439
|
-
}
|
1436
|
+
})
|
1440
1437
|
for pickcode in pickcodes:
|
1441
|
-
yield YieldFrom(
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1438
|
+
yield YieldFrom(run_gen_step_iter(
|
1439
|
+
gen_step(pickcode),
|
1440
|
+
may_call=False,
|
1441
|
+
async_=async_,
|
1442
|
+
))
|
1445
1443
|
return
|
1446
1444
|
if not pickcode:
|
1447
1445
|
resp = yield client.fs_file_skim(cid, async_=async_, **request_kwargs)
|
@@ -1478,7 +1476,7 @@ def iter_download_files(
|
|
1478
1476
|
finally:
|
1479
1477
|
ancestors_loaded = True
|
1480
1478
|
if async_:
|
1481
|
-
task: Any = create_task(run_gen_step(load_ancestors,
|
1479
|
+
task: Any = create_task(run_gen_step(load_ancestors, may_call=False, async_=True))
|
1482
1480
|
else:
|
1483
1481
|
task = run_as_thread(run_gen_step, load_ancestors)
|
1484
1482
|
cache: list[dict] = []
|
@@ -1495,9 +1493,9 @@ def iter_download_files(
|
|
1495
1493
|
while True:
|
1496
1494
|
info = yield get_next()
|
1497
1495
|
if ancestors_loaded is None:
|
1498
|
-
yield Yield(norm_attr(info)
|
1496
|
+
yield Yield(norm_attr(info))
|
1499
1497
|
elif ancestors_loaded:
|
1500
|
-
yield YieldFrom(map(norm_attr, cache)
|
1498
|
+
yield YieldFrom(map(norm_attr, cache))
|
1501
1499
|
cache.clear()
|
1502
1500
|
if async_:
|
1503
1501
|
yield task
|
@@ -1511,8 +1509,8 @@ def iter_download_files(
|
|
1511
1509
|
yield task
|
1512
1510
|
else:
|
1513
1511
|
task.result()
|
1514
|
-
yield YieldFrom(map(norm_attr, cache)
|
1515
|
-
return run_gen_step_iter(gen_step,
|
1512
|
+
yield YieldFrom(map(norm_attr, cache))
|
1513
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
1516
1514
|
|
1517
1515
|
|
1518
1516
|
@overload
|
@@ -1588,5 +1586,5 @@ def get_remaining_open_count(
|
|
1588
1586
|
for f in cache:
|
1589
1587
|
f.close()
|
1590
1588
|
return len(cache)
|
1591
|
-
return run_gen_step(gen_step,
|
1589
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
1592
1590
|
|
@@ -91,7 +91,7 @@ def update_abstract(
|
|
91
91
|
chunked(ids, batch_size),
|
92
92
|
max_workers=max_workers
|
93
93
|
))
|
94
|
-
return run_gen_step(gen_step,
|
94
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
95
95
|
|
96
96
|
|
97
97
|
@overload
|
@@ -634,5 +634,5 @@ def batch_unstar(
|
|
634
634
|
async_=async_, # type: ignore
|
635
635
|
**request_kwargs,
|
636
636
|
)
|
637
|
-
return run_gen_step(gen_step,
|
637
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
638
638
|
|
@@ -95,7 +95,7 @@ def parse_export_dir_as_dict_iter(
|
|
95
95
|
stack[depth]["name"] += "\n" + line[:-1]
|
96
96
|
continue
|
97
97
|
else:
|
98
|
-
yield Yield(stack[depth]
|
98
|
+
yield Yield(stack[depth])
|
99
99
|
name = m[1]
|
100
100
|
depth = (len(line) - len(name)) // 2 - 1
|
101
101
|
item = {
|
@@ -110,7 +110,7 @@ def parse_export_dir_as_dict_iter(
|
|
110
110
|
push(item)
|
111
111
|
except (StopIteration, StopAsyncIteration):
|
112
112
|
if depth:
|
113
|
-
yield Yield(stack[depth]
|
113
|
+
yield Yield(stack[depth])
|
114
114
|
finally:
|
115
115
|
if close_file:
|
116
116
|
if async_:
|
@@ -120,7 +120,7 @@ def parse_export_dir_as_dict_iter(
|
|
120
120
|
yield ensure_async(close, threaded=True)
|
121
121
|
elif callable(close := getattr(file, "close", None)):
|
122
122
|
close()
|
123
|
-
return run_gen_step_iter(gen_step,
|
123
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
124
124
|
|
125
125
|
|
126
126
|
@overload
|
@@ -206,7 +206,7 @@ def parse_export_dir_as_path_iter(
|
|
206
206
|
stack[depth] += "\n" + line[:-1]
|
207
207
|
continue
|
208
208
|
elif depth:
|
209
|
-
yield Yield(stack[depth]
|
209
|
+
yield Yield(stack[depth])
|
210
210
|
else:
|
211
211
|
yield "/" if root == "根目录" else root
|
212
212
|
name = m[1]
|
@@ -220,7 +220,7 @@ def parse_export_dir_as_path_iter(
|
|
220
220
|
push(path)
|
221
221
|
except (StopIteration, StopAsyncIteration):
|
222
222
|
if depth:
|
223
|
-
yield Yield(stack[depth]
|
223
|
+
yield Yield(stack[depth])
|
224
224
|
finally:
|
225
225
|
if close_file:
|
226
226
|
if async_:
|
@@ -230,7 +230,7 @@ def parse_export_dir_as_path_iter(
|
|
230
230
|
yield ensure_async(close, threaded=True)
|
231
231
|
elif callable(close := getattr(file, "close", None)):
|
232
232
|
close()
|
233
|
-
return run_gen_step_iter(gen_step,
|
233
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
234
234
|
|
235
235
|
|
236
236
|
@overload
|
@@ -298,7 +298,7 @@ def parse_export_dir_as_patht_iter(
|
|
298
298
|
stack[depth] += "\n" + line[:-1]
|
299
299
|
continue
|
300
300
|
else:
|
301
|
-
yield Yield(stack[:depth+1]
|
301
|
+
yield Yield(stack[:depth+1])
|
302
302
|
name = m[1]
|
303
303
|
depth = (len(line) - len(name)) // 2 - from_top_root
|
304
304
|
try:
|
@@ -307,7 +307,7 @@ def parse_export_dir_as_patht_iter(
|
|
307
307
|
push(name)
|
308
308
|
except (StopIteration, StopAsyncIteration):
|
309
309
|
if depth:
|
310
|
-
yield Yield(stack[:depth+1]
|
310
|
+
yield Yield(stack[:depth+1])
|
311
311
|
finally:
|
312
312
|
if close_file:
|
313
313
|
if async_:
|
@@ -317,7 +317,7 @@ def parse_export_dir_as_patht_iter(
|
|
317
317
|
yield ensure_async(close, threaded=True)
|
318
318
|
elif callable(close := getattr(file, "close", None)):
|
319
319
|
close()
|
320
|
-
return run_gen_step_iter(gen_step,
|
320
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
321
321
|
|
322
322
|
|
323
323
|
@overload
|
@@ -406,7 +406,7 @@ def export_dir(
|
|
406
406
|
payload["layer_limit"] = layer_limit
|
407
407
|
resp = yield client.fs_export_dir(payload, async_=async_, **request_kwargs)
|
408
408
|
return check_response(resp)["data"]["export_id"]
|
409
|
-
return run_gen_step(gen_step,
|
409
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
410
410
|
|
411
411
|
|
412
412
|
@overload
|
@@ -486,7 +486,7 @@ def export_dir_result(
|
|
486
486
|
raise TimeoutError(export_id)
|
487
487
|
if check_interval:
|
488
488
|
yield do_sleep(min(check_interval, remaining_seconds))
|
489
|
-
return run_gen_step(gen_step,
|
489
|
+
return run_gen_step(gen_step, may_call=False, async_=async_)
|
490
490
|
|
491
491
|
|
492
492
|
@overload
|
@@ -629,7 +629,7 @@ def export_dir_parse_iter(
|
|
629
629
|
file_wrapper: IO = AsyncTextIOWrapper(AsyncBufferedReader(file), encoding="utf-16", newline="\n")
|
630
630
|
else:
|
631
631
|
file_wrapper = TextIOWrapper(BufferedReader(file), encoding="utf-16", newline="\n")
|
632
|
-
yield YieldFrom(parse_iter(file_wrapper)
|
632
|
+
yield YieldFrom(parse_iter(file_wrapper)) # type: ignore
|
633
633
|
finally:
|
634
634
|
if async_:
|
635
635
|
if callable(aclose := getattr(file, "aclose", None)):
|
@@ -645,5 +645,5 @@ def export_dir_parse_iter(
|
|
645
645
|
async_=async_, # type: ignore
|
646
646
|
**request_kwargs,
|
647
647
|
)
|
648
|
-
return run_gen_step_iter(gen_step,
|
648
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
649
649
|
|
@@ -145,13 +145,13 @@ def iter_fs_files(
|
|
145
145
|
return resp
|
146
146
|
def gen_step():
|
147
147
|
while True:
|
148
|
-
resp = yield run_gen_step(get_files(payload),
|
148
|
+
resp = yield run_gen_step(get_files(payload), may_call=False, async_=async_)
|
149
149
|
payload["limit"] = page_size
|
150
|
-
yield Yield(resp
|
150
|
+
yield Yield(resp)
|
151
151
|
payload["offset"] += len(resp["data"])
|
152
152
|
if payload["offset"] >= count:
|
153
153
|
break
|
154
|
-
return run_gen_step_iter(gen_step,
|
154
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
155
155
|
|
156
156
|
|
157
157
|
def iter_fs_files_threaded(
|
@@ -105,7 +105,7 @@ def iter_history_list_once(
|
|
105
105
|
if from_id and event_id <= from_id or from_time and int(event["update_time"]) < from_time:
|
106
106
|
return
|
107
107
|
if event_id not in seen:
|
108
|
-
yield Yield(event
|
108
|
+
yield Yield(event)
|
109
109
|
seen_add(event_id)
|
110
110
|
offset += len(events)
|
111
111
|
if offset >= int(resp["data"]["total"]):
|
@@ -119,7 +119,7 @@ def iter_history_list_once(
|
|
119
119
|
ts_last_call = time()
|
120
120
|
resp = yield history_list(payload, async_=async_)
|
121
121
|
events = check_response(resp)["data"]["list"]
|
122
|
-
return run_gen_step_iter(gen_step,
|
122
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
123
123
|
|
124
124
|
|
125
125
|
@overload
|
@@ -219,6 +219,6 @@ def iter_history_list(
|
|
219
219
|
from_id = int(event["id"])
|
220
220
|
from_time = int(event["update_time"])
|
221
221
|
sub_first_loop = False
|
222
|
-
yield Yield(event
|
223
|
-
return run_gen_step_iter(gen_step,
|
222
|
+
yield Yield(event)
|
223
|
+
return run_gen_step_iter(gen_step, may_call=False, async_=async_)
|
224
224
|
|