p115client 0.0.5.12.1__py3-none-any.whl → 0.0.5.12.2.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.
- p115client/_upload.py +3 -3
- p115client/client.py +62 -41
- p115client/tool/attr.py +1 -1
- p115client/tool/auth.py +1 -1
- p115client/tool/download.py +15 -23
- p115client/tool/edit.py +2 -2
- p115client/tool/export_dir.py +6 -6
- p115client/tool/fs_files.py +54 -38
- p115client/tool/history.py +2 -2
- p115client/tool/iterdir.py +37 -42
- p115client/tool/life.py +4 -4
- p115client/tool/offline.py +2 -2
- p115client/tool/pool.py +5 -5
- p115client/tool/upload.py +9 -9
- p115client/tool/xys.py +5 -5
- {p115client-0.0.5.12.1.dist-info → p115client-0.0.5.12.2.1.dist-info}/METADATA +2 -2
- p115client-0.0.5.12.2.1.dist-info/RECORD +28 -0
- p115client-0.0.5.12.1.dist-info/RECORD +0 -28
- {p115client-0.0.5.12.1.dist-info → p115client-0.0.5.12.2.1.dist-info}/LICENSE +0 -0
- {p115client-0.0.5.12.1.dist-info → p115client-0.0.5.12.2.1.dist-info}/WHEEL +0 -0
p115client/_upload.py
CHANGED
@@ -329,7 +329,7 @@ def oss_multipart_part_iter(
|
|
329
329
|
if getattr(etree.find("IsTruncated"), "text") == "false":
|
330
330
|
break
|
331
331
|
params["part-number-marker"] = getattr(etree.find("NextPartNumberMarker"), "text")
|
332
|
-
return run_gen_step_iter(gen_step,
|
332
|
+
return run_gen_step_iter(gen_step, async_)
|
333
333
|
|
334
334
|
|
335
335
|
@overload
|
@@ -723,7 +723,7 @@ def oss_multipart_upload_part_iter(
|
|
723
723
|
))
|
724
724
|
if part["Size"] < partsize:
|
725
725
|
break
|
726
|
-
return run_gen_step_iter(gen_step,
|
726
|
+
return run_gen_step_iter(gen_step, async_)
|
727
727
|
|
728
728
|
|
729
729
|
@overload
|
@@ -971,5 +971,5 @@ def oss_multipart_upload(
|
|
971
971
|
finally:
|
972
972
|
if close_reporthook is not None:
|
973
973
|
yield close_reporthook()
|
974
|
-
return run_gen_step(gen_step,
|
974
|
+
return run_gen_step(gen_step, async_)
|
975
975
|
|
p115client/client.py
CHANGED
@@ -1076,8 +1076,8 @@ def normalize_attr(
|
|
1076
1076
|
simple: bool = False,
|
1077
1077
|
keep_raw: bool = False,
|
1078
1078
|
*,
|
1079
|
-
dict_cls: None,
|
1080
|
-
) ->
|
1079
|
+
dict_cls: None = None,
|
1080
|
+
) -> AttrDict[str, Any]:
|
1081
1081
|
...
|
1082
1082
|
@overload
|
1083
1083
|
def normalize_attr[D: dict[str, Any]](
|
@@ -1086,7 +1086,7 @@ def normalize_attr[D: dict[str, Any]](
|
|
1086
1086
|
simple: bool = False,
|
1087
1087
|
keep_raw: bool = False,
|
1088
1088
|
*,
|
1089
|
-
dict_cls: type[D]
|
1089
|
+
dict_cls: type[D],
|
1090
1090
|
) -> D:
|
1091
1091
|
...
|
1092
1092
|
def normalize_attr[D: dict[str, Any]](
|
@@ -1095,8 +1095,8 @@ def normalize_attr[D: dict[str, Any]](
|
|
1095
1095
|
simple: bool = False,
|
1096
1096
|
keep_raw: bool = False,
|
1097
1097
|
*,
|
1098
|
-
dict_cls: None | type[D] =
|
1099
|
-
) ->
|
1098
|
+
dict_cls: None | type[D] = None,
|
1099
|
+
) -> AttrDict[str, Any] | D:
|
1100
1100
|
"""翻译获取自罗列目录、搜索、获取文件信息等接口的数据,使之便于阅读
|
1101
1101
|
|
1102
1102
|
:param info: 原始数据
|
@@ -1106,12 +1106,20 @@ def normalize_attr[D: dict[str, Any]](
|
|
1106
1106
|
|
1107
1107
|
:return: 翻译后的 dict 类型数据
|
1108
1108
|
"""
|
1109
|
-
if
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1109
|
+
if dict_cls is None:
|
1110
|
+
if "fn" in info:
|
1111
|
+
return normalize_attr_app(info, simple=simple, keep_raw=keep_raw, dict_cls=AttrDict)
|
1112
|
+
elif "file_id" in info or "category_id" in info:
|
1113
|
+
return normalize_attr_app2(info, simple=simple, keep_raw=keep_raw, dict_cls=AttrDict)
|
1114
|
+
else:
|
1115
|
+
return normalize_attr_web(info, simple=simple, keep_raw=keep_raw, dict_cls=AttrDict)
|
1113
1116
|
else:
|
1114
|
-
|
1117
|
+
if "fn" in info:
|
1118
|
+
return normalize_attr_app(info, simple=simple, keep_raw=keep_raw, dict_cls=dict_cls)
|
1119
|
+
elif "file_id" in info or "category_id" in info:
|
1120
|
+
return normalize_attr_app2(info, simple=simple, keep_raw=keep_raw, dict_cls=dict_cls)
|
1121
|
+
else:
|
1122
|
+
return normalize_attr_web(info, simple=simple, keep_raw=keep_raw, dict_cls=dict_cls)
|
1115
1123
|
|
1116
1124
|
|
1117
1125
|
@overload
|
@@ -1577,6 +1585,9 @@ class ClientRequestMixin:
|
|
1577
1585
|
) -> dict | Coroutine[Any, Any, dict]:
|
1578
1586
|
"""授权码方式请求开放接口应用授权
|
1579
1587
|
|
1588
|
+
.. note::
|
1589
|
+
最多同时有 2 个授权登录,如果有新的授权加入,会先踢掉时间较早的那一个
|
1590
|
+
|
1580
1591
|
GET https://qrcodeapi.115.com/open/authorize
|
1581
1592
|
|
1582
1593
|
.. admonition:: Reference
|
@@ -2099,6 +2110,9 @@ class ClientRequestMixin:
|
|
2099
2110
|
|
2100
2111
|
https://www.yuque.com/115yun/open/shtpzfhewv5nag11#WzRhM
|
2101
2112
|
|
2113
|
+
.. note::
|
2114
|
+
最多同时有 2 个授权登录,如果有新的授权加入,会先踢掉时间较早的那一个
|
2115
|
+
|
2102
2116
|
.. note::
|
2103
2117
|
code_challenge 默认用的字符串为 64 个 0,hash 算法为 md5
|
2104
2118
|
|
@@ -2401,7 +2415,7 @@ class ClientRequestMixin:
|
|
2401
2415
|
)
|
2402
2416
|
else:
|
2403
2417
|
return qrcode_token
|
2404
|
-
return run_gen_step(gen_step,
|
2418
|
+
return run_gen_step(gen_step, async_)
|
2405
2419
|
|
2406
2420
|
@overload
|
2407
2421
|
@classmethod
|
@@ -2501,7 +2515,7 @@ class ClientRequestMixin:
|
|
2501
2515
|
async_=async_,
|
2502
2516
|
**request_kwargs,
|
2503
2517
|
)
|
2504
|
-
return run_gen_step(gen_step,
|
2518
|
+
return run_gen_step(gen_step, async_)
|
2505
2519
|
|
2506
2520
|
########## Upload API ##########
|
2507
2521
|
|
@@ -2883,7 +2897,7 @@ class ClientRequestMixin:
|
|
2883
2897
|
async_=async_,
|
2884
2898
|
**request_kwargs,
|
2885
2899
|
)
|
2886
|
-
return run_gen_step(gen_step,
|
2900
|
+
return run_gen_step(gen_step, async_)
|
2887
2901
|
|
2888
2902
|
@overload
|
2889
2903
|
def read_bytes_range(
|
@@ -2998,7 +3012,7 @@ class ClientRequestMixin:
|
|
2998
3012
|
async_=async_,
|
2999
3013
|
**request_kwargs,
|
3000
3014
|
)
|
3001
|
-
return run_gen_step(gen_step,
|
3015
|
+
return run_gen_step(gen_step, async_)
|
3002
3016
|
|
3003
3017
|
|
3004
3018
|
class P115OpenClient(ClientRequestMixin):
|
@@ -3094,7 +3108,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
3094
3108
|
self.refresh_token = data["refresh_token"]
|
3095
3109
|
self.access_token = data["access_token"]
|
3096
3110
|
return self
|
3097
|
-
return run_gen_step(gen_step,
|
3111
|
+
return run_gen_step(gen_step, async_)
|
3098
3112
|
|
3099
3113
|
@classmethod
|
3100
3114
|
def from_token(cls, /, access_token: str, refresh_token: str) -> P115OpenClient:
|
@@ -3170,7 +3184,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
3170
3184
|
self.refresh_token = data["refresh_token"]
|
3171
3185
|
self.access_token = data["access_token"]
|
3172
3186
|
return data
|
3173
|
-
return run_gen_step(gen_step,
|
3187
|
+
return run_gen_step(gen_step, async_)
|
3174
3188
|
|
3175
3189
|
@overload
|
3176
3190
|
def download_url(
|
@@ -3925,7 +3939,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
3925
3939
|
"""获取视频在线播放地址(和视频文件相关数据)
|
3926
3940
|
|
3927
3941
|
GET https://proapi.115.com/open/video/play
|
3928
|
-
|
3942
|
+
|
3929
3943
|
.. admonition:: Reference
|
3930
3944
|
|
3931
3945
|
https://www.yuque.com/115yun/open/hqglxv3cedi3p9dz
|
@@ -4919,7 +4933,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
4919
4933
|
check_response(resp)
|
4920
4934
|
resp["data"] = {**payload, **resp["data"], "sha1": filesha1, "cid": pid}
|
4921
4935
|
return resp
|
4922
|
-
return run_gen_step(gen_step,
|
4936
|
+
return run_gen_step(gen_step, async_)
|
4923
4937
|
|
4924
4938
|
@overload
|
4925
4939
|
def upload_file(
|
@@ -5264,7 +5278,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
5264
5278
|
async_=async_, # type: ignore
|
5265
5279
|
**request_kwargs,
|
5266
5280
|
)
|
5267
|
-
return run_gen_step(gen_step,
|
5281
|
+
return run_gen_step(gen_step, async_)
|
5268
5282
|
|
5269
5283
|
@overload
|
5270
5284
|
def user_info(
|
@@ -5398,7 +5412,9 @@ class P115Client(P115OpenClient):
|
|
5398
5412
|
"""115 的客户端对象
|
5399
5413
|
|
5400
5414
|
.. note::
|
5401
|
-
目前允许 1 个用户同时登录多个开放平台应用(用 AppID
|
5415
|
+
目前允许 1 个用户同时登录多个开放平台应用(用 AppID 区别),也允许多次授权登录同 1 个应用
|
5416
|
+
|
5417
|
+
目前最多同时有 2 个授权登录登录,如果有新的授权加入,会先踢掉时间较早的那一个
|
5402
5418
|
|
5403
5419
|
目前不允许短时间内再次用 `refresh_token` 刷新 `access_token`,但你可以用登录的方式再次授权登录以获取 `access_token`,即可不受频率限制
|
5404
5420
|
|
@@ -5700,7 +5716,7 @@ class P115Client(P115OpenClient):
|
|
5700
5716
|
)
|
5701
5717
|
setattr(self, "check_for_relogin", check_for_relogin)
|
5702
5718
|
return self
|
5703
|
-
return run_gen_step(gen_step,
|
5719
|
+
return run_gen_step(gen_step, async_)
|
5704
5720
|
|
5705
5721
|
@locked_cacheproperty
|
5706
5722
|
def request_lock(self, /) -> Lock:
|
@@ -5872,7 +5888,7 @@ class P115Client(P115OpenClient):
|
|
5872
5888
|
check_response(resp)
|
5873
5889
|
setattr(self, "cookies", resp["data"]["cookie"])
|
5874
5890
|
return self
|
5875
|
-
return run_gen_step(gen_step,
|
5891
|
+
return run_gen_step(gen_step, async_)
|
5876
5892
|
|
5877
5893
|
@overload
|
5878
5894
|
def login_with_app(
|
@@ -6004,7 +6020,7 @@ class P115Client(P115OpenClient):
|
|
6004
6020
|
async_=async_,
|
6005
6021
|
**request_kwargs,
|
6006
6022
|
)
|
6007
|
-
return run_gen_step(gen_step,
|
6023
|
+
return run_gen_step(gen_step, async_)
|
6008
6024
|
|
6009
6025
|
@overload
|
6010
6026
|
def login_without_app(
|
@@ -6062,7 +6078,7 @@ class P115Client(P115OpenClient):
|
|
6062
6078
|
)
|
6063
6079
|
check_response(resp)
|
6064
6080
|
return uid
|
6065
|
-
return run_gen_step(gen_step,
|
6081
|
+
return run_gen_step(gen_step, async_)
|
6066
6082
|
|
6067
6083
|
@overload
|
6068
6084
|
def login_info_open(
|
@@ -6111,7 +6127,7 @@ class P115Client(P115OpenClient):
|
|
6111
6127
|
"name": tip_txt[:-10].removeprefix("\ufeff"),
|
6112
6128
|
"icon": resp["data"]["icon"],
|
6113
6129
|
}
|
6114
|
-
return run_gen_step(gen_step,
|
6130
|
+
return run_gen_step(gen_step, async_)
|
6115
6131
|
|
6116
6132
|
@overload
|
6117
6133
|
def login_with_open(
|
@@ -6146,6 +6162,9 @@ class P115Client(P115OpenClient):
|
|
6146
6162
|
) -> dict | Coroutine[Any, Any, dict]:
|
6147
6163
|
"""登录某个开放接口应用
|
6148
6164
|
|
6165
|
+
.. note::
|
6166
|
+
同一个开放应用 id,最多同时有 2 个登入,如果有新的登录,则自动踢掉较早的那一个
|
6167
|
+
|
6149
6168
|
:param app_id: AppID
|
6150
6169
|
:param show_warning: 是否显示提示信息
|
6151
6170
|
:param async_: 是否异步
|
@@ -6163,7 +6182,7 @@ class P115Client(P115OpenClient):
|
|
6163
6182
|
resp = yield self.login_qrcode_scan_confirm(login_uid, async_=async_, **request_kwargs)
|
6164
6183
|
check_response(resp)
|
6165
6184
|
return self.login_qrcode_access_token_open(login_uid, async_=async_, **request_kwargs)
|
6166
|
-
return run_gen_step(gen_step,
|
6185
|
+
return run_gen_step(gen_step, async_)
|
6167
6186
|
|
6168
6187
|
@overload
|
6169
6188
|
def login_another_app(
|
@@ -6309,7 +6328,7 @@ class P115Client(P115OpenClient):
|
|
6309
6328
|
if self is not inst and ssoent == inst.login_ssoent:
|
6310
6329
|
warn(f"login with the same ssoent {ssoent!r}, {self!r} will expire within 60 seconds", category=P115Warning)
|
6311
6330
|
return inst
|
6312
|
-
return run_gen_step(gen_step,
|
6331
|
+
return run_gen_step(gen_step, async_)
|
6313
6332
|
|
6314
6333
|
@overload
|
6315
6334
|
def login_another_open(
|
@@ -6403,7 +6422,7 @@ class P115Client(P115OpenClient):
|
|
6403
6422
|
inst.access_token = data["access_token"]
|
6404
6423
|
inst.app_id = app_id
|
6405
6424
|
return inst
|
6406
|
-
return run_gen_step(gen_step,
|
6425
|
+
return run_gen_step(gen_step, async_)
|
6407
6426
|
|
6408
6427
|
@overload
|
6409
6428
|
@classmethod
|
@@ -6522,7 +6541,7 @@ class P115Client(P115OpenClient):
|
|
6522
6541
|
resp = yield cls.login_qrcode_scan_result(uid, app, async_=async_, **request_kwargs)
|
6523
6542
|
cookies = check_response(resp)["data"]["cookie"]
|
6524
6543
|
return cls(cookies, check_for_relogin=check_for_relogin)
|
6525
|
-
return run_gen_step(gen_step,
|
6544
|
+
return run_gen_step(gen_step, async_)
|
6526
6545
|
|
6527
6546
|
@overload
|
6528
6547
|
def logout(
|
@@ -6805,7 +6824,7 @@ class P115Client(P115OpenClient):
|
|
6805
6824
|
if check and isinstance(resp, dict):
|
6806
6825
|
check_response(resp)
|
6807
6826
|
return resp
|
6808
|
-
return run_gen_step(gen_step,
|
6827
|
+
return run_gen_step(gen_step, async_)
|
6809
6828
|
|
6810
6829
|
def request(
|
6811
6830
|
self,
|
@@ -7697,7 +7716,7 @@ class P115Client(P115OpenClient):
|
|
7697
7716
|
async_=async_,
|
7698
7717
|
**request_kwargs,
|
7699
7718
|
)
|
7700
|
-
return run_gen_step(gen_step,
|
7719
|
+
return run_gen_step(gen_step, async_)
|
7701
7720
|
|
7702
7721
|
########## Download API ##########
|
7703
7722
|
|
@@ -9946,7 +9965,7 @@ class P115Client(P115OpenClient):
|
|
9946
9965
|
:payload:
|
9947
9966
|
- file_id: int | str
|
9948
9967
|
- file_id[]: int | str
|
9949
|
-
...
|
9968
|
+
- ...
|
9950
9969
|
- file_id[0]: int | str
|
9951
9970
|
- file_id[1]: int | str
|
9952
9971
|
- ...
|
@@ -10553,7 +10572,7 @@ class P115Client(P115OpenClient):
|
|
10553
10572
|
|
10554
10573
|
.. caution::
|
10555
10574
|
这个接口有些问题,当 custom_order=1 时:
|
10556
|
-
|
10575
|
+
|
10557
10576
|
1. 如果设定 limit=1 可能会报错
|
10558
10577
|
2. fc_mix 无论怎么设置,都和 fc_mix=0 的效果相同(即目录总是置顶),但设置为 custom_order=2 就好了
|
10559
10578
|
|
@@ -12152,7 +12171,7 @@ class P115Client(P115OpenClient):
|
|
12152
12171
|
- offset: int = 0 💡 索引偏移,索引从 0 开始计算
|
12153
12172
|
- is_asc: 0 | 1 = <default> 💡 是否升序排列
|
12154
12173
|
- next: 0 | 1 = <default>
|
12155
|
-
- order: str = <default> 💡 用某字段排序
|
12174
|
+
- order: str = <default> 💡 用某字段排序
|
12156
12175
|
|
12157
12176
|
- 文件名:"file_name"
|
12158
12177
|
- 文件大小:"file_size"
|
@@ -12705,6 +12724,7 @@ class P115Client(P115OpenClient):
|
|
12705
12724
|
为单个文件或目录,设置一个不存在的标签 id,比如 1,会清空标签,但可产生事件(批量设置时无事件,可能是 bug)
|
12706
12725
|
|
12707
12726
|
.. code:: python
|
12727
|
+
|
12708
12728
|
client.fs_label_set(id, 1)
|
12709
12729
|
"""
|
12710
12730
|
return self._fs_edit_set(payload, "file_label", label, async_=async_, **request_kwargs)
|
@@ -13005,9 +13025,10 @@ class P115Client(P115OpenClient):
|
|
13005
13025
|
"""新建目录
|
13006
13026
|
|
13007
13027
|
.. todo::
|
13008
|
-
- name: str 💡 目录名
|
13009
13028
|
待破解
|
13010
13029
|
|
13030
|
+
- name: str 💡 目录名
|
13031
|
+
|
13011
13032
|
POST https://proapi.115.com/android/1.0/folder/update
|
13012
13033
|
"""
|
13013
13034
|
api = complete_proapi("/folder/update", base_url, app)
|
@@ -16398,7 +16419,7 @@ class P115Client(P115OpenClient):
|
|
16398
16419
|
if device is None:
|
16399
16420
|
return None
|
16400
16421
|
return device["icon"]
|
16401
|
-
return run_gen_step(gen_step,
|
16422
|
+
return run_gen_step(gen_step, async_)
|
16402
16423
|
|
16403
16424
|
@overload
|
16404
16425
|
def login_open_auth_detail(
|
@@ -16922,7 +16943,7 @@ class P115Client(P115OpenClient):
|
|
16922
16943
|
return get_default_request()(url=api, async_=async_, **request_kwargs)
|
16923
16944
|
else:
|
16924
16945
|
return request(url=api, **request_kwargs)
|
16925
|
-
return run_gen_step(gen_step,
|
16946
|
+
return run_gen_step(gen_step, async_)
|
16926
16947
|
|
16927
16948
|
@overload
|
16928
16949
|
def logout_by_ssoent(
|
@@ -21119,7 +21140,7 @@ class P115Client(P115OpenClient):
|
|
21119
21140
|
if resp["state"]:
|
21120
21141
|
self.user_key = resp["data"]["userkey"]
|
21121
21142
|
return resp
|
21122
|
-
return run_gen_step(gen_step,
|
21143
|
+
return run_gen_step(gen_step, async_)
|
21123
21144
|
|
21124
21145
|
@overload
|
21125
21146
|
def upload_resume(
|
@@ -21486,7 +21507,7 @@ class P115Client(P115OpenClient):
|
|
21486
21507
|
"pickcode": resp["pickcode"],
|
21487
21508
|
}
|
21488
21509
|
return resp
|
21489
|
-
return run_gen_step(gen_step,
|
21510
|
+
return run_gen_step(gen_step, async_)
|
21490
21511
|
|
21491
21512
|
@overload
|
21492
21513
|
def upload_file_sample(
|
@@ -21622,7 +21643,7 @@ class P115Client(P115OpenClient):
|
|
21622
21643
|
async_=async_,
|
21623
21644
|
**request_kwargs,
|
21624
21645
|
)
|
21625
|
-
return run_gen_step(gen_step,
|
21646
|
+
return run_gen_step(gen_step, async_)
|
21626
21647
|
|
21627
21648
|
# TODO: 分块上传时,允许一定次数的重试
|
21628
21649
|
# TODO: 不妨单独为分块上传做一个封装
|
@@ -21984,7 +22005,7 @@ class P115Client(P115OpenClient):
|
|
21984
22005
|
async_=async_, # type: ignore
|
21985
22006
|
**request_kwargs,
|
21986
22007
|
)
|
21987
|
-
return run_gen_step(gen_step,
|
22008
|
+
return run_gen_step(gen_step, async_)
|
21988
22009
|
|
21989
22010
|
########## User API ##########
|
21990
22011
|
|
p115client/tool/attr.py
CHANGED
@@ -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], dict_cls=AttrDict)
|
75
|
-
return run_gen_step(gen_step,
|
75
|
+
return run_gen_step(gen_step, async_)
|
76
76
|
|
77
77
|
|
78
78
|
def type_of_attr(attr: Mapping, /) -> int:
|
p115client/tool/auth.py
CHANGED
p115client/tool/download.py
CHANGED
@@ -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, async_)
|
149
149
|
|
150
150
|
|
151
151
|
@overload
|
@@ -228,7 +228,7 @@ def iter_url_batches(
|
|
228
228
|
is_directory=False,
|
229
229
|
headers=headers,
|
230
230
|
))
|
231
|
-
return run_gen_step_iter(gen_step,
|
231
|
+
return run_gen_step_iter(gen_step, async_)
|
232
232
|
|
233
233
|
|
234
234
|
@overload
|
@@ -403,7 +403,7 @@ def iter_files_with_url(
|
|
403
403
|
**request_kwargs,
|
404
404
|
)
|
405
405
|
yield Yield(attr)
|
406
|
-
return run_gen_step_iter(gen_step,
|
406
|
+
return run_gen_step_iter(gen_step, async_)
|
407
407
|
|
408
408
|
|
409
409
|
@overload
|
@@ -561,7 +561,7 @@ def iter_images_with_url(
|
|
561
561
|
**request_kwargs,
|
562
562
|
)
|
563
563
|
yield Yield(attr)
|
564
|
-
return run_gen_step_iter(gen_step,
|
564
|
+
return run_gen_step_iter(gen_step, async_)
|
565
565
|
|
566
566
|
|
567
567
|
@overload
|
@@ -746,7 +746,7 @@ def iter_subtitles_with_url(
|
|
746
746
|
**request_kwargs,
|
747
747
|
)
|
748
748
|
yield Yield(attr)
|
749
|
-
return run_gen_step_iter(gen_step,
|
749
|
+
return run_gen_step_iter(gen_step, async_)
|
750
750
|
|
751
751
|
|
752
752
|
@overload
|
@@ -836,7 +836,7 @@ def iter_subtitle_batches(
|
|
836
836
|
pass
|
837
837
|
finally:
|
838
838
|
yield client.fs_delete(scid, async_=async_, **request_kwargs)
|
839
|
-
return run_gen_step_iter(gen_step,
|
839
|
+
return run_gen_step_iter(gen_step, async_)
|
840
840
|
|
841
841
|
|
842
842
|
@overload
|
@@ -1077,7 +1077,7 @@ def make_strm(
|
|
1077
1077
|
if use_abspath is not None:
|
1078
1078
|
params["path_already"] = path_already
|
1079
1079
|
yield (async_batch if async_ else thread_batch)(
|
1080
|
-
lambda attr: run_gen_step(save(attr),
|
1080
|
+
lambda attr: run_gen_step(save(attr), async_),
|
1081
1081
|
(iter_files if use_abspath is None else iter_files_with_path)(
|
1082
1082
|
client,
|
1083
1083
|
cid,
|
@@ -1114,7 +1114,7 @@ def make_strm(
|
|
1114
1114
|
"ignore": ignored,
|
1115
1115
|
"remove": removed,
|
1116
1116
|
}
|
1117
|
-
return run_gen_step(gen_step,
|
1117
|
+
return run_gen_step(gen_step, async_)
|
1118
1118
|
|
1119
1119
|
|
1120
1120
|
@overload
|
@@ -1265,7 +1265,7 @@ def iter_download_nodes(
|
|
1265
1265
|
finally:
|
1266
1266
|
yield shutdown()
|
1267
1267
|
if pickcode:
|
1268
|
-
return run_gen_step_iter(gen_step(pickcode),
|
1268
|
+
return run_gen_step_iter(gen_step(pickcode), async_)
|
1269
1269
|
else:
|
1270
1270
|
def chain():
|
1271
1271
|
with with_iter_next(iterdir(
|
@@ -1283,12 +1283,8 @@ def iter_download_nodes(
|
|
1283
1283
|
yield Yield(
|
1284
1284
|
{"fid": str(attr["id"]), "pid": "0", "fn": attr["name"]}
|
1285
1285
|
)
|
1286
|
-
yield YieldFrom(run_gen_step_iter(
|
1287
|
-
|
1288
|
-
may_call=False,
|
1289
|
-
async_=async_,
|
1290
|
-
))
|
1291
|
-
return run_gen_step_iter(chain, may_call=False, async_=async_)
|
1286
|
+
yield YieldFrom(run_gen_step_iter(gen_step(attr["pickcode"]), async_))
|
1287
|
+
return run_gen_step_iter(chain, async_)
|
1292
1288
|
|
1293
1289
|
|
1294
1290
|
@overload
|
@@ -1435,11 +1431,7 @@ def iter_download_files(
|
|
1435
1431
|
**defaults,
|
1436
1432
|
})
|
1437
1433
|
for pickcode in pickcodes:
|
1438
|
-
yield YieldFrom(run_gen_step_iter(
|
1439
|
-
gen_step(pickcode),
|
1440
|
-
may_call=False,
|
1441
|
-
async_=async_,
|
1442
|
-
))
|
1434
|
+
yield YieldFrom(run_gen_step_iter(gen_step(pickcode), async_))
|
1443
1435
|
return
|
1444
1436
|
if not pickcode:
|
1445
1437
|
resp = yield client.fs_file_skim(cid, async_=async_, **request_kwargs)
|
@@ -1476,7 +1468,7 @@ def iter_download_files(
|
|
1476
1468
|
finally:
|
1477
1469
|
ancestors_loaded = True
|
1478
1470
|
if async_:
|
1479
|
-
task: Any = create_task(run_gen_step(load_ancestors,
|
1471
|
+
task: Any = create_task(run_gen_step(load_ancestors, True))
|
1480
1472
|
else:
|
1481
1473
|
task = run_as_thread(run_gen_step, load_ancestors)
|
1482
1474
|
cache: list[dict] = []
|
@@ -1510,7 +1502,7 @@ def iter_download_files(
|
|
1510
1502
|
else:
|
1511
1503
|
task.result()
|
1512
1504
|
yield YieldFrom(map(norm_attr, cache))
|
1513
|
-
return run_gen_step_iter(gen_step,
|
1505
|
+
return run_gen_step_iter(gen_step, async_)
|
1514
1506
|
|
1515
1507
|
|
1516
1508
|
@overload
|
@@ -1586,5 +1578,5 @@ def get_remaining_open_count(
|
|
1586
1578
|
for f in cache:
|
1587
1579
|
f.close()
|
1588
1580
|
return len(cache)
|
1589
|
-
return run_gen_step(gen_step,
|
1581
|
+
return run_gen_step(gen_step, async_)
|
1590
1582
|
|
p115client/tool/edit.py
CHANGED
@@ -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, 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, async_)
|
638
638
|
|
p115client/tool/export_dir.py
CHANGED
@@ -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, async_)
|
124
124
|
|
125
125
|
|
126
126
|
@overload
|
@@ -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, async_)
|
234
234
|
|
235
235
|
|
236
236
|
@overload
|
@@ -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, 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, 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, async_)
|
490
490
|
|
491
491
|
|
492
492
|
@overload
|
@@ -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, async_)
|
649
649
|
|