reykit 1.0.1__py3-none-any.whl → 1.1.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.
- reydb/__init__.py +1 -1
- reydb/rbuild.py +44 -44
- reydb/rconnection.py +107 -107
- reydb/rexecute.py +9 -13
- reydb/rfile.py +8 -8
- reydb/rinformation.py +13 -25
- reydb/rparameter.py +10 -10
- reykit/__init__.py +1 -1
- reykit/rcomm.py +12 -12
- reykit/rdata.py +4 -4
- reykit/remail.py +12 -14
- reykit/rexception.py +4 -4
- reykit/rimage.py +9 -9
- reykit/rlog.py +30 -30
- reykit/rmonkey.py +4 -5
- reykit/rmultitask.py +14 -15
- reykit/rnumber.py +2 -2
- reykit/ros.py +21 -21
- reykit/rrandom.py +11 -11
- reykit/rregex.py +10 -13
- reykit/rschedule.py +10 -10
- reykit/rstdout.py +13 -13
- reykit/rsystem.py +224 -30
- reykit/rtable.py +31 -31
- reykit/rtext.py +3 -3
- reykit/rtime.py +11 -31
- reykit/rtype.py +2 -2
- reykit/rwrap.py +16 -16
- reykit/rzip.py +4 -5
- {reykit-1.0.1.dist-info → reykit-1.1.1.dist-info}/METADATA +1 -1
- reykit-1.1.1.dist-info/RECORD +38 -0
- reykit-1.0.1.dist-info/RECORD +0 -64
- reyweb/__init__.py +0 -19
- reyweb/rall.py +0 -12
- reyweb/rbaidu/__init__.py +0 -21
- reyweb/rbaidu/rbaidu_base.py +0 -186
- reyweb/rbaidu/rbaidu_chat.py +0 -299
- reyweb/rbaidu/rbaidu_image.py +0 -183
- reyweb/rbaidu/rbaidu_voice.py +0 -256
- reywechat/__init__.py +0 -32
- reywechat/data/client_api.dll +0 -0
- reywechat/rall.py +0 -20
- reywechat/rclient.py +0 -912
- reywechat/rdatabase.py +0 -1189
- reywechat/rexception.py +0 -65
- reywechat/rexecute.py +0 -201
- reywechat/rlog.py +0 -198
- reywechat/rreceive.py +0 -1232
- reywechat/rschedule.py +0 -136
- reywechat/rsend.py +0 -630
- reywechat/rwechat.py +0 -201
- reyworm/__init__.py +0 -24
- reyworm/rall.py +0 -16
- reyworm/rbrowser.py +0 -134
- reyworm/rcalendar.py +0 -159
- reyworm/rnews.py +0 -126
- reyworm/rsecurity.py +0 -239
- reyworm/rtranslate.py +0 -75
- {reykit-1.0.1.dist-info → reykit-1.1.1.dist-info}/WHEEL +0 -0
- {reykit-1.0.1.dist-info → reykit-1.1.1.dist-info}/top_level.txt +0 -0
reykit/rwrap.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any,
|
12
|
+
from typing import Any, Literal, overload
|
13
13
|
from collections.abc import Callable
|
14
14
|
from io import IOBase, StringIO
|
15
15
|
from inspect import getdoc
|
@@ -78,7 +78,7 @@ def wrap_frame(decorator: Callable) -> Callable:
|
|
78
78
|
|
79
79
|
# Decorate Decorator.
|
80
80
|
@overload
|
81
|
-
def wrap(func: Callable, *args: Any, _execute: None = None, **kwargs: Any) ->
|
81
|
+
def wrap(func: Callable, *args: Any, _execute: None = None, **kwargs: Any) -> Callable | Any: ...
|
82
82
|
|
83
83
|
@overload
|
84
84
|
def wrap(func: Callable, *args: Any, _execute: Literal[True] = None, **kwargs: Any) -> Any: ...
|
@@ -87,7 +87,7 @@ def wrap_frame(decorator: Callable) -> Callable:
|
|
87
87
|
def wrap(func: Callable, *args: Any, _execute: Literal[False] = None, **kwargs: Any) -> Callable: ...
|
88
88
|
|
89
89
|
@functools_wraps(decorator)
|
90
|
-
def wrap(func: Callable, *args: Any, _execute:
|
90
|
+
def wrap(func: Callable, *args: Any, _execute: bool | None = None, **kwargs: Any) -> Callable | Any:
|
91
91
|
"""
|
92
92
|
Decorative shell.
|
93
93
|
|
@@ -167,7 +167,7 @@ def wrap_runtime(
|
|
167
167
|
*args: Any,
|
168
168
|
_return_report: bool = False,
|
169
169
|
**kwargs: Any
|
170
|
-
) ->
|
170
|
+
) -> Any | tuple[Any, str]:
|
171
171
|
"""
|
172
172
|
Decorator, print or return runtime report of the function.
|
173
173
|
|
@@ -260,19 +260,19 @@ def wrap_thread(
|
|
260
260
|
def wrap_exc(
|
261
261
|
func: Callable,
|
262
262
|
*args: Any,
|
263
|
-
_exception:
|
264
|
-
_handler:
|
263
|
+
_exception: BaseException | tuple[BaseException, ...] = BaseException,
|
264
|
+
_handler: Callable | None = None,
|
265
265
|
**kwargs: Any
|
266
|
-
) ->
|
266
|
+
) -> Any | None: ...
|
267
267
|
|
268
268
|
@wrap_frame
|
269
269
|
def wrap_exc(
|
270
270
|
func: Callable,
|
271
271
|
*args: Any,
|
272
|
-
_exception:
|
273
|
-
_handler:
|
272
|
+
_exception: BaseException | tuple[BaseException, ...] = BaseException,
|
273
|
+
_handler: Callable | None = None,
|
274
274
|
**kwargs: Any
|
275
|
-
) ->
|
275
|
+
) -> Any | None:
|
276
276
|
"""
|
277
277
|
Decorator, execute function with `try` and `except` syntax.
|
278
278
|
|
@@ -307,8 +307,8 @@ def wrap_exc(
|
|
307
307
|
def wrap_retry(
|
308
308
|
func: Callable,
|
309
309
|
*args: Any,
|
310
|
-
_report:
|
311
|
-
_exception:
|
310
|
+
_report: str | None = None,
|
311
|
+
_exception: BaseException | tuple[BaseException, ...] = BaseException,
|
312
312
|
_try_total: int = 1,
|
313
313
|
_try_count: int = 0,
|
314
314
|
**kwargs: Any
|
@@ -318,8 +318,8 @@ def wrap_retry(
|
|
318
318
|
def wrap_retry(
|
319
319
|
func: Callable,
|
320
320
|
*args: Any,
|
321
|
-
_report:
|
322
|
-
_exception:
|
321
|
+
_report: str | None = None,
|
322
|
+
_exception: BaseException | tuple[BaseException, ...] = BaseException,
|
323
323
|
_try_total: int = 1,
|
324
324
|
_try_count: int = 0,
|
325
325
|
**kwargs: Any
|
@@ -569,7 +569,7 @@ def wrap_cache(
|
|
569
569
|
def wrap_redirect_stdout(
|
570
570
|
func: Callable,
|
571
571
|
*args: Any,
|
572
|
-
_redirect:
|
572
|
+
_redirect: list | IOBase | None = None,
|
573
573
|
**kwargs: Any
|
574
574
|
) -> Any: ...
|
575
575
|
|
@@ -577,7 +577,7 @@ def wrap_redirect_stdout(
|
|
577
577
|
def wrap_redirect_stdout(
|
578
578
|
func: Callable,
|
579
579
|
*args: Any,
|
580
|
-
_redirect:
|
580
|
+
_redirect: list | IOBase | None = None,
|
581
581
|
**kwargs: Any
|
582
582
|
) -> Any:
|
583
583
|
"""
|
reykit/rzip.py
CHANGED
@@ -10,7 +10,6 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
from __future__ import annotations
|
13
|
-
from typing import Optional
|
14
13
|
from zipfile import ZipFile, is_zipfile, ZIP_DEFLATED
|
15
14
|
from os import getcwd as os_getcwd, walk as os_walk
|
16
15
|
from os.path import join as os_join, isfile as os_isfile
|
@@ -27,7 +26,7 @@ __all__ = (
|
|
27
26
|
|
28
27
|
def compress(
|
29
28
|
obj_path: str,
|
30
|
-
build_dir:
|
29
|
+
build_dir: str | None = None,
|
31
30
|
overwrite: bool = True
|
32
31
|
) -> None:
|
33
32
|
"""
|
@@ -82,8 +81,8 @@ def compress(
|
|
82
81
|
|
83
82
|
def decompress(
|
84
83
|
obj_path: str,
|
85
|
-
build_dir:
|
86
|
-
password:
|
84
|
+
build_dir: str | None = None,
|
85
|
+
password: str | None = None
|
87
86
|
) -> None:
|
88
87
|
"""
|
89
88
|
Decompress compressed object.
|
@@ -114,7 +113,7 @@ def decompress(
|
|
114
113
|
|
115
114
|
def zip(
|
116
115
|
obj_path: str,
|
117
|
-
build_dir:
|
116
|
+
build_dir: str | None = None
|
118
117
|
) -> None:
|
119
118
|
"""
|
120
119
|
Automatic judge and compress or decompress object.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
reydb/__init__.py,sha256=Uolsm7GxnVDbUkBT1AR48Zn4RVD82--nfPevcJhNX8w,519
|
2
|
+
reydb/rall.py,sha256=B1-E7TMMLOay28T-nm9rqWUvDQDPjwFNAhL-VzR_QAg,319
|
3
|
+
reydb/rbuild.py,sha256=rc-Oa2PydiK0gKueBkaIc_ffAa6PqLcXRGR75wpPL1c,34593
|
4
|
+
reydb/rconnection.py,sha256=MLRHXNCWdIs3gIPDPQHSbCqcTuEee3lusJoQlo_Azjg,66670
|
5
|
+
reydb/rexecute.py,sha256=RKl49x992c7AMF0TisMGJS3Yp6H40mIvG2DTOWGX-0Q,9435
|
6
|
+
reydb/rfile.py,sha256=mH6_14WDf-WNl0VPDnw3tKg5bIHR9g6X-rWWsZWlrGw,11481
|
7
|
+
reydb/rinformation.py,sha256=AVmilR-uRfN95h_mbEnlcVr6IpbDGYiuGG1n-I4J9gM,13044
|
8
|
+
reydb/rparameter.py,sha256=DCr-Vf8QRi4o2Bjplx7UskcDjQ3vDQN8IGTSxYMDK2M,5174
|
9
|
+
reykit/__init__.py,sha256=9D3r5CdA4Uo0dlFvLEq1db0UqfpohMNA-lDHpK4Y48U,917
|
10
|
+
reykit/rall.py,sha256=mOFwHXZ4-BOkJ5Ptbm6lQc2zwNf_VqcqM6AYYnYPfoo,672
|
11
|
+
reykit/rcomm.py,sha256=LgSLrpUokOgdRMYwuZj6JNvxDyvENwsiOd6ZHo67HBg,11444
|
12
|
+
reykit/rdata.py,sha256=d5zO9dQotDGoXxNh1TvEZdIfacaW55yeb79r0bbgj0k,8470
|
13
|
+
reykit/remail.py,sha256=rK_hbqGeZh04DnVPtjODLsm_YfdrZ5L-Z6SbjplrfUc,6736
|
14
|
+
reykit/rexception.py,sha256=ftXVdEVkU0B0HXbKjQTiJRJVVGbvhorwWtMiplpN9Zk,8118
|
15
|
+
reykit/rimage.py,sha256=fQpIHX6Go3Jk_MDgsSDnZx27EZHumyGdgI9xyjP5lYQ,6275
|
16
|
+
reykit/rlog.py,sha256=4RqfYU7RZJJ3qUXHUTWFVgAM3nqjP4glDyRmvWNXpbk,26406
|
17
|
+
reykit/rmonkey.py,sha256=RqhmKXabl11s2RJaGizpm00Q1yEkul1Je5uxw8_thUk,7584
|
18
|
+
reykit/rmultitask.py,sha256=9UVAg8P85UsLS_exW-e6tZTa_b5r3ceL7LQRDrP8eAw,21981
|
19
|
+
reykit/rnumber.py,sha256=XseLDNLDOt-XYP2P9oDbkKYuHudeSoWzIHsOENO8vvE,3196
|
20
|
+
reykit/ros.py,sha256=flnczS5InFd9rVdXNi-amVETlIu1nwZPWSGySLMOPLw,39231
|
21
|
+
reykit/rrandom.py,sha256=fMeorpkjWAAtjD2oZCux3tpYuD2RRoBSkWI0M6NPM5Q,9102
|
22
|
+
reykit/rregex.py,sha256=XTlnDLior8yyncFdrTr9FsVlBcqMXvsWRfpmvQS-BR8,6089
|
23
|
+
reykit/rschedule.py,sha256=7EH_6TdEhwV-T6YyBEGYEcy85I1vTSNutDci-e_veTY,5796
|
24
|
+
reykit/rstdout.py,sha256=vSvD4QjYybNiGnowWLXRU6q1u9ERPjr8YTXgq82eYDU,9648
|
25
|
+
reykit/rsystem.py,sha256=LG0I4ZZjr-Bxfy6zbCqz3WvSG_bGYwtaBLowTHQ0mzY,34332
|
26
|
+
reykit/rtable.py,sha256=gXszf_9DE_5SMdNcxMX-xd4IpHGQVjGsN3NQIm7wVGY,12055
|
27
|
+
reykit/rtext.py,sha256=whaKpVkd36yYVtCmZ1ptp_TVRL1v3f7Jab0vPXC8wXY,11089
|
28
|
+
reykit/rtime.py,sha256=bV1sB_FHcqNJAP9L7WmYMZul3HrQM2QU9a2Q1zN98Aw,16980
|
29
|
+
reykit/rtype.py,sha256=HQFllZjKHPnGYLS-zTwC948Rt0HVsGY12eObjwFfOSo,1962
|
30
|
+
reykit/rwrap.py,sha256=AJBYTDLHLGlMSiGIKoVkCsQk-Y4nDHWWFVCdnz5Bwdk,15222
|
31
|
+
reykit/rzip.py,sha256=i6KkmeSWCnq025d-O1mbuCYezNRUhyY9OGVK0CRlNAM,3522
|
32
|
+
reykit/rdll/__init__.py,sha256=vM9V7wSNno-WH9RrxgHTIgCkQm8LmBFoLFO8z7qovNo,306
|
33
|
+
reykit/rdll/rdll_inject.py,sha256=bETl8tywtN1OiQudbA21u6GwBM_bqVX7jbiisNj_JBg,645
|
34
|
+
reykit/rdll/rdll_inject_core.py,sha256=Trgh_pdJs_Lw-Y-0Kkn8kHr4BnilM9dBKnHnX25T_pM,5092
|
35
|
+
reykit-1.1.1.dist-info/METADATA,sha256=QcKjSYyihT-ZLZDS6Ti7zN_xjraHaHfvcML6ygMcJ70,700
|
36
|
+
reykit-1.1.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
37
|
+
reykit-1.1.1.dist-info/top_level.txt,sha256=2hvySInjpVEcpYg-XFCYVU5xB2TWW8RovoDtBDzAqyE,7
|
38
|
+
reykit-1.1.1.dist-info/RECORD,,
|
reykit-1.0.1.dist-info/RECORD
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
reydb/__init__.py,sha256=OoI005B_eXGcInBJEnV-r3IKXcASAXRtk4MW8EnsAhU,519
|
2
|
-
reydb/rall.py,sha256=B1-E7TMMLOay28T-nm9rqWUvDQDPjwFNAhL-VzR_QAg,319
|
3
|
-
reydb/rbuild.py,sha256=4vb0PtSKM-Y9Xhn0tSJSxsifmHdmtjHDv-gFGYjca5c,34832
|
4
|
-
reydb/rconnection.py,sha256=bYwcynvmdpQkLKuDEaetRZxFthcV_sS1xj46HspjmZk,67168
|
5
|
-
reydb/rexecute.py,sha256=afg4WqF-qvD5M2Lun-k7FZ6bGXuYKl8SKBey4ScZIrQ,9524
|
6
|
-
reydb/rfile.py,sha256=CwBXgEORWF9QssIgdH9uQlZ4FG8aeowCejruab90dOs,11531
|
7
|
-
reydb/rinformation.py,sha256=2kBr-X4yE3nlbf-RMsJkkUsdNjo0YCiEhe0wgcfVyzc,13240
|
8
|
-
reydb/rparameter.py,sha256=aC-TUlwvUB2VUn7MlYJ_gNj5U600KJuYMKE6blOX1ek,5248
|
9
|
-
reykit/__init__.py,sha256=Azqw5FaTSwK9tatoY01h3ELt0VVWqQL80d8rVEzAlSg,917
|
10
|
-
reykit/rall.py,sha256=mOFwHXZ4-BOkJ5Ptbm6lQc2zwNf_VqcqM6AYYnYPfoo,672
|
11
|
-
reykit/rcomm.py,sha256=_i0hrCB3moZhA3sm2ebg54i9dQ8QjI57ZV2cKm0vxA4,11523
|
12
|
-
reykit/rdata.py,sha256=qmx9yKrfP2frOQjj-34ze8sa1l4sOQXtemkKyrVtKXs,8495
|
13
|
-
reykit/remail.py,sha256=-uSU2yHyFbjs6X9M5Sjb4TMjw4cK8_Bnsmsaos3f0Rs,6860
|
14
|
-
reykit/rexception.py,sha256=sI5EKD5gfsdwApovA4DFnlm_MxmPp7TChNLzGmGvZ9M,8150
|
15
|
-
reykit/rimage.py,sha256=BmNNyhqezN9f40gaE5_rv6B7-v9mYkUwT8n2tfCDfdw,6331
|
16
|
-
reykit/rlog.py,sha256=J-fnY5B3Y2oJOuyHvemy6ltkr8he4spS3iQOADIUg00,26525
|
17
|
-
reykit/rmonkey.py,sha256=s8TdR-_tRRMiR11eCLHCkFAJuAZe7PVIhkR-74Xt8vw,7644
|
18
|
-
reykit/rmultitask.py,sha256=L4_dlIKGV3DrWlID2MDc1Fl-o0kt23l7oYGp4-WJRYU,22057
|
19
|
-
reykit/rnumber.py,sha256=MajaVOVa3_H1lm91cu9HLaLXd9ZsvZYFxXvcklC0LWs,3209
|
20
|
-
reykit/ros.py,sha256=wv1DM2N8MXBwGqBhNUSiDLrvHRK7syibhFwEPGkpxYM,39336
|
21
|
-
reykit/rrandom.py,sha256=4SICHR_ETKG2Syu50wPAZB8DCEmrQq3GQZl6nf4TZ9k,9161
|
22
|
-
reykit/rregex.py,sha256=E9BConP7ADYyGVZ5jpxwUmtc_WXFb-I1Zjt6IZSHkIQ,6218
|
23
|
-
reykit/rschedule.py,sha256=TiIFQ0siL20nlhikWfvRGhOdeRbyHQtN6uxFivA2WoI,5852
|
24
|
-
reykit/rstdout.py,sha256=yjCTegPqm2FNIpNGVrmz16Jn2bNncYO1axuANVdTmVQ,9710
|
25
|
-
reykit/rsystem.py,sha256=EbPOKtwtVyXqX4AqKMKPW1cEAixqHAOemaxrlEpT0ZY,29388
|
26
|
-
reykit/rtable.py,sha256=ghsppMMOGkz3boV_CSxpkel5Lfj-ViBziZrpcCoY5YA,12229
|
27
|
-
reykit/rtext.py,sha256=xilQxaMMdaVCBk6rxQb1aI8-j52QVUH5EtTZVMQsa8Q,11108
|
28
|
-
reykit/rtime.py,sha256=2xOGGETwl1Sc3W80a2KiPbI4GsSfIyksTeXgqNOTYVw,17178
|
29
|
-
reykit/rtype.py,sha256=PbfaHjNQTMiZynlz8HwP2K9SS-t91ThMOYBxQIBf9Ug,1975
|
30
|
-
reykit/rwrap.py,sha256=4RdTxT2y7ViyeiWx2fJ54k9ZZT6Bmx5QStIiwEHB6rY,15320
|
31
|
-
reykit/rzip.py,sha256=HTrxyb4e6f38eOPFIXsdbcEwr7FQSqnU2MVmVRBYTbg,3563
|
32
|
-
reykit/rdll/__init__.py,sha256=vM9V7wSNno-WH9RrxgHTIgCkQm8LmBFoLFO8z7qovNo,306
|
33
|
-
reykit/rdll/rdll_inject.py,sha256=bETl8tywtN1OiQudbA21u6GwBM_bqVX7jbiisNj_JBg,645
|
34
|
-
reykit/rdll/rdll_inject_core.py,sha256=Trgh_pdJs_Lw-Y-0Kkn8kHr4BnilM9dBKnHnX25T_pM,5092
|
35
|
-
reyweb/__init__.py,sha256=DKX_nTvcEY1UX7SCRdCgid-ak1XkLruvNzl50T5tl6o,287
|
36
|
-
reyweb/rall.py,sha256=jHEW2PQkHddvxeaTUukPGb2p-3tXROPP4Cfdp4L_RWc,188
|
37
|
-
reyweb/rbaidu/__init__.py,sha256=8HLCTEhMwGudKmGAHJ3Ix-pE4HY8ul6UEAisTPzoGO4,426
|
38
|
-
reyweb/rbaidu/rbaidu_base.py,sha256=RjNaw713l2Fah2Xr9_SLXgAbWE0NAmucc-6rdSPG8tw,4134
|
39
|
-
reyweb/rbaidu/rbaidu_chat.py,sha256=sYZ_w0arZ-SL5ZAYFGjdEoT7fmNwgm9vOQ76H4SOWkQ,8279
|
40
|
-
reyweb/rbaidu/rbaidu_image.py,sha256=D4-VjaaZxvljhmv8qfaZ2N1qFY-Evkkw4S08m_l6jws,3997
|
41
|
-
reyweb/rbaidu/rbaidu_voice.py,sha256=s6bf5K2fTlsBdINN-BGimAoCMGBdet-OSRiTLGbTkWY,5609
|
42
|
-
reywechat/__init__.py,sha256=3dIerRyo2kL6MDzHaxcDb-FgPswFq6wpm8LKR8YYZgc,572
|
43
|
-
reywechat/rall.py,sha256=2mjjPSzmiyR6AYOpuzP1Fnw75HXTYoRYSoRpCEcYQOc,385
|
44
|
-
reywechat/rclient.py,sha256=jPoSezFgr4_N64XFcyXP4hqavCrb7UMoqVsQC6hPDAU,21934
|
45
|
-
reywechat/rdatabase.py,sha256=McG-3GsOzO4jhPPI-_dwf7nIekAJa0M3e1mx2QzGfQo,37327
|
46
|
-
reywechat/rexception.py,sha256=Q0r64erO4MbtIMHFkIfmTlWYY1A1XqS-brfHEw3Uh_E,1351
|
47
|
-
reywechat/rexecute.py,sha256=mMyhjoSyG3_hU-j9BVvXdqEzmyXMb-pBqOuZ8MpREOA,4658
|
48
|
-
reywechat/rlog.py,sha256=N55o-gmLbZ_6NRd8zznLR84Xrmc41h3RODPoqjGjWfQ,4667
|
49
|
-
reywechat/rreceive.py,sha256=ATZ65656AJWZm43iuu0_xHa7d4KClmVkDSIav_D7Q1Q,31067
|
50
|
-
reywechat/rschedule.py,sha256=XRCa1QVW0bq8Bhb4mYv-S_aq6-wvQFF3uZ0t2WFTFQI,3474
|
51
|
-
reywechat/rsend.py,sha256=PIUY3ebAEY-xaTf2k50puWI-jlz5U9kTIjRvbrRpzUE,16221
|
52
|
-
reywechat/rwechat.py,sha256=pRZPWu1nGfsQoYCC1A-79-xiflEFFzaqwh6Kshv3fdQ,5721
|
53
|
-
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
54
|
-
reyworm/__init__.py,sha256=pUER-wZkP_r70mvgcTy2M2n55Zcybzf-iDWSIecOGZo,428
|
55
|
-
reyworm/rall.py,sha256=gXixof3iLlJxmjS7Nmnk4lAXrHXX5mbYA9r4g7ZCYHU,291
|
56
|
-
reyworm/rbrowser.py,sha256=QC1E29yNm0wyugKZlBhfkpIIieEus9SrS11Vt-ZMGCk,2612
|
57
|
-
reyworm/rcalendar.py,sha256=pVifh3HqyaB6vujrS4z2G8QrFM5MYqpE3jq0HdAlLNw,3884
|
58
|
-
reyworm/rnews.py,sha256=e63m0Lrmy2edvhKic94X3xRRgOySf3oniKu9N6Zyg60,3079
|
59
|
-
reyworm/rsecurity.py,sha256=IiYTdCCs3VVKkT6Dh8adlZqRvdreJthdcf_R_1zcJqU,6912
|
60
|
-
reyworm/rtranslate.py,sha256=vsg1EfAtPbff8Zqd5FvArq8Lg5AHOuOJR9aSQoEIVMo,1349
|
61
|
-
reykit-1.0.1.dist-info/METADATA,sha256=lW4DMDUd0tQQfqKvoXmpLXrsRkPxKS77Nk_HpGArBCM,700
|
62
|
-
reykit-1.0.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
63
|
-
reykit-1.0.1.dist-info/top_level.txt,sha256=2hvySInjpVEcpYg-XFCYVU5xB2TWW8RovoDtBDzAqyE,7
|
64
|
-
reykit-1.0.1.dist-info/RECORD,,
|
reyweb/__init__.py
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# !/usr/bin/env python
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
|
4
|
-
"""
|
5
|
-
@Time : 2023-02-19 18:59:26
|
6
|
-
@Author : Rey
|
7
|
-
@Contact : reyxbo@163.com
|
8
|
-
@Explain : Rey's Web method set.
|
9
|
-
|
10
|
-
Modules
|
11
|
-
-------
|
12
|
-
baidu : Baidu API methods.
|
13
|
-
"""
|
14
|
-
|
15
|
-
|
16
|
-
from typing import Final
|
17
|
-
|
18
|
-
|
19
|
-
__version__: Final[str] = '1.0.0'
|
reyweb/rall.py
DELETED
reyweb/rbaidu/__init__.py
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# !/usr/bin/env python
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
|
4
|
-
"""
|
5
|
-
@Time : 2024-01-11 21:55:48
|
6
|
-
@Author : Rey
|
7
|
-
@Contact : reyxbo@163.com
|
8
|
-
@Explain : Baidu API methods.
|
9
|
-
|
10
|
-
Modules
|
11
|
-
-------
|
12
|
-
rbaidu_base : Baidu API base methods.
|
13
|
-
rbaidu_voice : Baidu API voice methods.
|
14
|
-
rbaidu_Image : Baidu API image methods.
|
15
|
-
"""
|
16
|
-
|
17
|
-
|
18
|
-
from .rbaidu_base import *
|
19
|
-
from .rbaidu_chat import *
|
20
|
-
from .rbaidu_image import *
|
21
|
-
from .rbaidu_voice import *
|
reyweb/rbaidu/rbaidu_base.py
DELETED
@@ -1,186 +0,0 @@
|
|
1
|
-
# !/usr/bin/env python
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
|
4
|
-
"""
|
5
|
-
@Time : 2024-01-11 21:56:56
|
6
|
-
@Author : Rey
|
7
|
-
@Contact : reyxbo@163.com
|
8
|
-
@Explain : Baidu API base methods.
|
9
|
-
"""
|
10
|
-
|
11
|
-
|
12
|
-
from typing import Any, TypedDict
|
13
|
-
from datetime import datetime
|
14
|
-
from requests import Response
|
15
|
-
from uuid import uuid1
|
16
|
-
from reykit.rcomm import request as reytool_request
|
17
|
-
from reykit.rtime import now
|
18
|
-
|
19
|
-
|
20
|
-
__all__ = (
|
21
|
-
'RAPIBaidu',
|
22
|
-
)
|
23
|
-
|
24
|
-
|
25
|
-
CallRecord = TypedDict('CallRecord', {'time': datetime, 'data': Any})
|
26
|
-
|
27
|
-
|
28
|
-
class RAPIBaidu(object):
|
29
|
-
"""
|
30
|
-
Rey's `Baidu API` type.
|
31
|
-
"""
|
32
|
-
|
33
|
-
|
34
|
-
def __init__(
|
35
|
-
self,
|
36
|
-
key: str,
|
37
|
-
secret: str,
|
38
|
-
token_valid_seconds: float = 43200
|
39
|
-
) -> None:
|
40
|
-
"""
|
41
|
-
Build `Baidu API` attributes.
|
42
|
-
|
43
|
-
Parameters
|
44
|
-
----------
|
45
|
-
key : API key.
|
46
|
-
secret : API secret.
|
47
|
-
token_valid_seconds : Authorization token vaild seconds.
|
48
|
-
"""
|
49
|
-
|
50
|
-
# Set attribute.
|
51
|
-
self.key = key
|
52
|
-
self.secret = secret
|
53
|
-
self.token_valid_seconds = token_valid_seconds
|
54
|
-
self.cuid = uuid1()
|
55
|
-
self.call_records: list[CallRecord] = []
|
56
|
-
self.start_time = now()
|
57
|
-
|
58
|
-
|
59
|
-
def get_token(self) -> str:
|
60
|
-
"""
|
61
|
-
Get token.
|
62
|
-
|
63
|
-
Returns
|
64
|
-
-------
|
65
|
-
Token.
|
66
|
-
"""
|
67
|
-
|
68
|
-
# Get parameter.
|
69
|
-
url = 'https://aip.baidubce.com/oauth/2.0/token'
|
70
|
-
params = {
|
71
|
-
'grant_type': 'client_credentials',
|
72
|
-
'client_id': self.key,
|
73
|
-
'client_secret': self.secret
|
74
|
-
}
|
75
|
-
|
76
|
-
# Request.
|
77
|
-
response = self.request(
|
78
|
-
url,
|
79
|
-
params,
|
80
|
-
method='post'
|
81
|
-
)
|
82
|
-
|
83
|
-
# Extract.
|
84
|
-
response_json = response.json()
|
85
|
-
token = response_json['access_token']
|
86
|
-
|
87
|
-
return token
|
88
|
-
|
89
|
-
|
90
|
-
@property
|
91
|
-
def token(self) -> str:
|
92
|
-
"""
|
93
|
-
Get authorization token.
|
94
|
-
"""
|
95
|
-
|
96
|
-
# Get parameter.
|
97
|
-
if hasattr(self, 'token_time'):
|
98
|
-
token_time: datetime = getattr(self, 'token_time')
|
99
|
-
else:
|
100
|
-
token_time = None
|
101
|
-
if (
|
102
|
-
token_time is None
|
103
|
-
or (now() - token_time).seconds > self.token_valid_seconds
|
104
|
-
):
|
105
|
-
self.token_time = now()
|
106
|
-
self._token = self.get_token()
|
107
|
-
|
108
|
-
return self._token
|
109
|
-
|
110
|
-
|
111
|
-
def request(
|
112
|
-
self,
|
113
|
-
*args: Any,
|
114
|
-
**kwargs: Any
|
115
|
-
) -> Response:
|
116
|
-
"""
|
117
|
-
Request.
|
118
|
-
|
119
|
-
Parameters
|
120
|
-
----------
|
121
|
-
args : Position arguments of function.
|
122
|
-
kwargs : Keyword arguments of function.
|
123
|
-
|
124
|
-
Returns
|
125
|
-
-------
|
126
|
-
`Response` instance.
|
127
|
-
"""
|
128
|
-
|
129
|
-
# Request.
|
130
|
-
response = reytool_request(*args, **kwargs)
|
131
|
-
|
132
|
-
# Check.
|
133
|
-
content_type = response.headers['Content-Type']
|
134
|
-
if content_type.startswith('application/json'):
|
135
|
-
response_json: dict = response.json()
|
136
|
-
if 'error_code' in response_json:
|
137
|
-
raise AssertionError('Baidu API request failed', response_json)
|
138
|
-
|
139
|
-
return response
|
140
|
-
|
141
|
-
|
142
|
-
def record_call(
|
143
|
-
self,
|
144
|
-
**data: Any
|
145
|
-
) -> None:
|
146
|
-
"""
|
147
|
-
Record call.
|
148
|
-
|
149
|
-
Parameters
|
150
|
-
----------
|
151
|
-
data : Record data.
|
152
|
-
"""
|
153
|
-
|
154
|
-
# Get parameter.
|
155
|
-
record = {
|
156
|
-
'time': now(),
|
157
|
-
'data': data
|
158
|
-
}
|
159
|
-
|
160
|
-
# Record.
|
161
|
-
self.call_records.append(record)
|
162
|
-
|
163
|
-
|
164
|
-
@property
|
165
|
-
def interval(self) -> float:
|
166
|
-
"""
|
167
|
-
Return the interval seconds from last call.
|
168
|
-
When no record, then return the interval seconds from start.
|
169
|
-
|
170
|
-
Returns
|
171
|
-
-------
|
172
|
-
Interval seconds.
|
173
|
-
"""
|
174
|
-
|
175
|
-
# Get parameter.
|
176
|
-
if self.call_records == []:
|
177
|
-
last_time = self.start_time
|
178
|
-
else:
|
179
|
-
last_time: datetime = self.call_records[-1]['time']
|
180
|
-
|
181
|
-
# Count.
|
182
|
-
now_time = now()
|
183
|
-
interval_time = now_time - last_time
|
184
|
-
interval_seconds = interval_time.total_seconds()
|
185
|
-
|
186
|
-
return interval_seconds
|