fundrive-pan115 2.0.99__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.
- fundrive_pan115-2.0.99.dist-info/METADATA +100 -0
- fundrive_pan115-2.0.99.dist-info/RECORD +97 -0
- fundrive_pan115-2.0.99.dist-info/WHEEL +4 -0
- fundrive_pan115-2.0.99.dist-info/licenses/LICENSE +21 -0
- fundrives/pan115/__init__.py +12 -0
- fundrives/pan115/_vendor/__init__.py +1 -0
- fundrives/pan115/_vendor/argtools.py +345 -0
- fundrives/pan115/_vendor/asynctools/__init__.py +12 -0
- fundrives/pan115/_vendor/asynctools/basic.py +177 -0
- fundrives/pan115/_vendor/asynctools/iter.py +576 -0
- fundrives/pan115/_vendor/asynctools/loop.py +258 -0
- fundrives/pan115/_vendor/asynctools/misc.py +132 -0
- fundrives/pan115/_vendor/asynctools/reduce.py +216 -0
- fundrives/pan115/_vendor/asynctools/type.py +54 -0
- fundrives/pan115/_vendor/cachedict.py +1005 -0
- fundrives/pan115/_vendor/concurrenttools/__init__.py +9 -0
- fundrives/pan115/_vendor/concurrenttools/basic.py +507 -0
- fundrives/pan115/_vendor/concurrenttools/iter_offset.py +737 -0
- fundrives/pan115/_vendor/concurrenttools/iter_page.py +989 -0
- fundrives/pan115/_vendor/cookietools.py +717 -0
- fundrives/pan115/_vendor/decotools.py +221 -0
- fundrives/pan115/_vendor/dictattr.py +176 -0
- fundrives/pan115/_vendor/dicttools.py +950 -0
- fundrives/pan115/_vendor/download.py +717 -0
- fundrives/pan115/_vendor/ed2k.py +116 -0
- fundrives/pan115/_vendor/ensure.py +196 -0
- fundrives/pan115/_vendor/errno2.py +284 -0
- fundrives/pan115/_vendor/filewrap.py +1964 -0
- fundrives/pan115/_vendor/glob_pattern.py +102 -0
- fundrives/pan115/_vendor/hashtools.py +509 -0
- fundrives/pan115/_vendor/http_request/__init__.py +583 -0
- fundrives/pan115/_vendor/http_request/extension/__init__.py +4 -0
- fundrives/pan115/_vendor/http_request/extension/request.py +774 -0
- fundrives/pan115/_vendor/http_response.py +283 -0
- fundrives/pan115/_vendor/httpfile.py +2162 -0
- fundrives/pan115/_vendor/id2dirnode.py +156 -0
- fundrives/pan115/_vendor/integer_tool.py +452 -0
- fundrives/pan115/_vendor/iter_collect.py +720 -0
- fundrives/pan115/_vendor/iterdir.py +917 -0
- fundrives/pan115/_vendor/iterutils/__init__.py +9 -0
- fundrives/pan115/_vendor/iterutils/dynamic.py +76 -0
- fundrives/pan115/_vendor/iterutils/gen_step.py +465 -0
- fundrives/pan115/_vendor/iterutils/misc.py +1032 -0
- fundrives/pan115/_vendor/p115cipher/__init__.py +194 -0
- fundrives/pan115/_vendor/p115cipher/aes.py +3831 -0
- fundrives/pan115/_vendor/p115cipher/util.py +553 -0
- fundrives/pan115/_vendor/p115oss/__init__.py +9 -0
- fundrives/pan115/_vendor/p115oss/api.py +432 -0
- fundrives/pan115/_vendor/p115oss/oss.py +1194 -0
- fundrives/pan115/_vendor/p115oss/upload.py +709 -0
- fundrives/pan115/_vendor/p115pickcode.py +256 -0
- fundrives/pan115/_vendor/posixpatht.py +435 -0
- fundrives/pan115/_vendor/property.py +86 -0
- fundrives/pan115/_vendor/socket_keepalive.py +77 -0
- fundrives/pan115/_vendor/sqlitetools.py +483 -0
- fundrives/pan115/_vendor/startfile.py +48 -0
- fundrives/pan115/_vendor/temporary.py +229 -0
- fundrives/pan115/_vendor/texttools/__init__.py +13 -0
- fundrives/pan115/_vendor/texttools/format.py +145 -0
- fundrives/pan115/_vendor/texttools/half_width.py +20 -0
- fundrives/pan115/_vendor/texttools/text.py +216 -0
- fundrives/pan115/_vendor/texttools/text_cycle.py +115 -0
- fundrives/pan115/_vendor/texttools/text_find.py +468 -0
- fundrives/pan115/_vendor/texttools/text_format.py +23 -0
- fundrives/pan115/_vendor/texttools/text_modify.py +17 -0
- fundrives/pan115/_vendor/undefined.py +42 -0
- fundrives/pan115/_vendor/urllib3_future_request.py +887 -0
- fundrives/pan115/client.py +30950 -0
- fundrives/pan115/const.py +1474 -0
- fundrives/pan115/exception.py +219 -0
- fundrives/pan115/fs/__init__.py +15 -0
- fundrives/pan115/fs/fs.py +996 -0
- fundrives/pan115/fs/fs_base.py +4289 -0
- fundrives/pan115/fs/fs_share.py +311 -0
- fundrives/pan115/fs/fs_zip.py +518 -0
- fundrives/pan115/py.typed +0 -0
- fundrives/pan115/tool/__init__.py +24 -0
- fundrives/pan115/tool/attr.py +2799 -0
- fundrives/pan115/tool/auth.py +172 -0
- fundrives/pan115/tool/clouddownload.py +212 -0
- fundrives/pan115/tool/download.py +1925 -0
- fundrives/pan115/tool/edit.py +2347 -0
- fundrives/pan115/tool/export_dir.py +832 -0
- fundrives/pan115/tool/extract.py +407 -0
- fundrives/pan115/tool/fs_files.py +299 -0
- fundrives/pan115/tool/history.py +383 -0
- fundrives/pan115/tool/iterdir.py +5394 -0
- fundrives/pan115/tool/life.py +591 -0
- fundrives/pan115/tool/media.py +5 -0
- fundrives/pan115/tool/pool.py +430 -0
- fundrives/pan115/tool/querydb.py +1254 -0
- fundrives/pan115/tool/tinydb.py +303 -0
- fundrives/pan115/tool/updatedb.py +609 -0
- fundrives/pan115/tool/upload.py +1590 -0
- fundrives/pan115/tool/xys.py +406 -0
- fundrives/pan115/type.py +223 -0
- fundrives/pan115/util.py +602 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: fundrive-pan115
|
|
3
|
+
Version: 2.0.99
|
|
4
|
+
Summary: 115网盘(p115client)云存储 API 封装
|
|
5
|
+
Project-URL: Organization, https://github.com/farfarfun
|
|
6
|
+
Project-URL: Repository, https://github.com/farfarfun/fundrive-pan115
|
|
7
|
+
Project-URL: Releases, https://github.com/farfarfun/fundrive-pan115/releases
|
|
8
|
+
Author-email: 牛哥 <niuliangtao@qq.com>, farfarfun <farfarfun@qq.com>
|
|
9
|
+
Maintainer-email: 牛哥 <niuliangtao@qq.com>, farfarfun <farfarfun@qq.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Python: >=3.12
|
|
13
|
+
Requires-Dist: brotli>=1.1.0
|
|
14
|
+
Requires-Dist: filelock>=3.16.0
|
|
15
|
+
Requires-Dist: httpx>=0.27.0
|
|
16
|
+
Requires-Dist: orjson>=3.10.0
|
|
17
|
+
Requires-Dist: pycryptodome>=3.20.0
|
|
18
|
+
Requires-Dist: qrcode>=7.4.0
|
|
19
|
+
Requires-Dist: sqlparse>=0.5.0
|
|
20
|
+
Requires-Dist: wcwidth>=0.2.13
|
|
21
|
+
Requires-Dist: yarl>=1.15.0
|
|
22
|
+
Requires-Dist: zstandard>=0.23.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# fundrive-pan115
|
|
26
|
+
|
|
27
|
+
115 网盘 Python API 封装(`fundrives.pan115`),从上游 [`p115client`](https://github.com/ChenyangGao/p115client)(`0.0.9.6.5.1`)完整迁入并自主维护,供 [fundrive](https://github.com/farfarfun-drive/fundrive) 及其他项目以统一命名空间稳定接入 115 网盘,避免受上游高频破坏性变更影响。
|
|
28
|
+
|
|
29
|
+
## 安装
|
|
30
|
+
|
|
31
|
+
本项目要求 Python 3.12 或更高版本。
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install fundrive-pan115
|
|
35
|
+
# 或
|
|
36
|
+
uv add fundrive-pan115
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 快速开始
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from pathlib import Path
|
|
43
|
+
from fundrives.pan115 import P115Client
|
|
44
|
+
|
|
45
|
+
# 方式一:使用 Cookie 字符串
|
|
46
|
+
client = P115Client(cookies="UID=...; CID=...; SEID=...; KID=...")
|
|
47
|
+
|
|
48
|
+
# 方式二:使用 Cookie 文件并支持扫码/续期
|
|
49
|
+
client = P115Client(Path("~/115-cookies.txt").expanduser(), app="qandroid")
|
|
50
|
+
client.login()
|
|
51
|
+
|
|
52
|
+
# 列出根目录文件
|
|
53
|
+
resp = client.fs_files(0)
|
|
54
|
+
print(resp)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 开发
|
|
58
|
+
|
|
59
|
+
安装开发依赖并运行检查与测试:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uv sync --group dev
|
|
63
|
+
uv run ruff check src tests
|
|
64
|
+
uv run ruff format --check src tests
|
|
65
|
+
uv run pytest -v
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
构建发行包:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
uv build
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 演进路线
|
|
75
|
+
|
|
76
|
+
1. **阶段 0(已完成)**:完整迁入 `p115client 0.0.9.6.5.1` 至 `fundrives.pan115` 命名空间,保持 API 100% 兼容,隔离上游高频改动。
|
|
77
|
+
2. **阶段 1 & 2(已完成)**:移除未使用的 `python-encode_uri`,将全部 35 个上游微包内联至 `fundrives.pan115._vendor/`,并用标准 `httpx` 替换 `urllib3-future` 避免劫持标准 `urllib3`,实现 **0 个上游作者微包依赖**(仅剩 10 个主流标准生态包)。
|
|
78
|
+
3. **后续持续演进**:按需精简未用模块并逐步收紧 `pyproject.toml` 中的 `per-file-ignores`。
|
|
79
|
+
|
|
80
|
+
## 命名空间说明
|
|
81
|
+
|
|
82
|
+
本包与 `fundrive-alipan`、`fundrive-baidu`、`fundrive-lanzou`、`fundrive-quark` 共用 PEP 420 隐式命名空间包 `fundrives`,**不得**在 `src/fundrives/` 下添加 `__init__.py`。
|
|
83
|
+
|
|
84
|
+
## 来源说明与第三方协议
|
|
85
|
+
|
|
86
|
+
`src/fundrives/pan115/` 源码派生自 [p115client](https://github.com/ChenyangGao/p115client)(版本 `0.0.9.6.5.1`),原始协议为 **MIT,Copyright (c) 2024 ChenyangGao**。完整声明见 [THIRD_PARTY_NOTICE.md](THIRD_PARTY_NOTICE.md)。
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 关于 farfarfun-drive
|
|
91
|
+
|
|
92
|
+
[farfarfun](https://github.com/farfarfun) 的网盘 / 云存储产品线:以
|
|
93
|
+
[fundrive](https://github.com/farfarfun-drive/fundrive) 的统一 `BaseDrive` 接口为核心,
|
|
94
|
+
配套各网盘的独立驱动包与蓝奏云 SDK / 桌面客户端。
|
|
95
|
+
|
|
96
|
+
- 🏠 组织主页:<https://github.com/farfarfun-drive>
|
|
97
|
+
- 📦 PyPI:<https://pypi.org/user/niuliangtao/>
|
|
98
|
+
- 📧 联系:farfarfun@qq.com
|
|
99
|
+
|
|
100
|
+
本项目基于 [MIT](LICENSE) 协议开源。
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
fundrives/pan115/__init__.py,sha256=zX0rsS6yrPzdHZcDDAd6CH2VBQae3teMKiy7mJ73m0c,251
|
|
2
|
+
fundrives/pan115/client.py,sha256=9-3C62e5UUd8djV_Tdk-I5cxG9szjUiFT9SD9lSizS8,1062419
|
|
3
|
+
fundrives/pan115/const.py,sha256=h2je8kGCZEQ5XQ-d-Y22sAlJOlWnOA2BxnI8S3mZFIU,42314
|
|
4
|
+
fundrives/pan115/exception.py,sha256=eu9Z7IQUEOFoLCUGn1TKoqyZqVTyYZJTE9tYIzGdsfI,6656
|
|
5
|
+
fundrives/pan115/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
fundrives/pan115/type.py,sha256=pn1FKbaRPaJ8OcOtKN-k1iCga7U_-9yYfVnCSUVzy4s,6330
|
|
7
|
+
fundrives/pan115/util.py,sha256=2wQ79-xZFMU4TQhXM3UCwU0ijXCJJioHFsF2d3FzJoo,18772
|
|
8
|
+
fundrives/pan115/_vendor/__init__.py,sha256=ky9UjuSl660U39xRJa9FwGwIW_TeG9a6xylFVUikpdE,104
|
|
9
|
+
fundrives/pan115/_vendor/argtools.py,sha256=-CXXE0qTDl013Te4NjQtkfMwdb7NSxUcFFqubgMu3Mw,10599
|
|
10
|
+
fundrives/pan115/_vendor/cachedict.py,sha256=zsZmvNgE-wkT2DjAA6AoO7aRUKRbBg9-23W-L27uoPY,30284
|
|
11
|
+
fundrives/pan115/_vendor/cookietools.py,sha256=T7pEuUuOBGA4aSk5qnGevZkm31O4MUur0wjGQ8ZvjwU,24265
|
|
12
|
+
fundrives/pan115/_vendor/decotools.py,sha256=fOmjRqEDSIlE6wOl1cWhaheSOeV05wohd2jenDIPIT8,6219
|
|
13
|
+
fundrives/pan115/_vendor/dictattr.py,sha256=wdKF1q_mAsBXsP_E2zpEC0Z15MbjHiIWsoAruZAbP9Y,4613
|
|
14
|
+
fundrives/pan115/_vendor/dicttools.py,sha256=fBBvG-kHkLLitrVu6xH50MdsA-bEqkpK4XCVeVBQrk8,21718
|
|
15
|
+
fundrives/pan115/_vendor/download.py,sha256=gwAUNpZ2uteSH7oCp6zhwZ-j_X7xJg4GRvVxX1lEm3s,22543
|
|
16
|
+
fundrives/pan115/_vendor/ed2k.py,sha256=9fBVKPfYZFnM3aIDMDRj2d-1qcCHDB0CAEmFqLGfWis,3629
|
|
17
|
+
fundrives/pan115/_vendor/ensure.py,sha256=Be1KdiOPhGreW7gqC15-wSA5UzAAlaHFXi1CqchebL0,4674
|
|
18
|
+
fundrives/pan115/_vendor/errno2.py,sha256=rsS2qfFAks3xkfpIkLytBrosV8ee128b8YKLw-nofF0,11213
|
|
19
|
+
fundrives/pan115/_vendor/filewrap.py,sha256=Vl1cgaoMzlg8J2hqOKxZWD2iCef1sIbJl73ltFANV3U,61723
|
|
20
|
+
fundrives/pan115/_vendor/glob_pattern.py,sha256=Mvw0QJhd0nsDAntNb-cUjUOpQ4cgDN7pnRJwX7-43Hw,2781
|
|
21
|
+
fundrives/pan115/_vendor/hashtools.py,sha256=kuPFZ617xv55Q3ZBr8_3uFsvijZOLlsWaVWiG1uRh74,15304
|
|
22
|
+
fundrives/pan115/_vendor/http_response.py,sha256=ELqG6z5Fvcr6CF8nJwpNVUu3C5zikVG_hRZlpA6l7Xw,8793
|
|
23
|
+
fundrives/pan115/_vendor/httpfile.py,sha256=UENuDIDK07vfBk_erAlnk1948EUajtJz-M5xPXgHv9E,70536
|
|
24
|
+
fundrives/pan115/_vendor/id2dirnode.py,sha256=AXwCqk5h3uJjRTJ-cK46TwED5QWAUnMUJUqVG-aKsv4,4467
|
|
25
|
+
fundrives/pan115/_vendor/integer_tool.py,sha256=Y5tDih3R6hzH52lj2o7xAHrEjsNDTy85ZChdqUAbEkM,11115
|
|
26
|
+
fundrives/pan115/_vendor/iter_collect.py,sha256=QjQYZINrnJfoysL3-aPK4Rvk0didQw_qJMXmbdk_wF4,23201
|
|
27
|
+
fundrives/pan115/_vendor/iterdir.py,sha256=hQZk3leIn_qJNZQif83GCOTWh_9q6JvS3FUZSD6I6jw,29375
|
|
28
|
+
fundrives/pan115/_vendor/p115pickcode.py,sha256=k20JFHeaKwfWP5eeQyV58EPCGUfLjR4zNqMP7KLOunA,9564
|
|
29
|
+
fundrives/pan115/_vendor/posixpatht.py,sha256=WbP4soP2RoxLH-vA7uhQQoIxWDGs7_HHNVu9tEqcYic,10636
|
|
30
|
+
fundrives/pan115/_vendor/property.py,sha256=VvKDmHKMjB8RHSTf8l-txJLZXbtQmqlOf2dhzHI9W7w,2701
|
|
31
|
+
fundrives/pan115/_vendor/socket_keepalive.py,sha256=kian8L-Y-FdXSr1p_ESojSw517NZLSpBRgP7ch979ho,2467
|
|
32
|
+
fundrives/pan115/_vendor/sqlitetools.py,sha256=o6IQS15S1eq_mrefp90iT67ni5q8RLMj0idliNSg6Ik,16128
|
|
33
|
+
fundrives/pan115/_vendor/startfile.py,sha256=6O7sSFuNWAjJjvadwojsyy4Wze0M3MRCx1ZvOvoi2Xk,1385
|
|
34
|
+
fundrives/pan115/_vendor/temporary.py,sha256=MBgf6NiWOtlrHZbn55dwT0rp1vueHWkSfJCPEMOXXUc,5788
|
|
35
|
+
fundrives/pan115/_vendor/undefined.py,sha256=WoO_yMTPGduUS_sVjD1E1R5LRklRjh1OtyLPdjR0JWQ,1063
|
|
36
|
+
fundrives/pan115/_vendor/urllib3_future_request.py,sha256=Nrm2VqFhNDC0vGuAZOU8kKl2jngo_oTAZbt4hj78Fy0,29836
|
|
37
|
+
fundrives/pan115/_vendor/asynctools/__init__.py,sha256=hZEmuCdsBGdpIIxjinTvw4Ku3Dv9nIIXCG_HvyBZj7g,249
|
|
38
|
+
fundrives/pan115/_vendor/asynctools/basic.py,sha256=xXrQtmZh_P9-r-6P6RUsQ1UKqFmJy41SnN-T1err9gE,3962
|
|
39
|
+
fundrives/pan115/_vendor/asynctools/iter.py,sha256=mrPZkp551ErFl9bVZ4wOCKIowOCHlZr_LDzFa8b4dFg,16061
|
|
40
|
+
fundrives/pan115/_vendor/asynctools/loop.py,sha256=tLkWtDmYkRZVx9Pis6HGJsDf7WpyaHIbL19NwgYc_6Q,6330
|
|
41
|
+
fundrives/pan115/_vendor/asynctools/misc.py,sha256=0slxONpBtmSOE0oT2V99GT-CXEIwO7yEoQX6zHkN09w,3240
|
|
42
|
+
fundrives/pan115/_vendor/asynctools/reduce.py,sha256=dSc7Ohij2vys586ahN0O1BdeO3ZR6C6sYyPBe9_kuNY,6227
|
|
43
|
+
fundrives/pan115/_vendor/asynctools/type.py,sha256=MNP2MHvwb5FsxdFE1iv7mwYQ2j4vU4WnH6wVs7SeJBA,1295
|
|
44
|
+
fundrives/pan115/_vendor/concurrenttools/__init__.py,sha256=6cIfxMdw5EOIv9KOtHXkAgC6U8iiN0PCmXzkqNG0pVI,199
|
|
45
|
+
fundrives/pan115/_vendor/concurrenttools/basic.py,sha256=RbLhUSBGMgI9fsbvDtDJB630Vzk8MBZn7HKDKa8Qf0c,13885
|
|
46
|
+
fundrives/pan115/_vendor/concurrenttools/iter_offset.py,sha256=mg-VCYhPgmZrFAT_YuUJLifyiBu9RbSNW9l4o0ysvFY,28665
|
|
47
|
+
fundrives/pan115/_vendor/concurrenttools/iter_page.py,sha256=5_CzHyyfH5brRhIxhrsTyxmNDRP9e7bnulrnre6aWSM,36458
|
|
48
|
+
fundrives/pan115/_vendor/http_request/__init__.py,sha256=svA48hTN3H7E_UvQbSc8-zkw2_pxjO5AvYo_aSZgX5E,19395
|
|
49
|
+
fundrives/pan115/_vendor/http_request/extension/__init__.py,sha256=3dvnzgkk04xtCSbdThHZxZH05H1BOuE3bzdFwADdY2U,63
|
|
50
|
+
fundrives/pan115/_vendor/http_request/extension/request.py,sha256=3jhLVqGoLlx5nTc7GL38skcYhA03ksmPuQu3H-v6dBc,27286
|
|
51
|
+
fundrives/pan115/_vendor/iterutils/__init__.py,sha256=e3TnEvFCdzg6jotU3JB95qHwcA2DrkRJjrTMLF1rYWs,193
|
|
52
|
+
fundrives/pan115/_vendor/iterutils/dynamic.py,sha256=CJiz4ZhsSdF60YlBnuOXvZE5tT9Xf4tG_1A8U-pNQ14,2028
|
|
53
|
+
fundrives/pan115/_vendor/iterutils/gen_step.py,sha256=7vSxCJ1CXTqZEKSEiwMSAWtEwZDGIlmU8Qeut3IsT88,11135
|
|
54
|
+
fundrives/pan115/_vendor/iterutils/misc.py,sha256=U6SOeltLU-G85Da67pQv6svHtf-8sEYp36Z6ytJtOkg,27622
|
|
55
|
+
fundrives/pan115/_vendor/p115cipher/__init__.py,sha256=Sx_q4Glyq4xzLitZZEdipasPuGvGQP5crOqCGBpS9g0,5406
|
|
56
|
+
fundrives/pan115/_vendor/p115cipher/aes.py,sha256=cwuAV9vaDzdnZgbjNvDL1htUy_8nXYK6v2MYIG3zKeo,74984
|
|
57
|
+
fundrives/pan115/_vendor/p115cipher/util.py,sha256=2Ir7gFsTKBTKDhaPstHc2REawU34XvviicL0cHn4KO8,14359
|
|
58
|
+
fundrives/pan115/_vendor/p115oss/__init__.py,sha256=iSzMjj0jRNET3NpjH6TaZJfFu21OX1OFslfMYmlKJiU,186
|
|
59
|
+
fundrives/pan115/_vendor/p115oss/api.py,sha256=lSjjvuynZGCXZLXbRRhcOweAbXY_4V8RuCyu5PhtSUA,13460
|
|
60
|
+
fundrives/pan115/_vendor/p115oss/oss.py,sha256=PFocK8rjEVPWbazBcNugp8Ipb4gCsTlbSstlKB3ICyU,34540
|
|
61
|
+
fundrives/pan115/_vendor/p115oss/upload.py,sha256=6cwcNB72naSLmywQD9-16kNLXTrrCS08h7GMLP-TTQg,26227
|
|
62
|
+
fundrives/pan115/_vendor/texttools/__init__.py,sha256=m5freHqrpSDCFcP1IAbqr2ex_xWc53skNN3kwQBdj-g,299
|
|
63
|
+
fundrives/pan115/_vendor/texttools/format.py,sha256=et4Rw6zMmxqIVqQ5LxDAZK3aSfLpJFqDm-CLmoUkcl4,5780
|
|
64
|
+
fundrives/pan115/_vendor/texttools/half_width.py,sha256=akVzDAPTDgtnOwFYD97QX3SjXNlNPuj1zpAkSoWmAAU,518
|
|
65
|
+
fundrives/pan115/_vendor/texttools/text.py,sha256=eOdCUdD1QTrlOLrnrbIxonIKwmCcTSTU4nEOEQqEEwA,5711
|
|
66
|
+
fundrives/pan115/_vendor/texttools/text_cycle.py,sha256=aAGBIN2Pfwr1x7YSexVspyOyfbhjxqW2hmbkOPjwd64,3310
|
|
67
|
+
fundrives/pan115/_vendor/texttools/text_find.py,sha256=9sPO8hjjTXO1IrPUdZ8c_c7I248soG7urubHO72GNNA,15691
|
|
68
|
+
fundrives/pan115/_vendor/texttools/text_format.py,sha256=CTL4cH6hrsGm3Bq8cgOzIVclU8jY_RZumB4h0vgETHc,546
|
|
69
|
+
fundrives/pan115/_vendor/texttools/text_modify.py,sha256=Jh4PR3dPbfF-agH7yoJI6pub0fuW-H0SBfKAR2O0Q80,446
|
|
70
|
+
fundrives/pan115/fs/__init__.py,sha256=Av-s6vB4i5DO_safXTWup-zpRKNonS9FJ65DeOlIr_8,347
|
|
71
|
+
fundrives/pan115/fs/fs.py,sha256=mHL8gLjdhv_trMotbROtwG3U5wcbnJ8sRJ5NFsJ88Lo,28430
|
|
72
|
+
fundrives/pan115/fs/fs_base.py,sha256=YMsyBb8o1uqvdzbnlF1XfnHEwVC-CDoLkLfBwstJPks,123758
|
|
73
|
+
fundrives/pan115/fs/fs_share.py,sha256=9iYS45EiIZBqGgmfVbjtvQ66VzJjrBGyndo3cfhJXDA,8431
|
|
74
|
+
fundrives/pan115/fs/fs_zip.py,sha256=mXUisLRf6AWSDxpzE6aYQOHN_pfqZduNuxIQpw3TjSs,15139
|
|
75
|
+
fundrives/pan115/tool/__init__.py,sha256=t1xozxOscwMioNJuUEbgQbKMDFNqRh4cJ009l0PGkRw,568
|
|
76
|
+
fundrives/pan115/tool/attr.py,sha256=qjuNZVjATYcwcJQeljfdfPJaHdpykAbS9c5k6SiMPhk,93915
|
|
77
|
+
fundrives/pan115/tool/auth.py,sha256=rCsp4oSDBmhiVFYv_mUgMxKPccgmuzqTCd3B0-_8Bkg,4728
|
|
78
|
+
fundrives/pan115/tool/clouddownload.py,sha256=4XIldtx62riyRB8aD44BQcNDt-_dp6AOpENgp_yYO3Q,6629
|
|
79
|
+
fundrives/pan115/tool/download.py,sha256=pJk_bflbvEklts167E_Noe_xeK896PoJRw2CHnckUWs,71407
|
|
80
|
+
fundrives/pan115/tool/edit.py,sha256=OoAycdWC4B5LXBN06-VDaBs_YBW8ZmKSaHnd-Uaw7EA,72162
|
|
81
|
+
fundrives/pan115/tool/export_dir.py,sha256=0xhApCHJ4Xb3ixNE3lSBh72A1uIBwFPUs2_-0l7A95I,25954
|
|
82
|
+
fundrives/pan115/tool/extract.py,sha256=oQ-QUl8eHgd7Bro6aVcgW9ng81NqPgOKCW0T1FAgoho,12467
|
|
83
|
+
fundrives/pan115/tool/fs_files.py,sha256=k0CgpFkuchA0wuhPsC1zz1XUYqSXhoxu6IX3nbjF9zA,10569
|
|
84
|
+
fundrives/pan115/tool/history.py,sha256=ixo6z-6B708a8jKrersAWUwoMlV6SGFsGLu2U12T3UE,12542
|
|
85
|
+
fundrives/pan115/tool/iterdir.py,sha256=znUci3Vc3CrBplKweLSsnSta6fAQM6fmRYbI_kozp18,194929
|
|
86
|
+
fundrives/pan115/tool/life.py,sha256=riK71B5hXVpyd6Cu8RNPfIZAPbYTttaEnrRN4Z-o6HI,21303
|
|
87
|
+
fundrives/pan115/tool/media.py,sha256=l5ssPsw4EPgvympVtDpG_2CBxJdW0L9JMWx6iIuN6cg,165
|
|
88
|
+
fundrives/pan115/tool/pool.py,sha256=4fVfNeB8QSKyA7ZALJcxXgbaxzgznLgCNe-yjf_wXVU,14681
|
|
89
|
+
fundrives/pan115/tool/querydb.py,sha256=htvVMsBWSfxhUPqlfcRqfeoB94Ct3WrtGAu3-mXakx8,43187
|
|
90
|
+
fundrives/pan115/tool/tinydb.py,sha256=yfSmbxIDXClLJX7siKrWwoH_toGnHBPewUdy5FcdZJU,9277
|
|
91
|
+
fundrives/pan115/tool/updatedb.py,sha256=k5qs1DO6U5L7mk-0F8HXM4Nf2wVmLBhr97J6WWvAvuQ,19326
|
|
92
|
+
fundrives/pan115/tool/upload.py,sha256=ruVfckMxkDXftVYibMuTRn0aBU1hyrr3A6G9a86oEus,53065
|
|
93
|
+
fundrives/pan115/tool/xys.py,sha256=-6AtnaH0-2wRc7NyF2Y0AqMd74v7R_U85NRp_zPtXWc,10463
|
|
94
|
+
fundrive_pan115-2.0.99.dist-info/METADATA,sha256=ZnonqOE4lwNDiR0cgU5r74yuRONTXc74et1eENwA4As,3578
|
|
95
|
+
fundrive_pan115-2.0.99.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
96
|
+
fundrive_pan115-2.0.99.dist-info/licenses/LICENSE,sha256=BvvS-yeQjeaYgHQW2Vh7Msedpzoc-r7mnjNCpqUUbgM,1066
|
|
97
|
+
fundrive_pan115-2.0.99.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 farfarfun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
__author__ = "ChenyangGao <https://chenyanggao.github.io>"
|
|
5
|
+
__version__ = (0, 0, 9)
|
|
6
|
+
|
|
7
|
+
from .client import *
|
|
8
|
+
from .const import *
|
|
9
|
+
from .exception import *
|
|
10
|
+
from .fs import *
|
|
11
|
+
from .type import *
|
|
12
|
+
from . import util
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""内置的纯 Python 工具模块(从上游 MIT 微包迁入,逐步去外部微包依赖)。"""
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
|
|
4
|
+
"""This module provides several classes, which are used to collect
|
|
5
|
+
some arguments at one time and then use them repeatedly later.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__author__ = "ChenyangGao <https://chenyanggao.github.io>"
|
|
9
|
+
__version__ = (0, 0, 4)
|
|
10
|
+
__all__ = ["argcount", "has_keyword_arg", "Args", "UpdativeArgs", "Call"]
|
|
11
|
+
|
|
12
|
+
from collections.abc import Callable
|
|
13
|
+
from copy import copy
|
|
14
|
+
from functools import partial, update_wrapper
|
|
15
|
+
from inspect import getfullargspec, signature, Parameter
|
|
16
|
+
from types import MethodType, MethodWrapperType
|
|
17
|
+
from typing import Any
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def argcount(func: Callable, /) -> int:
|
|
21
|
+
if isinstance(func, partial):
|
|
22
|
+
return max(0, argcount(func.func) - len(func.args))
|
|
23
|
+
is_method = isinstance(func, (MethodType, MethodWrapperType))
|
|
24
|
+
try:
|
|
25
|
+
return func.__code__.co_argcount - is_method
|
|
26
|
+
except AttributeError:
|
|
27
|
+
return len(getfullargspec(func).args) - is_method
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def has_keyword_arg(func: Callable, arg_name: str, /) -> bool:
|
|
31
|
+
try:
|
|
32
|
+
sig = signature(func)
|
|
33
|
+
except ValueError:
|
|
34
|
+
try:
|
|
35
|
+
arg_spec = getfullargspec(func)
|
|
36
|
+
return bool(arg_spec.varkw or arg_name in arg_spec.kwonlyargs)
|
|
37
|
+
except TypeError:
|
|
38
|
+
return False
|
|
39
|
+
else:
|
|
40
|
+
for name, param in sig.parameters.items():
|
|
41
|
+
match param.kind:
|
|
42
|
+
case Parameter.POSITIONAL_OR_KEYWORD | Parameter.KEYWORD_ONLY:
|
|
43
|
+
if name == arg_name:
|
|
44
|
+
return True
|
|
45
|
+
case Parameter.VAR_KEYWORD:
|
|
46
|
+
return True
|
|
47
|
+
return False
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Args:
|
|
51
|
+
"""Takes some positional arguments and keyword arguments,
|
|
52
|
+
and put them into an instance, which can be used repeatedly
|
|
53
|
+
every next time.
|
|
54
|
+
|
|
55
|
+
Fields::
|
|
56
|
+
self.args: the collected positional arguments
|
|
57
|
+
self.kwargs: the collected keyword arguments
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
__slots__ = ("args", "kwargs")
|
|
61
|
+
|
|
62
|
+
def __init__(self, /, *args, **kwargs):
|
|
63
|
+
self.args = args
|
|
64
|
+
self.kwargs = kwargs
|
|
65
|
+
|
|
66
|
+
def __call__[T](self, /, func: Callable[..., T]) -> T:
|
|
67
|
+
"""Pass in the collected positional arguments and keyword
|
|
68
|
+
arguments when calling the callable `func`."""
|
|
69
|
+
return func(*self.args, **self.kwargs)
|
|
70
|
+
|
|
71
|
+
def __copy__(self, /):
|
|
72
|
+
return type(self)(*self.args, **self.kwargs)
|
|
73
|
+
|
|
74
|
+
def __eq__(self, other):
|
|
75
|
+
if isinstance(other, Args):
|
|
76
|
+
return self.args == other.args and self.kwargs == other.kwargs
|
|
77
|
+
return False
|
|
78
|
+
|
|
79
|
+
def __getitem__(self, idx: int | slice | str | tuple[int | slice | str, ...], /):
|
|
80
|
+
cls = type(self)
|
|
81
|
+
pget = self.args.__getitem__
|
|
82
|
+
if isinstance(idx, (int, slice)):
|
|
83
|
+
return cls(pget(idx))
|
|
84
|
+
kget = self.kwargs.__getitem__
|
|
85
|
+
if isinstance(idx, str):
|
|
86
|
+
return cls(idx=kget(idx))
|
|
87
|
+
else:
|
|
88
|
+
pargs: list = []
|
|
89
|
+
kargs: dict = {}
|
|
90
|
+
add_parg = pargs.append
|
|
91
|
+
for idx_ in idx:
|
|
92
|
+
if isinstance(idx_, (int, slice)):
|
|
93
|
+
add_parg(pget(idx_))
|
|
94
|
+
else:
|
|
95
|
+
kargs[idx_] = kget(idx_)
|
|
96
|
+
return cls(*pargs, **kargs)
|
|
97
|
+
|
|
98
|
+
def __iter__(self, /):
|
|
99
|
+
return iter((self.args, self.kwargs))
|
|
100
|
+
|
|
101
|
+
def __repr__(self):
|
|
102
|
+
return "%s(%s)" % (
|
|
103
|
+
type(self).__qualname__,
|
|
104
|
+
", ".join(
|
|
105
|
+
(
|
|
106
|
+
*map(repr, self.args),
|
|
107
|
+
*("%s=%r" % e for e in self.kwargs.items()),
|
|
108
|
+
)
|
|
109
|
+
),
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
@classmethod
|
|
113
|
+
def call[T](cls, /, func: Callable[..., T], args: Any = ()) -> T:
|
|
114
|
+
"""Call the callable `func` and pass in the arguments `args`.
|
|
115
|
+
|
|
116
|
+
The actual behavior as below:
|
|
117
|
+
if isinstance(args, Args):
|
|
118
|
+
return args(func)
|
|
119
|
+
elif type(args) is tuple:
|
|
120
|
+
return func(*args)
|
|
121
|
+
elif type(args) is dict:
|
|
122
|
+
return func(**args)
|
|
123
|
+
return func(args)
|
|
124
|
+
"""
|
|
125
|
+
if isinstance(args, Args):
|
|
126
|
+
return args(func)
|
|
127
|
+
args_type = type(args)
|
|
128
|
+
if args_type is tuple:
|
|
129
|
+
return func(*args)
|
|
130
|
+
elif args_type is dict:
|
|
131
|
+
return func(**args)
|
|
132
|
+
else:
|
|
133
|
+
return func(args)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class UpdativeArgs(Args):
|
|
137
|
+
"""Takes some positional arguments and keyword arguments,
|
|
138
|
+
and put them into an instance, which can be used repeatedly
|
|
139
|
+
every next time.
|
|
140
|
+
This derived class provides some methods to update the
|
|
141
|
+
collected arguments.
|
|
142
|
+
|
|
143
|
+
Fields::
|
|
144
|
+
self.args: the collected positional arguments
|
|
145
|
+
self.kwargs: the collected keyword arguments
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
__slots__ = ("args", "kwargs")
|
|
149
|
+
|
|
150
|
+
def extend(self, /, *args, **kwargs):
|
|
151
|
+
"""Extend the collected arguments.
|
|
152
|
+
|
|
153
|
+
Examples::
|
|
154
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
155
|
+
>>> args2 = args.extend(7, 8, x=9, r=0)
|
|
156
|
+
>>> args2
|
|
157
|
+
UpdativeArgs(1, 2, 3, 7, 8, x=4, y=5, z=6, r=0)
|
|
158
|
+
>>> args is args2
|
|
159
|
+
True
|
|
160
|
+
"""
|
|
161
|
+
if args:
|
|
162
|
+
self.args += args
|
|
163
|
+
if kwargs:
|
|
164
|
+
kwargs0 = self.kwargs
|
|
165
|
+
kwargs0.update((k, kwargs[k]) for k in kwargs.keys() - kwargs0.keys())
|
|
166
|
+
return self
|
|
167
|
+
|
|
168
|
+
def copy_extend(self, /, *args, **kwargs):
|
|
169
|
+
"""Extend the collected arguments in a copied instance.
|
|
170
|
+
|
|
171
|
+
Examples::
|
|
172
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
173
|
+
>>> args2 = args.copy_extend(7, 8, x=9, r=0)
|
|
174
|
+
>>> args2
|
|
175
|
+
UpdativeArgs(1, 2, 3, 7, 8, x=4, y=5, z=6, r=0)
|
|
176
|
+
>>> args is args2
|
|
177
|
+
False
|
|
178
|
+
"""
|
|
179
|
+
return copy(self).extend(*args, **kwargs)
|
|
180
|
+
|
|
181
|
+
def prepend(self, /, *args, **kwargs):
|
|
182
|
+
"""Prepend the collected arguments.
|
|
183
|
+
|
|
184
|
+
Examples::
|
|
185
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
186
|
+
>>> args2 = args.prepend(7, 8, x=9, r=0)
|
|
187
|
+
>>> args2
|
|
188
|
+
UpdativeArgs(7, 8, 1, 2, 3, x=9, y=5, z=6, r=0)
|
|
189
|
+
>>> args is args2
|
|
190
|
+
True
|
|
191
|
+
"""
|
|
192
|
+
if args:
|
|
193
|
+
self.args = args + self.args
|
|
194
|
+
if kwargs:
|
|
195
|
+
self.kwargs.update(kwargs)
|
|
196
|
+
return self
|
|
197
|
+
|
|
198
|
+
def copy_prepend(self, /, *args, **kwargs):
|
|
199
|
+
"""Prepend the collected arguments in a copied instance.
|
|
200
|
+
|
|
201
|
+
Examples::
|
|
202
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
203
|
+
>>> args2 = args.copy_prepend(7, 8, x=9, r=0)
|
|
204
|
+
>>> args2
|
|
205
|
+
UpdativeArgs(7, 8, 1, 2, 3, x=9, y=5, z=6, r=0)
|
|
206
|
+
>>> args is args2
|
|
207
|
+
False
|
|
208
|
+
"""
|
|
209
|
+
return copy(self).prepend(*args, **kwargs)
|
|
210
|
+
|
|
211
|
+
def update(self, /, *args, **kwargs):
|
|
212
|
+
"""Update the collected arguments.
|
|
213
|
+
|
|
214
|
+
Examples::
|
|
215
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
216
|
+
>>> args2 = args.update(7, 8, x=9, r=0)
|
|
217
|
+
>>> args2
|
|
218
|
+
UpdativeArgs(7, 8, 3, x=9, y=5, z=6, r=0)
|
|
219
|
+
>>> args is args2
|
|
220
|
+
True
|
|
221
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
222
|
+
>>> args.update(7, 8, 10, 11, x=9, r=0)
|
|
223
|
+
UpdativeArgs(7, 8, 10, 11, x=9, y=5, z=6, r=0)
|
|
224
|
+
"""
|
|
225
|
+
if args:
|
|
226
|
+
n = len(args) - len(self.args)
|
|
227
|
+
if n >= 0:
|
|
228
|
+
self.args = args
|
|
229
|
+
else:
|
|
230
|
+
self.args = args + self.args[n:]
|
|
231
|
+
if kwargs:
|
|
232
|
+
self.kwargs.update(kwargs)
|
|
233
|
+
return self
|
|
234
|
+
|
|
235
|
+
def copy_update(self, /, *args, **kwargs):
|
|
236
|
+
"""Update the collected arguments in a copied instance.
|
|
237
|
+
|
|
238
|
+
Examples::
|
|
239
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
240
|
+
>>> args2 = args.copy_update(7, 8, x=9, r=0)
|
|
241
|
+
>>> args2
|
|
242
|
+
UpdativeArgs(7, 8, 3, x=9, y=5, z=6, r=0)
|
|
243
|
+
>>> args is args2
|
|
244
|
+
False
|
|
245
|
+
|
|
246
|
+
Idempotence
|
|
247
|
+
>>> args3 = args2.copy_update(7, 8, x=9, r=0)
|
|
248
|
+
>>> args2 == args3
|
|
249
|
+
True
|
|
250
|
+
|
|
251
|
+
Idempotence
|
|
252
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
253
|
+
>>> args2 = args.copy_update(7, 8, 10, 11, x=9, r=0)
|
|
254
|
+
>>> args3 = args2.copy_update(7, 8, 10, 11, x=9, r=0)
|
|
255
|
+
>>> args2 == args3
|
|
256
|
+
True
|
|
257
|
+
"""
|
|
258
|
+
return copy(self).update(*args, **kwargs)
|
|
259
|
+
|
|
260
|
+
def update_extend(self, /, *args, **kwargs):
|
|
261
|
+
"""Update and entend the collected arguments.
|
|
262
|
+
|
|
263
|
+
Examples::
|
|
264
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
265
|
+
>>> args2 = args.update_extend(7, 8, 10, 11, x=9, r=0)
|
|
266
|
+
>>> args2
|
|
267
|
+
UpdativeArgs(1, 2, 3, 11, x=4, y=5, z=6, r=0)
|
|
268
|
+
>>> args is args2
|
|
269
|
+
True
|
|
270
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
271
|
+
>>> args.update_extend(7, 8, x=9, r=0)
|
|
272
|
+
UpdativeArgs(1, 2, 3, x=4, y=5, z=6, r=0)
|
|
273
|
+
"""
|
|
274
|
+
if args:
|
|
275
|
+
n = len(self.args) - len(args)
|
|
276
|
+
if n < 0:
|
|
277
|
+
self.args += args[n:]
|
|
278
|
+
if kwargs:
|
|
279
|
+
kwargs0 = self.kwargs
|
|
280
|
+
kwargs0.update((k, kwargs[k]) for k in kwargs.keys() - kwargs0.keys())
|
|
281
|
+
return self
|
|
282
|
+
|
|
283
|
+
def copy_update_extend(self, /, *args, **kwargs):
|
|
284
|
+
"""Update and extend the collected arguments in
|
|
285
|
+
a copied instance.
|
|
286
|
+
|
|
287
|
+
Examples::
|
|
288
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
289
|
+
>>> args2 = args.copy_update_extend(7, 8, 10, 11, x=9, r=0)
|
|
290
|
+
>>> args2
|
|
291
|
+
UpdativeArgs(1, 2, 3, 11, x=4, y=5, z=6, r=0)
|
|
292
|
+
>>> args is args2
|
|
293
|
+
False
|
|
294
|
+
|
|
295
|
+
Idempotence
|
|
296
|
+
>>> args3 = args2.copy_update_extend(7, 8, 10, 11, x=9, r=0)
|
|
297
|
+
>>> args2 == args3
|
|
298
|
+
True
|
|
299
|
+
|
|
300
|
+
Idempotence
|
|
301
|
+
>>> args = UpdativeArgs(1, 2, 3, x=4, y=5, z=6)
|
|
302
|
+
>>> args2 = args.copy_update_extend(7, 8, x=9, r=0)
|
|
303
|
+
>>> args2
|
|
304
|
+
UpdativeArgs(1, 2, 3, x=4, y=5, z=6, r=0)
|
|
305
|
+
>>> args3 = args2.copy_update_extend(7, 8, x=9, r=0)
|
|
306
|
+
>>> args2 == args3
|
|
307
|
+
True
|
|
308
|
+
"""
|
|
309
|
+
return copy(self).update_extend(*args, **kwargs)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
class Call[**Params, R](partial):
|
|
313
|
+
""" """
|
|
314
|
+
|
|
315
|
+
def __new__(
|
|
316
|
+
cls,
|
|
317
|
+
func: Callable[Params, R],
|
|
318
|
+
/,
|
|
319
|
+
*args: Params.args,
|
|
320
|
+
**kwds: Params.kwargs,
|
|
321
|
+
):
|
|
322
|
+
if hasattr(func, "func"):
|
|
323
|
+
args = getattr(func, "args", ()) + args # type: ignore
|
|
324
|
+
kwargs: None | dict = None
|
|
325
|
+
try:
|
|
326
|
+
kwargs = func.kwargs
|
|
327
|
+
except AttributeError:
|
|
328
|
+
kwargs = getattr(func, "keywords", None)
|
|
329
|
+
if kwargs:
|
|
330
|
+
kwds = {**kwargs, **kwds} # type: ignore
|
|
331
|
+
func = func.func
|
|
332
|
+
return update_wrapper(super().__new__(cls, func, *args, **kwds), func)
|
|
333
|
+
|
|
334
|
+
@property
|
|
335
|
+
def kwargs(self, /) -> dict:
|
|
336
|
+
return self.keywords
|
|
337
|
+
|
|
338
|
+
def __call__(self, /) -> R:
|
|
339
|
+
return self.func(*self.args, **self.kwargs)
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
if __name__ == "__main__":
|
|
343
|
+
import doctest
|
|
344
|
+
|
|
345
|
+
doctest.testmod()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
__author__ = "ChenyangGao <https://chenyanggao.github.io>"
|
|
5
|
+
__version__ = (0, 2, 2)
|
|
6
|
+
|
|
7
|
+
from .basic import *
|
|
8
|
+
from .iter import *
|
|
9
|
+
from .loop import *
|
|
10
|
+
from .misc import *
|
|
11
|
+
from .reduce import *
|
|
12
|
+
from .type import *
|