reykit 1.1.0__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 +25 -0
- reydb/rall.py +17 -0
- reydb/rbuild.py +1235 -0
- reydb/rconnection.py +2276 -0
- reydb/rexecute.py +350 -0
- reydb/rfile.py +416 -0
- reydb/rinformation.py +503 -0
- reydb/rparameter.py +243 -0
- 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 +10 -10
- reykit/rregex.py +10 -13
- reykit/rschedule.py +10 -10
- reykit/rstdout.py +13 -13
- reykit/rsystem.py +54 -54
- 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.1.0.dist-info → reykit-1.1.1.dist-info}/METADATA +1 -1
- reykit-1.1.1.dist-info/RECORD +38 -0
- reykit-1.1.0.dist-info/RECORD +0 -30
- {reykit-1.1.0.dist-info → reykit-1.1.1.dist-info}/WHEEL +0 -0
- {reykit-1.1.0.dist-info → reykit-1.1.1.dist-info}/top_level.txt +0 -0
reykit/rsystem.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any, TypedDict, Literal,
|
12
|
+
from typing import Any, TypedDict, Literal, overload
|
13
13
|
from collections.abc import Callable, Iterable, Sequence
|
14
14
|
from inspect import signature as inspect_signature, _ParameterKind, _empty
|
15
15
|
from sys import path as sys_path, modules as sys_modules
|
@@ -110,17 +110,17 @@ ComputerInfo = TypedDict(
|
|
110
110
|
NetWorkInfo = TypedDict(
|
111
111
|
'NetWorkTable',
|
112
112
|
{
|
113
|
-
'family':
|
114
|
-
'socket':
|
113
|
+
'family': str | None,
|
114
|
+
'socket': str | None,
|
115
115
|
'local_ip': str,
|
116
116
|
'local_port': int,
|
117
|
-
'remote_ip':
|
118
|
-
'remote_port':
|
119
|
-
'status':
|
120
|
-
'pid':
|
117
|
+
'remote_ip': str | None,
|
118
|
+
'remote_port': int | None,
|
119
|
+
'status': str | None,
|
120
|
+
'pid': int | None
|
121
121
|
}
|
122
122
|
)
|
123
|
-
ProcessInfo = TypedDict('ProcessInfo', {'create_time': datetime, 'id': int, 'name': str, 'ports':
|
123
|
+
ProcessInfo = TypedDict('ProcessInfo', {'create_time': datetime, 'id': int, 'name': str, 'ports': list[int] | None})
|
124
124
|
|
125
125
|
|
126
126
|
class RConfigSystem(object, metaclass=RConfigMeta):
|
@@ -208,7 +208,7 @@ def del_modules(path: str) -> list[str]:
|
|
208
208
|
return deleted_dict
|
209
209
|
|
210
210
|
|
211
|
-
def dos_command(command:
|
211
|
+
def dos_command(command: str | Iterable[str]) -> str:
|
212
212
|
"""
|
213
213
|
Execute DOS command.
|
214
214
|
|
@@ -444,7 +444,7 @@ def is_number_str(
|
|
444
444
|
|
445
445
|
def get_first_notnull(
|
446
446
|
*values: Any,
|
447
|
-
default:
|
447
|
+
default: Any | Literal['exception'] | None = None,
|
448
448
|
nulls: tuple = (None,)) -> Any:
|
449
449
|
"""
|
450
450
|
Get the first value that is not null.
|
@@ -482,12 +482,12 @@ def get_first_notnull(
|
|
482
482
|
|
483
483
|
|
484
484
|
@overload
|
485
|
-
def get_name(obj: tuple, frame: int = 2) ->
|
485
|
+
def get_name(obj: tuple, frame: int = 2) -> tuple[str, ...] | None: ...
|
486
486
|
|
487
487
|
@overload
|
488
|
-
def get_name(obj: Any, frame: int = 2) ->
|
488
|
+
def get_name(obj: Any, frame: int = 2) -> str | None: ...
|
489
489
|
|
490
|
-
def get_name(obj: Any, frame: int = 2) ->
|
490
|
+
def get_name(obj: Any, frame: int = 2) -> str | tuple[str, ...] | None:
|
491
491
|
"""
|
492
492
|
Get name of object or variable.
|
493
493
|
|
@@ -588,7 +588,7 @@ def get_stack_param(format_: Literal['floor'] = 'floor', limit: int = 2) -> dict
|
|
588
588
|
@overload
|
589
589
|
def get_stack_param(format_: Literal['full'] = 'floor', limit: int = 2) -> list[dict]: ...
|
590
590
|
|
591
|
-
def get_stack_param(format_: Literal['floor', 'full'] = 'floor', limit: int = 2) ->
|
591
|
+
def get_stack_param(format_: Literal['floor', 'full'] = 'floor', limit: int = 2) -> dict | list[dict]:
|
592
592
|
"""
|
593
593
|
Get code stack parameters.
|
594
594
|
|
@@ -644,7 +644,7 @@ def get_stack_param(format_: Literal['floor', 'full'] = 'floor', limit: int = 2)
|
|
644
644
|
def get_arg_info(func: Callable) -> list[
|
645
645
|
dict[
|
646
646
|
Literal['name', 'type', 'annotation', 'default'],
|
647
|
-
|
647
|
+
str | None
|
648
648
|
]
|
649
649
|
]:
|
650
650
|
"""
|
@@ -890,9 +890,9 @@ def get_process_table() -> list[ProcessInfo]:
|
|
890
890
|
|
891
891
|
|
892
892
|
def search_process(
|
893
|
-
id_:
|
894
|
-
name:
|
895
|
-
port:
|
893
|
+
id_: int | Sequence[int] | None = None,
|
894
|
+
name: str | Sequence[str] | None = None,
|
895
|
+
port: str | int | Sequence[str | int] | None = None,
|
896
896
|
) -> list[Process]:
|
897
897
|
"""
|
898
898
|
Search process by ID or name or port.
|
@@ -976,9 +976,9 @@ def search_process(
|
|
976
976
|
|
977
977
|
|
978
978
|
def kill_process(
|
979
|
-
id_:
|
980
|
-
name:
|
981
|
-
port:
|
979
|
+
id_: int | Sequence[int] | None = None,
|
980
|
+
name: str | Sequence[str] | None = None,
|
981
|
+
port: str | int | Sequence[str | int] | None = None,
|
982
982
|
) -> list[Process]:
|
983
983
|
"""
|
984
984
|
Search and kill process by ID or name or port.
|
@@ -1014,9 +1014,9 @@ def kill_process(
|
|
1014
1014
|
|
1015
1015
|
|
1016
1016
|
def stop_process(
|
1017
|
-
id_:
|
1018
|
-
name:
|
1019
|
-
port:
|
1017
|
+
id_: int | Sequence[int] | None = None,
|
1018
|
+
name: str | Sequence[str] | None = None,
|
1019
|
+
port: str | int | Sequence[str | int] | None = None,
|
1020
1020
|
) -> list[Process]:
|
1021
1021
|
"""
|
1022
1022
|
Search and stop process by ID or name or port.
|
@@ -1052,9 +1052,9 @@ def stop_process(
|
|
1052
1052
|
|
1053
1053
|
|
1054
1054
|
def start_process(
|
1055
|
-
id_:
|
1056
|
-
name:
|
1057
|
-
port:
|
1055
|
+
id_: int | Sequence[int] | None = None,
|
1056
|
+
name: str | Sequence[str] | None = None,
|
1057
|
+
port: str | int | Sequence[str | int] | None = None,
|
1058
1058
|
) -> list[Process]:
|
1059
1059
|
"""
|
1060
1060
|
Search and start process by ID or name or port.
|
@@ -1110,7 +1110,7 @@ def get_idle_port(min: int = 49152) -> int:
|
|
1110
1110
|
|
1111
1111
|
|
1112
1112
|
def memory_read(
|
1113
|
-
process:
|
1113
|
+
process: int | str,
|
1114
1114
|
dll: str,
|
1115
1115
|
offset: int
|
1116
1116
|
) -> int:
|
@@ -1149,7 +1149,7 @@ def memory_read(
|
|
1149
1149
|
|
1150
1150
|
|
1151
1151
|
def memory_write(
|
1152
|
-
process:
|
1152
|
+
process: int | str,
|
1153
1153
|
dll: str,
|
1154
1154
|
offset: int,
|
1155
1155
|
value: int
|
@@ -1200,8 +1200,8 @@ def open_browser(url: str) -> bool:
|
|
1200
1200
|
|
1201
1201
|
def popup_message(
|
1202
1202
|
style: Literal['info', 'warn', 'error'] = 'info',
|
1203
|
-
message:
|
1204
|
-
title:
|
1203
|
+
message: str | None = None,
|
1204
|
+
title: str | None = None
|
1205
1205
|
) -> None:
|
1206
1206
|
"""
|
1207
1207
|
Pop up system message box.
|
@@ -1237,22 +1237,22 @@ def popup_message(
|
|
1237
1237
|
@overload
|
1238
1238
|
def popup_ask(
|
1239
1239
|
style: Literal['yes_no_cancel'] = 'yes_no',
|
1240
|
-
message:
|
1241
|
-
title:
|
1242
|
-
) ->
|
1240
|
+
message: str | None = None,
|
1241
|
+
title: str | None = None
|
1242
|
+
) -> bool | None: ...
|
1243
1243
|
|
1244
1244
|
@overload
|
1245
1245
|
def popup_ask(
|
1246
1246
|
style: Literal['yes_no', 'ok_cancel', 'retry_cancel'] = 'yes_no',
|
1247
|
-
message:
|
1248
|
-
title:
|
1247
|
+
message: str | None = None,
|
1248
|
+
title: str | None = None
|
1249
1249
|
) -> bool: ...
|
1250
1250
|
|
1251
1251
|
def popup_ask(
|
1252
1252
|
style: Literal['yes_no', 'ok_cancel', 'retry_cancel', 'yes_no_cancel'] = 'yes_no',
|
1253
|
-
message:
|
1254
|
-
title:
|
1255
|
-
) ->
|
1253
|
+
message: str | None = None,
|
1254
|
+
title: str | None = None
|
1255
|
+
) -> bool | None:
|
1256
1256
|
"""
|
1257
1257
|
Pop up system ask box.
|
1258
1258
|
|
@@ -1292,35 +1292,35 @@ def popup_ask(
|
|
1292
1292
|
@overload
|
1293
1293
|
def popup_select(
|
1294
1294
|
style: Literal['file', 'save'] = 'file',
|
1295
|
-
title :
|
1296
|
-
init_folder :
|
1297
|
-
init_file :
|
1298
|
-
filter_file :
|
1295
|
+
title : str | None = None,
|
1296
|
+
init_folder : str | None = None,
|
1297
|
+
init_file : str | None = None,
|
1298
|
+
filter_file : list[tuple[str, str | list[str]]] | None = None
|
1299
1299
|
) -> str: ...
|
1300
1300
|
|
1301
1301
|
@overload
|
1302
1302
|
def popup_select(
|
1303
1303
|
style: Literal['files'] = 'file',
|
1304
|
-
title :
|
1305
|
-
init_folder :
|
1306
|
-
init_file :
|
1307
|
-
filter_file :
|
1304
|
+
title : str | None = None,
|
1305
|
+
init_folder : str | None = None,
|
1306
|
+
init_file : str | None = None,
|
1307
|
+
filter_file : list[tuple[str, str | list[str]]] | None = None
|
1308
1308
|
) -> tuple[str, ...]: ...
|
1309
1309
|
|
1310
1310
|
@overload
|
1311
1311
|
def popup_select(
|
1312
1312
|
style: Literal['folder'] = 'file',
|
1313
|
-
title :
|
1314
|
-
init_folder :
|
1313
|
+
title : str | None = None,
|
1314
|
+
init_folder : str | None = None
|
1315
1315
|
) -> str: ...
|
1316
1316
|
|
1317
1317
|
def popup_select(
|
1318
1318
|
style: Literal['file', 'files', 'folder', 'save'] = 'file',
|
1319
|
-
title :
|
1320
|
-
init_folder :
|
1321
|
-
init_file :
|
1322
|
-
filter_file :
|
1323
|
-
) ->
|
1319
|
+
title : str | None = None,
|
1320
|
+
init_folder : str | None = None,
|
1321
|
+
init_file : str | None = None,
|
1322
|
+
filter_file : list[tuple[str, str | list[str]]] | None = None
|
1323
|
+
) -> str | tuple[str, ...]:
|
1324
1324
|
"""
|
1325
1325
|
Pop up system select box.
|
1326
1326
|
|
reykit/rtable.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any, TypedDict,
|
12
|
+
from typing import Any, TypedDict, overload
|
13
13
|
from collections.abc import Iterable
|
14
14
|
from os.path import abspath as os_abspath
|
15
15
|
from pandas import DataFrame, ExcelWriter, isnull
|
@@ -34,13 +34,13 @@ __all__ = (
|
|
34
34
|
)
|
35
35
|
|
36
36
|
|
37
|
-
type Table =
|
38
|
-
SheetSet = TypedDict('SheetsSet', {'name': str, 'index': int, 'fields':
|
37
|
+
type Table = list[dict] | dict | CursorResult | DataFrame
|
38
|
+
SheetSet = TypedDict('SheetsSet', {'name': str, 'index': int, 'fields': str | list[str]})
|
39
39
|
|
40
40
|
|
41
41
|
def to_table(
|
42
|
-
data:
|
43
|
-
fields:
|
42
|
+
data: Table | Iterable[Iterable],
|
43
|
+
fields: Iterable | None = None
|
44
44
|
) -> list[dict]:
|
45
45
|
"""
|
46
46
|
Convert data to table in `list[dict]` format, keys and keys sort of the dictionary are the same.
|
@@ -95,23 +95,23 @@ def to_table(
|
|
95
95
|
|
96
96
|
@overload
|
97
97
|
def to_dict(
|
98
|
-
data:
|
99
|
-
key_field:
|
98
|
+
data: Table | Iterable[Iterable],
|
99
|
+
key_field: int | str = 0,
|
100
100
|
val_field: None = None
|
101
101
|
) -> dict[Any, dict]: ...
|
102
102
|
|
103
103
|
@overload
|
104
104
|
def to_dict(
|
105
|
-
data:
|
106
|
-
key_field:
|
107
|
-
val_field:
|
105
|
+
data: Table | Iterable[Iterable],
|
106
|
+
key_field: int | str = 0,
|
107
|
+
val_field: int | str = None
|
108
108
|
) -> dict: ...
|
109
109
|
|
110
110
|
def to_dict(
|
111
|
-
data:
|
112
|
-
key_field:
|
113
|
-
val_field:
|
114
|
-
) ->
|
111
|
+
data: Table | Iterable[Iterable],
|
112
|
+
key_field: int | str = 0,
|
113
|
+
val_field: int | str | None = None
|
114
|
+
) -> dict[Any, dict] | dict:
|
115
115
|
"""
|
116
116
|
Convert data as dictionary.
|
117
117
|
|
@@ -169,8 +169,8 @@ def to_dict(
|
|
169
169
|
|
170
170
|
|
171
171
|
def to_list(
|
172
|
-
data:
|
173
|
-
field:
|
172
|
+
data: Table | Iterable[Iterable],
|
173
|
+
field: int | str = 0,
|
174
174
|
) -> list:
|
175
175
|
"""
|
176
176
|
Convert data as list.
|
@@ -209,8 +209,8 @@ def to_list(
|
|
209
209
|
|
210
210
|
|
211
211
|
def to_df(
|
212
|
-
data:
|
213
|
-
fields:
|
212
|
+
data: Table | Iterable[Iterable],
|
213
|
+
fields: Iterable | None = None
|
214
214
|
) -> DataFrame:
|
215
215
|
"""
|
216
216
|
Convert data to table of `DataFrame` object.
|
@@ -253,8 +253,8 @@ def to_df(
|
|
253
253
|
|
254
254
|
|
255
255
|
def to_json(
|
256
|
-
data:
|
257
|
-
fields:
|
256
|
+
data: Table | Iterable[Iterable],
|
257
|
+
fields: Iterable | None = None,
|
258
258
|
compact: bool = True
|
259
259
|
) -> str:
|
260
260
|
"""
|
@@ -283,8 +283,8 @@ def to_json(
|
|
283
283
|
|
284
284
|
|
285
285
|
def to_text(
|
286
|
-
data:
|
287
|
-
fields:
|
286
|
+
data: Table | Iterable[Iterable],
|
287
|
+
fields: Iterable | None = None,
|
288
288
|
width: int = 100
|
289
289
|
) -> str:
|
290
290
|
"""
|
@@ -313,8 +313,8 @@ def to_text(
|
|
313
313
|
|
314
314
|
|
315
315
|
def to_sql(
|
316
|
-
data:
|
317
|
-
fields:
|
316
|
+
data: Table | Iterable[Iterable],
|
317
|
+
fields: Iterable | None = None
|
318
318
|
) -> str:
|
319
319
|
"""
|
320
320
|
Convert data to SQL string.
|
@@ -365,8 +365,8 @@ def to_sql(
|
|
365
365
|
|
366
366
|
|
367
367
|
def to_html(
|
368
|
-
data:
|
369
|
-
fields:
|
368
|
+
data: Table | Iterable[Iterable],
|
369
|
+
fields: Iterable | None = None
|
370
370
|
) -> str:
|
371
371
|
"""
|
372
372
|
Convert data to HTML string.
|
@@ -393,9 +393,9 @@ def to_html(
|
|
393
393
|
|
394
394
|
|
395
395
|
def to_csv(
|
396
|
-
data:
|
396
|
+
data: Table | Iterable[Iterable],
|
397
397
|
path: str = 'data.csv',
|
398
|
-
fields:
|
398
|
+
fields: Iterable | None = None
|
399
399
|
) -> str:
|
400
400
|
"""
|
401
401
|
Convert data to save CSV format file.
|
@@ -429,10 +429,10 @@ def to_csv(
|
|
429
429
|
|
430
430
|
|
431
431
|
def to_excel(
|
432
|
-
data:
|
432
|
+
data: Table | Iterable[Iterable],
|
433
433
|
path: str = 'data.xlsx',
|
434
|
-
group_field:
|
435
|
-
sheets_set: dict[
|
434
|
+
group_field: str | None = None,
|
435
|
+
sheets_set: dict[str | int, SheetSet] = {}
|
436
436
|
) -> str:
|
437
437
|
"""
|
438
438
|
Convert data to save Excel format file and return sheet name and sheet data.
|
reykit/rtext.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any, Literal
|
12
|
+
from typing import Any, Literal
|
13
13
|
from collections.abc import Iterable
|
14
14
|
from decimal import Decimal
|
15
15
|
from pprint import pformat as pprint_pformat
|
@@ -278,7 +278,7 @@ def join_filter_text(data: Iterable, char: str = ',', filter_: tuple = (None, ''
|
|
278
278
|
|
279
279
|
def add_text_frame(
|
280
280
|
*texts: str,
|
281
|
-
title:
|
281
|
+
title: str | None,
|
282
282
|
width: int,
|
283
283
|
frame: Literal['full', 'half', 'top', 'half_plain', 'top_plain']
|
284
284
|
) -> str:
|
@@ -289,7 +289,7 @@ def add_text_frame(
|
|
289
289
|
----------
|
290
290
|
texts : Texts.
|
291
291
|
title : Frame title.
|
292
|
-
- `
|
292
|
+
- `None | Literal['']`: No title.
|
293
293
|
- `str`: Use this value as the title.
|
294
294
|
width : Frame width.
|
295
295
|
frame : Frame type.
|
reykit/rtime.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any, TypedDict, Literal,
|
12
|
+
from typing import Any, TypedDict, Literal, overload, NoReturn
|
13
13
|
from collections.abc import Callable
|
14
14
|
from pandas import (
|
15
15
|
DataFrame,
|
@@ -47,7 +47,7 @@ __all__ = (
|
|
47
47
|
)
|
48
48
|
|
49
49
|
|
50
|
-
RecordData = TypedDict('RecordData', {'timestamp': int, 'datetime': datetime_datetime, 'timedelta':
|
50
|
+
RecordData = TypedDict('RecordData', {'timestamp': int, 'datetime': datetime_datetime, 'timedelta': datetime_timedelta | None, 'note': str | None})
|
51
51
|
|
52
52
|
|
53
53
|
@overload
|
@@ -78,13 +78,7 @@ def now(
|
|
78
78
|
'time_str',
|
79
79
|
'timestamp'
|
80
80
|
] = 'datetime'
|
81
|
-
) ->
|
82
|
-
datetime_datetime,
|
83
|
-
datetime_date,
|
84
|
-
datetime_time,
|
85
|
-
str,
|
86
|
-
int
|
87
|
-
]:
|
81
|
+
) -> datetime_datetime | datetime_date | datetime_time | str | int:
|
88
82
|
"""
|
89
83
|
Get the now time.
|
90
84
|
|
@@ -126,15 +120,7 @@ def now(
|
|
126
120
|
|
127
121
|
@overload
|
128
122
|
def time_to(
|
129
|
-
obj:
|
130
|
-
datetime_datetime,
|
131
|
-
datetime_date,
|
132
|
-
datetime_time,
|
133
|
-
datetime_timedelta,
|
134
|
-
time_struct_time,
|
135
|
-
pd_timestamp,
|
136
|
-
pd_timedelta
|
137
|
-
],
|
123
|
+
obj: datetime_datetime | datetime_date | datetime_time | datetime_timedelta | time_struct_time | pd_timestamp | pd_timedelta,
|
138
124
|
decimal: bool = False,
|
139
125
|
raising: bool = True
|
140
126
|
) -> str: ...
|
@@ -241,13 +227,7 @@ def time_to(
|
|
241
227
|
|
242
228
|
def text_to_time(
|
243
229
|
string: str
|
244
|
-
) ->
|
245
|
-
Union[
|
246
|
-
datetime_datetime,
|
247
|
-
datetime_date,
|
248
|
-
datetime_time
|
249
|
-
]
|
250
|
-
]:
|
230
|
+
) -> datetime_datetime | datetime_date | datetime_time | None:
|
251
231
|
"""
|
252
232
|
Convert text to time object.
|
253
233
|
|
@@ -332,11 +312,11 @@ def text_to_time(
|
|
332
312
|
def to_time(
|
333
313
|
obj: str,
|
334
314
|
raising: bool = True
|
335
|
-
) ->
|
315
|
+
) -> datetime_datetime | datetime_date | datetime_time: ...
|
336
316
|
|
337
317
|
@overload
|
338
318
|
def to_time(
|
339
|
-
obj:
|
319
|
+
obj: time_struct_time | float,
|
340
320
|
raising: bool = True
|
341
321
|
) -> datetime_datetime: ...
|
342
322
|
|
@@ -413,7 +393,7 @@ def to_time(
|
|
413
393
|
|
414
394
|
def sleep(
|
415
395
|
*thresholds: float,
|
416
|
-
precision:
|
396
|
+
precision: int | None = None
|
417
397
|
) -> float:
|
418
398
|
"""
|
419
399
|
Sleep random seconds.
|
@@ -452,7 +432,7 @@ def wait(
|
|
452
432
|
func: Callable[..., bool],
|
453
433
|
*args: Any,
|
454
434
|
_interval: float = 1,
|
455
|
-
_timeout:
|
435
|
+
_timeout: float | None = None,
|
456
436
|
**kwargs: Any
|
457
437
|
) -> float:
|
458
438
|
"""
|
@@ -522,7 +502,7 @@ class RTimeMark():
|
|
522
502
|
self.record: dict[int, RecordData] = {}
|
523
503
|
|
524
504
|
|
525
|
-
def mark(self, note:
|
505
|
+
def mark(self, note: str | None = None) -> int:
|
526
506
|
"""
|
527
507
|
Marking now time.
|
528
508
|
|
@@ -560,7 +540,7 @@ class RTimeMark():
|
|
560
540
|
return index
|
561
541
|
|
562
542
|
|
563
|
-
def report(self, title:
|
543
|
+
def report(self, title: str | None = None) -> DataFrame:
|
564
544
|
"""
|
565
545
|
Print and return time mark information table.
|
566
546
|
|
reykit/rtype.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any,
|
12
|
+
from typing import Any, Self
|
13
13
|
from collections.abc import Callable
|
14
14
|
|
15
15
|
|
@@ -86,7 +86,7 @@ class RSingleton(object):
|
|
86
86
|
When instantiated, method `__singleton__` will be called only once, and will accept arguments.
|
87
87
|
"""
|
88
88
|
|
89
|
-
_instance:
|
89
|
+
_instance: Self | None = None
|
90
90
|
|
91
91
|
|
92
92
|
def __new__(self, *arg: Any, **kwargs: Any) -> Self:
|
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.
|