reykit 1.1.21__py3-none-any.whl → 1.1.22__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.
- reykit/rsystem.py +37 -1
- reykit/rwrap.py +21 -5
- {reykit-1.1.21.dist-info → reykit-1.1.22.dist-info}/METADATA +1 -1
- {reykit-1.1.21.dist-info → reykit-1.1.22.dist-info}/RECORD +6 -6
- {reykit-1.1.21.dist-info → reykit-1.1.22.dist-info}/WHEEL +0 -0
- {reykit-1.1.21.dist-info → reykit-1.1.22.dist-info}/licenses/LICENSE +0 -0
reykit/rsystem.py
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
from typing import Any, TypedDict, Literal, overload
|
13
|
-
from collections.abc import Callable, Iterable, Sequence
|
13
|
+
from collections.abc import Callable, Iterable, Sequence, Mapping
|
14
14
|
from inspect import signature as inspect_signature, _ParameterKind, _empty
|
15
15
|
from sys import path as sys_path, modules as sys_modules
|
16
16
|
from os import getpid as os_getpid
|
@@ -32,6 +32,7 @@ from psutil import (
|
|
32
32
|
Process
|
33
33
|
)
|
34
34
|
from traceback import format_stack, extract_stack
|
35
|
+
from atexit import register as atexit_register
|
35
36
|
from subprocess import Popen, PIPE
|
36
37
|
from pymem import Pymem
|
37
38
|
from argparse import ArgumentParser
|
@@ -67,6 +68,7 @@ __all__ = (
|
|
67
68
|
'dos_command',
|
68
69
|
'dos_command_var',
|
69
70
|
'block',
|
71
|
+
'at_exit',
|
70
72
|
'is_class',
|
71
73
|
'is_instance',
|
72
74
|
'is_iterable',
|
@@ -359,6 +361,40 @@ def block() -> None:
|
|
359
361
|
continue
|
360
362
|
|
361
363
|
|
364
|
+
def at_exit(*contents: str | Callable | tuple[Callable, Iterable, Mapping]) -> list[Callable]:
|
365
|
+
"""
|
366
|
+
At exiting print text or execute function.
|
367
|
+
|
368
|
+
Parameters
|
369
|
+
----------
|
370
|
+
contents : execute contents.
|
371
|
+
- `str`: Define the print text function and execute it.
|
372
|
+
- `Callable`: Execute function.
|
373
|
+
- `tuple[Callable, Iterable, Mapping]`: Execute function and position arguments and keyword arguments.
|
374
|
+
|
375
|
+
Returns
|
376
|
+
-------
|
377
|
+
Execute functions.
|
378
|
+
"""
|
379
|
+
|
380
|
+
# Register.
|
381
|
+
funcs = []
|
382
|
+
for content in reversed(contents):
|
383
|
+
args = ()
|
384
|
+
kwargs = {}
|
385
|
+
if content.__class__ == str:
|
386
|
+
func = lambda : print(content)
|
387
|
+
elif callable(content):
|
388
|
+
func = content
|
389
|
+
elif content.__class__ == tuple:
|
390
|
+
func, args, kwargs = content
|
391
|
+
funcs.append(func)
|
392
|
+
atexit_register(func, *args, **kwargs)
|
393
|
+
funcs = list(reversed(funcs))
|
394
|
+
|
395
|
+
return funcs
|
396
|
+
|
397
|
+
|
362
398
|
def is_class(obj: Any) -> bool:
|
363
399
|
"""
|
364
400
|
Judge whether it is class.
|
reykit/rwrap.py
CHANGED
@@ -78,16 +78,16 @@ 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) -> Callable | Any: ...
|
81
|
+
def wrap(func: Callable, /, *args: Any, _execute: None = None, **kwargs: Any) -> Callable | Any: ...
|
82
82
|
|
83
83
|
@overload
|
84
|
-
def wrap(func: Callable, *args: Any, _execute: Literal[True] = None, **kwargs: Any) -> Any: ...
|
84
|
+
def wrap(func: Callable, /, *args: Any, _execute: Literal[True] = None, **kwargs: Any) -> Any: ...
|
85
85
|
|
86
86
|
@overload
|
87
|
-
def wrap(func: Callable, *args: Any, _execute: Literal[False] = None, **kwargs: Any) -> Callable: ...
|
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: bool | None = None, **kwargs: Any) -> Callable | Any:
|
90
|
+
def wrap(func: Callable, /, *args: Any, _execute: bool | None = None, **kwargs: Any) -> Callable | Any:
|
91
91
|
"""
|
92
92
|
Decorative shell.
|
93
93
|
|
@@ -149,13 +149,16 @@ def wrap_frame(decorator: Callable) -> Callable:
|
|
149
149
|
@overload
|
150
150
|
def wrap_runtime(
|
151
151
|
func: Callable,
|
152
|
+
/,
|
152
153
|
*args: Any,
|
153
154
|
_return_report: Literal[False] = False,
|
154
155
|
**kwargs: Any
|
155
156
|
) -> Any: ...
|
156
157
|
|
157
158
|
@overload
|
158
|
-
def wrap_runtime(
|
159
|
+
def wrap_runtime(
|
160
|
+
func: Callable,
|
161
|
+
/,
|
159
162
|
*args: Any,
|
160
163
|
_return_report: Literal[True] = False,
|
161
164
|
**kwargs: Any
|
@@ -164,6 +167,7 @@ def wrap_runtime(func: Callable,
|
|
164
167
|
@wrap_frame
|
165
168
|
def wrap_runtime(
|
166
169
|
func: Callable,
|
170
|
+
/,
|
167
171
|
*args: Any,
|
168
172
|
_return_report: bool = False,
|
169
173
|
**kwargs: Any
|
@@ -216,6 +220,7 @@ def wrap_runtime(
|
|
216
220
|
@overload
|
217
221
|
def wrap_thread(
|
218
222
|
func: Callable,
|
223
|
+
/,
|
219
224
|
*args: Any,
|
220
225
|
_daemon: bool = True,
|
221
226
|
**kwargs: Any
|
@@ -224,6 +229,7 @@ def wrap_thread(
|
|
224
229
|
@wrap_frame
|
225
230
|
def wrap_thread(
|
226
231
|
func: Callable,
|
232
|
+
/,
|
227
233
|
*args: Any,
|
228
234
|
_daemon: bool = True,
|
229
235
|
**kwargs: Any
|
@@ -259,6 +265,7 @@ def wrap_thread(
|
|
259
265
|
@overload
|
260
266
|
def wrap_exc(
|
261
267
|
func: Callable,
|
268
|
+
/,
|
262
269
|
*args: Any,
|
263
270
|
_exception: BaseException | tuple[BaseException, ...] = BaseException,
|
264
271
|
_handler: Callable | None = None,
|
@@ -268,6 +275,7 @@ def wrap_exc(
|
|
268
275
|
@wrap_frame
|
269
276
|
def wrap_exc(
|
270
277
|
func: Callable,
|
278
|
+
/,
|
271
279
|
*args: Any,
|
272
280
|
_exception: BaseException | tuple[BaseException, ...] = BaseException,
|
273
281
|
_handler: Callable | None = None,
|
@@ -306,6 +314,7 @@ def wrap_exc(
|
|
306
314
|
@overload
|
307
315
|
def wrap_retry(
|
308
316
|
func: Callable,
|
317
|
+
/,
|
309
318
|
*args: Any,
|
310
319
|
_report: str | None = None,
|
311
320
|
_exception: BaseException | tuple[BaseException, ...] = BaseException,
|
@@ -317,6 +326,7 @@ def wrap_retry(
|
|
317
326
|
@wrap_frame
|
318
327
|
def wrap_retry(
|
319
328
|
func: Callable,
|
329
|
+
/,
|
320
330
|
*args: Any,
|
321
331
|
_report: str | None = None,
|
322
332
|
_exception: BaseException | tuple[BaseException, ...] = BaseException,
|
@@ -384,6 +394,7 @@ def wrap_retry(
|
|
384
394
|
@overload
|
385
395
|
def wrap_dos_command(
|
386
396
|
func: Callable,
|
397
|
+
/,
|
387
398
|
*args: Any,
|
388
399
|
**kwargs: Any
|
389
400
|
) -> Any: ...
|
@@ -391,6 +402,7 @@ def wrap_dos_command(
|
|
391
402
|
@wrap_frame
|
392
403
|
def wrap_dos_command(
|
393
404
|
func: Callable,
|
405
|
+
/,
|
394
406
|
*args: Any,
|
395
407
|
**kwargs: Any
|
396
408
|
) -> Any:
|
@@ -509,6 +521,7 @@ wrap_cache_data: dict[Callable, list[tuple[Any, Any, Any]]] = {}
|
|
509
521
|
@overload
|
510
522
|
def wrap_cache(
|
511
523
|
func: Callable,
|
524
|
+
/,
|
512
525
|
*args: Any,
|
513
526
|
_overwrite: bool = False,
|
514
527
|
**kwargs: Any
|
@@ -517,6 +530,7 @@ def wrap_cache(
|
|
517
530
|
@wrap_frame
|
518
531
|
def wrap_cache(
|
519
532
|
func: Callable,
|
533
|
+
/,
|
520
534
|
*args: Any,
|
521
535
|
_overwrite: bool = False,
|
522
536
|
**kwargs: Any
|
@@ -568,6 +582,7 @@ def wrap_cache(
|
|
568
582
|
@overload
|
569
583
|
def wrap_redirect_stdout(
|
570
584
|
func: Callable,
|
585
|
+
/,
|
571
586
|
*args: Any,
|
572
587
|
_redirect: list | IOBase | None = None,
|
573
588
|
**kwargs: Any
|
@@ -576,6 +591,7 @@ def wrap_redirect_stdout(
|
|
576
591
|
@wrap_frame
|
577
592
|
def wrap_redirect_stdout(
|
578
593
|
func: Callable,
|
594
|
+
/,
|
579
595
|
*args: Any,
|
580
596
|
_redirect: list | IOBase | None = None,
|
581
597
|
**kwargs: Any
|
@@ -14,17 +14,17 @@ reykit/rrandom.py,sha256=4lTBL3IMhcurFeMOXaML_W7Q4xU4_HOW-si-13IrV3A,9246
|
|
14
14
|
reykit/rregex.py,sha256=XTlnDLior8yyncFdrTr9FsVlBcqMXvsWRfpmvQS-BR8,6089
|
15
15
|
reykit/rschedule.py,sha256=XkQ6xNxcJQjomNvbfTTMyo0KIbk0y3Dp0xq_HOCScJQ,5834
|
16
16
|
reykit/rstdout.py,sha256=E6wyze9fGcR1wEatD5gIcsPF_qsJ1SG5VkKWKSns944,9927
|
17
|
-
reykit/rsystem.py,sha256=
|
17
|
+
reykit/rsystem.py,sha256=bVcK-b5jqOi9zXPnjCu98xGmjPENFg5e4k7w44fPLdU,36420
|
18
18
|
reykit/rtable.py,sha256=gXszf_9DE_5SMdNcxMX-xd4IpHGQVjGsN3NQIm7wVGY,12055
|
19
19
|
reykit/rtext.py,sha256=whaKpVkd36yYVtCmZ1ptp_TVRL1v3f7Jab0vPXC8wXY,11089
|
20
20
|
reykit/rtime.py,sha256=1FC7JU-9t9dORUBUEzeVEvS73h7LDL9W8qTm9PZDscU,17110
|
21
21
|
reykit/rtype.py,sha256=O7iI_sJ1Bfl_ZiP29IHqEE3v3PfJRpeA5M6ukEdZSMk,2317
|
22
|
-
reykit/rwrap.py,sha256=
|
22
|
+
reykit/rwrap.py,sha256=N4rBDNW_PRGWbHqPB2cOWQFNAHpIBN-6MtmOEtupu4c,15360
|
23
23
|
reykit/rzip.py,sha256=i6KkmeSWCnq025d-O1mbuCYezNRUhyY9OGVK0CRlNAM,3522
|
24
24
|
reykit/rdll/__init__.py,sha256=vM9V7wSNno-WH9RrxgHTIgCkQm8LmBFoLFO8z7qovNo,306
|
25
25
|
reykit/rdll/rdll_inject.py,sha256=bETl8tywtN1OiQudbA21u6GwBM_bqVX7jbiisNj_JBg,645
|
26
26
|
reykit/rdll/rdll_inject_core.py,sha256=Trgh_pdJs_Lw-Y-0Kkn8kHr4BnilM9dBKnHnX25T_pM,5092
|
27
|
-
reykit-1.1.
|
28
|
-
reykit-1.1.
|
29
|
-
reykit-1.1.
|
30
|
-
reykit-1.1.
|
27
|
+
reykit-1.1.22.dist-info/METADATA,sha256=gU1EEQKERosR7K4NtmvIgkSQi1tLjIZc0AZQ-SI7zWI,1919
|
28
|
+
reykit-1.1.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
29
|
+
reykit-1.1.22.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
30
|
+
reykit-1.1.22.dist-info/RECORD,,
|
File without changes
|
File without changes
|