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.
Files changed (60) hide show
  1. reydb/__init__.py +1 -1
  2. reydb/rbuild.py +44 -44
  3. reydb/rconnection.py +107 -107
  4. reydb/rexecute.py +9 -13
  5. reydb/rfile.py +8 -8
  6. reydb/rinformation.py +13 -25
  7. reydb/rparameter.py +10 -10
  8. reykit/__init__.py +1 -1
  9. reykit/rcomm.py +12 -12
  10. reykit/rdata.py +4 -4
  11. reykit/remail.py +12 -14
  12. reykit/rexception.py +4 -4
  13. reykit/rimage.py +9 -9
  14. reykit/rlog.py +30 -30
  15. reykit/rmonkey.py +4 -5
  16. reykit/rmultitask.py +14 -15
  17. reykit/rnumber.py +2 -2
  18. reykit/ros.py +21 -21
  19. reykit/rrandom.py +11 -11
  20. reykit/rregex.py +10 -13
  21. reykit/rschedule.py +10 -10
  22. reykit/rstdout.py +13 -13
  23. reykit/rsystem.py +224 -30
  24. reykit/rtable.py +31 -31
  25. reykit/rtext.py +3 -3
  26. reykit/rtime.py +11 -31
  27. reykit/rtype.py +2 -2
  28. reykit/rwrap.py +16 -16
  29. reykit/rzip.py +4 -5
  30. {reykit-1.0.1.dist-info → reykit-1.1.1.dist-info}/METADATA +1 -1
  31. reykit-1.1.1.dist-info/RECORD +38 -0
  32. reykit-1.0.1.dist-info/RECORD +0 -64
  33. reyweb/__init__.py +0 -19
  34. reyweb/rall.py +0 -12
  35. reyweb/rbaidu/__init__.py +0 -21
  36. reyweb/rbaidu/rbaidu_base.py +0 -186
  37. reyweb/rbaidu/rbaidu_chat.py +0 -299
  38. reyweb/rbaidu/rbaidu_image.py +0 -183
  39. reyweb/rbaidu/rbaidu_voice.py +0 -256
  40. reywechat/__init__.py +0 -32
  41. reywechat/data/client_api.dll +0 -0
  42. reywechat/rall.py +0 -20
  43. reywechat/rclient.py +0 -912
  44. reywechat/rdatabase.py +0 -1189
  45. reywechat/rexception.py +0 -65
  46. reywechat/rexecute.py +0 -201
  47. reywechat/rlog.py +0 -198
  48. reywechat/rreceive.py +0 -1232
  49. reywechat/rschedule.py +0 -136
  50. reywechat/rsend.py +0 -630
  51. reywechat/rwechat.py +0 -201
  52. reyworm/__init__.py +0 -24
  53. reyworm/rall.py +0 -16
  54. reyworm/rbrowser.py +0 -134
  55. reyworm/rcalendar.py +0 -159
  56. reyworm/rnews.py +0 -126
  57. reyworm/rsecurity.py +0 -239
  58. reyworm/rtranslate.py +0 -75
  59. {reykit-1.0.1.dist-info → reykit-1.1.1.dist-info}/WHEEL +0 -0
  60. {reykit-1.0.1.dist-info → reykit-1.1.1.dist-info}/top_level.txt +0 -0
reydb/rinformation.py CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
  from __future__ import annotations
13
- from typing import Any, Union, Literal, Optional, overload
13
+ from typing import Any, Literal, overload
14
14
 
15
15
  from .rconnection import RDatabase, RDBConnection
16
16
 
@@ -31,24 +31,18 @@ class RDBInformation(object):
31
31
 
32
32
 
33
33
  @overload
34
- def __call__(self: RDBISchema, name: Optional[str] = None) -> Union[RDBIDatabase, list[dict]]: ...
34
+ def __call__(self: RDBISchema, name: str | None = None) -> RDBIDatabase | list[dict]: ...
35
35
 
36
36
  @overload
37
- def __call__(self: RDBIDatabase, name: Optional[str] = None) -> Union[RDBITable, list[dict]]: ...
37
+ def __call__(self: RDBIDatabase, name: str | None = None) -> RDBITable | list[dict]: ...
38
38
 
39
39
  @overload
40
- def __call__(self: RDBITable, name: Optional[str] = None) -> Union[RDBIColumn, list[dict]]: ...
40
+ def __call__(self: RDBITable, name: str | None = None) -> RDBIColumn | list[dict]: ...
41
41
 
42
42
  @overload
43
- def __call__(self: RDBIColumn, name: Optional[str] = None) -> dict: ...
44
-
45
- def __call__(self, name: Optional[str] = None) -> Union[
46
- RDBIDatabase,
47
- RDBITable,
48
- RDBIColumn,
49
- list[dict],
50
- dict
51
- ]:
43
+ def __call__(self: RDBIColumn, name: str | None = None) -> dict: ...
44
+
45
+ def __call__(self, name: str | None = None) -> RDBIDatabase | RDBITable | RDBIColumn | list[dict] | dict:
52
46
  """
53
47
  Get information table or subclass instance.
54
48
 
@@ -127,7 +121,7 @@ class RDBInformation(object):
127
121
 
128
122
 
129
123
  @overload
130
- def __getattr__(self, key: Literal['_rdatabase']) -> Union[RDatabase, RDBConnection]: ...
124
+ def __getattr__(self, key: Literal['_rdatabase']) -> RDatabase | RDBConnection: ...
131
125
 
132
126
  @overload
133
127
  def __getattr__(self, key: Literal['_database_name', '_table_name']) -> str: ...
@@ -141,13 +135,7 @@ class RDBInformation(object):
141
135
  @overload
142
136
  def __getattr__(self: RDBITable, key: str) -> RDBIColumn: ...
143
137
 
144
- def __getattr__(self, key: str) -> Union[
145
- Union[RDatabase, RDBConnection],
146
- str,
147
- RDBIDatabase,
148
- RDBITable,
149
- RDBIColumn
150
- ]:
138
+ def __getattr__(self, key: str) -> RDatabase | RDBConnection | str | RDBIDatabase | RDBITable | RDBIColumn:
151
139
  """
152
140
  Get attribute or build subclass instance.
153
141
 
@@ -209,7 +197,7 @@ class RDBISchema(RDBInformation):
209
197
 
210
198
  def __init__(
211
199
  self,
212
- rdatabase: Union[RDatabase, RDBConnection]
200
+ rdatabase: RDatabase | RDBConnection
213
201
  ) -> None:
214
202
  """
215
203
  Build `database information schema` attributes.
@@ -272,7 +260,7 @@ class RDBIDatabase(RDBInformation):
272
260
 
273
261
  def __init__(
274
262
  self,
275
- rdatabase: Union[RDatabase, RDBConnection],
263
+ rdatabase: RDatabase | RDBConnection,
276
264
  database_name: str
277
265
  ) -> None:
278
266
  """
@@ -366,7 +354,7 @@ class RDBITable(RDBInformation):
366
354
 
367
355
  def __init__(
368
356
  self,
369
- rdatabase: Union[RDatabase, RDBConnection],
357
+ rdatabase: RDatabase | RDBConnection,
370
358
  database_name: str,
371
359
  table_name: str
372
360
  ) -> None:
@@ -459,7 +447,7 @@ class RDBIColumn(RDBInformation):
459
447
 
460
448
  def __init__(
461
449
  self,
462
- rdatabase: Union[RDatabase, RDBConnection],
450
+ rdatabase: RDatabase | RDBConnection,
463
451
  database_name: str,
464
452
  table_name: str,
465
453
  column_name: str
reydb/rparameter.py CHANGED
@@ -9,7 +9,7 @@
9
9
  """
10
10
 
11
11
 
12
- from typing import Union, Optional, overload
12
+ from typing import overload
13
13
 
14
14
  from .rconnection import RDatabase, RDBConnection
15
15
 
@@ -29,7 +29,7 @@ class RDBParameter(object):
29
29
 
30
30
  def __init__(
31
31
  self,
32
- rdatabase: Union[RDatabase, RDBConnection],
32
+ rdatabase: RDatabase | RDBConnection,
33
33
  global_: bool
34
34
  ) -> None:
35
35
  """
@@ -46,7 +46,7 @@ class RDBParameter(object):
46
46
  self.global_ = global_
47
47
 
48
48
 
49
- def __getitem__(self, key: str) -> Optional[str]:
49
+ def __getitem__(self, key: str) -> str | None:
50
50
  """
51
51
  Get item of parameter dictionary.
52
52
 
@@ -65,7 +65,7 @@ class RDBParameter(object):
65
65
  return value
66
66
 
67
67
 
68
- def __setitem__(self, key: str, value: Union[str, float]) -> None:
68
+ def __setitem__(self, key: str, value: str | float) -> None:
69
69
  """
70
70
  Set item of parameter dictionary.
71
71
 
@@ -92,9 +92,9 @@ class RDBPStatus(RDBParameter):
92
92
  def get(self, key: None = None) -> dict[str, str]: ...
93
93
 
94
94
  @overload
95
- def get(self, key: str = None) -> Optional[str]: ...
95
+ def get(self, key: str = None) -> str | None: ...
96
96
 
97
- def get(self, key: Optional[str] = None) -> Union[dict[str, str], Optional[str]]:
97
+ def get(self, key: str | None = None) -> dict[str, str] | str | None:
98
98
  """
99
99
  Get parameter.
100
100
 
@@ -138,7 +138,7 @@ class RDBPStatus(RDBParameter):
138
138
  return status
139
139
 
140
140
 
141
- def update(self, params: dict[str, Union[str, float]]) -> None:
141
+ def update(self, params: dict[str, str | float]) -> None:
142
142
  """
143
143
  Update parameter.
144
144
 
@@ -161,9 +161,9 @@ class RDBPVariable(RDBParameter):
161
161
  def get(self, key: None = None) -> dict[str, str]: ...
162
162
 
163
163
  @overload
164
- def get(self, key: str = None) -> Optional[str]: ...
164
+ def get(self, key: str = None) -> str | None: ...
165
165
 
166
- def get(self, key: Optional[str] = None) -> Union[dict[str, str], Optional[str]]:
166
+ def get(self, key: str | None = None) -> dict[str, str] | str | None:
167
167
  """
168
168
  Get parameter.
169
169
 
@@ -208,7 +208,7 @@ class RDBPVariable(RDBParameter):
208
208
 
209
209
 
210
210
 
211
- def update(self, params: dict[str, Union[str, float]]) -> None:
211
+ def update(self, params: dict[str, str | float]) -> None:
212
212
  """
213
213
  Update parameter.
214
214
 
reykit/__init__.py CHANGED
@@ -38,4 +38,4 @@ rzip : File compress methods.
38
38
  from typing import Final
39
39
 
40
40
 
41
- __version__: Final[str] = '1.0.1'
41
+ __version__: Final[str] = '1.1.1'
reykit/rcomm.py CHANGED
@@ -9,7 +9,7 @@
9
9
  """
10
10
 
11
11
 
12
- from typing import Any, Literal, Optional, Union
12
+ from typing import Any, Literal
13
13
  from collections.abc import Callable, Iterable
14
14
  from warnings import filterwarnings
15
15
  from os.path import abspath as os_abspath, isfile as os_isfile
@@ -149,7 +149,7 @@ def split_cookie(cookie: str) -> dict[str, str]:
149
149
  return params
150
150
 
151
151
 
152
- def get_content_type(file: Union[str, bytes]) -> Optional[str]:
152
+ def get_content_type(file: str | bytes) -> str | None:
153
153
  """
154
154
  Get HTTP content type of file.
155
155
 
@@ -184,17 +184,17 @@ def get_content_type(file: Union[str, bytes]) -> Optional[str]:
184
184
 
185
185
  def request(
186
186
  url: str,
187
- params: Optional[dict] = None,
188
- data: Optional[Union[dict, str, bytes]] = None,
189
- json: Optional[dict] = None,
190
- files: Optional[dict[str, Union[str, bytes, tuple[Union[str, bytes], dict]]]] = None,
187
+ params: dict | None = None,
188
+ data: dict | str | bytes | None = None,
189
+ json: dict | None = None,
190
+ files: dict[str, str | bytes | tuple[str | bytes, dict]] | None = None,
191
191
  headers: dict[str, str] = {},
192
- timeout: Optional[float] = None,
192
+ timeout: float | None = None,
193
193
  proxies: dict[str, str] = {},
194
194
  stream: bool = False,
195
195
  verify: bool = False,
196
- method: Optional[Literal['get', 'post', 'put', 'patch', 'delete', 'options', 'head']] = None,
197
- check: Union[bool, int, Iterable[int]] = False
196
+ method: Literal['get', 'post', 'put', 'patch', 'delete', 'options', 'head'] | None = None,
197
+ check: bool | int | Iterable[int] = False
198
198
  ) -> Response:
199
199
  """
200
200
  Send request.
@@ -318,7 +318,7 @@ def request(
318
318
  return response
319
319
 
320
320
 
321
- def download(url: str, path: Optional[str] = None) -> str:
321
+ def download(url: str, path: str | None = None) -> str:
322
322
  """
323
323
  Download file from URL.
324
324
 
@@ -363,7 +363,7 @@ def download(url: str, path: Optional[str] = None) -> str:
363
363
 
364
364
 
365
365
  def get_file_stream_time(
366
- file: Union[str, bytes, int],
366
+ file: str | bytes | int,
367
367
  bandwidth: float
368
368
  ) -> float:
369
369
  """
@@ -402,7 +402,7 @@ def get_file_stream_time(
402
402
 
403
403
  def listen_socket(
404
404
  host: str,
405
- port: Union[str, int],
405
+ port: str | int,
406
406
  handler: Callable[[bytes], Any]
407
407
  ) -> None:
408
408
  """
reykit/rdata.py CHANGED
@@ -9,7 +9,7 @@
9
9
  """
10
10
 
11
11
 
12
- from typing import Any, TypedDict, Optional, Literal, NoReturn, TypeVar, overload
12
+ from typing import Any, TypedDict, Literal, NoReturn, TypeVar, overload
13
13
  from collections.abc import Callable, Iterable, Generator
14
14
 
15
15
  from .rexception import check_least_one, check_most_one
@@ -87,7 +87,7 @@ def count(
87
87
  return result
88
88
 
89
89
 
90
- def flatten(data: Any, *, _flattern_data: Optional[list] = None) -> list:
90
+ def flatten(data: Any, *, _flattern_data: list | None = None) -> list:
91
91
  """
92
92
  Flatten data.
93
93
 
@@ -136,9 +136,9 @@ def split(data: Iterable[Element], share: None = None, bin_size: None = None) ->
136
136
  def split(data: Iterable[Element], share: int = None, bin_size: int = None) -> NoReturn: ...
137
137
 
138
138
  @overload
139
- def split(data: Iterable[Element], share: Optional[int] = None, bin_size: Optional[int] = None) -> list[list[Element]]: ...
139
+ def split(data: Iterable[Element], share: int | None = None, bin_size: int | None = None) -> list[list[Element]]: ...
140
140
 
141
- def split(data: Iterable[Element], share: Optional[int] = None, bin_size: Optional[int] = None) -> list[list[Element]]:
141
+ def split(data: Iterable[Element], share: int | None = None, bin_size: int | None = None) -> list[list[Element]]:
142
142
  """
143
143
  Split data into multiple data.
144
144
 
reykit/remail.py CHANGED
@@ -9,8 +9,6 @@
9
9
  """
10
10
 
11
11
 
12
- from typing import Optional, Union
13
- from io import BufferedIOBase
14
12
  from smtplib import SMTP
15
13
  from email.mime.multipart import MIMEMultipart
16
14
  from email.mime.text import MIMEText
@@ -101,12 +99,12 @@ class REmail(object):
101
99
 
102
100
  def create_email(
103
101
  self,
104
- title: Optional[str],
105
- text: Optional[str],
102
+ title: str | None,
103
+ text: str | None,
106
104
  attachment: dict[str, bytes],
107
- show_from: Optional[str],
108
- show_to: Optional[list[str]],
109
- show_cc: Optional[list[str]]
105
+ show_from: str | None,
106
+ show_to: list[str] | None,
107
+ show_cc: list[str] | None
110
108
  ) -> str:
111
109
  """
112
110
  create email content.
@@ -169,14 +167,14 @@ class REmail(object):
169
167
 
170
168
  def send_email(
171
169
  self,
172
- to: Union[str, list[str]],
173
- title: Optional[str] = None,
174
- text: Optional[str] = None,
170
+ to: str | list[str],
171
+ title: str | None = None,
172
+ text: str | None = None,
175
173
  attachment: dict[str, FileBytes] = {},
176
- cc: Optional[Union[str, list[str]]] = None,
177
- show_from: Optional[str] = None,
178
- show_to: Optional[Union[str, list[str]]] = None,
179
- show_cc: Optional[Union[str, list[str]]] = None
174
+ cc: str | list[str] | None = None,
175
+ show_from: str | None = None,
176
+ show_to: str | list[str] | None = None,
177
+ show_cc: str | list[str] | None = None
180
178
  ) -> None:
181
179
  """
182
180
  Send email.
reykit/rexception.py CHANGED
@@ -20,7 +20,7 @@
20
20
  """
21
21
 
22
22
 
23
- from typing import Any, Optional, Union, NoReturn
23
+ from typing import Any, NoReturn
24
24
  from types import TracebackType
25
25
  from collections.abc import Iterable
26
26
  from sys import exc_info as sys_exc_info
@@ -61,7 +61,7 @@ def throw(
61
61
  exception: type[BaseException] = AssertionError,
62
62
  value: Any = RNull,
63
63
  *values: Any,
64
- text: Optional[str] = None,
64
+ text: str | None = None,
65
65
  frame: int = 2
66
66
  ) -> NoReturn:
67
67
  """
@@ -176,7 +176,7 @@ def warn(
176
176
 
177
177
 
178
178
  def catch_exc(
179
- title: Optional[str] = None
179
+ title: str | None = None
180
180
  ) -> tuple[str, type[BaseException], BaseException, TracebackType]:
181
181
  """
182
182
  Catch exception information and print, must used in `except` syntax.
@@ -303,7 +303,7 @@ def check_file_exist(path: str) -> None:
303
303
 
304
304
  def check_response_code(
305
305
  code: int,
306
- range_: Optional[Union[int, Iterable[int]]] = None
306
+ range_: int | Iterable[int] | None = None
307
307
  ) -> bool:
308
308
  """
309
309
  Check if the response code is in range.
reykit/rimage.py CHANGED
@@ -9,7 +9,7 @@
9
9
  """
10
10
 
11
11
 
12
- from typing import Any, Union, Optional
12
+ from typing import Any
13
13
  from io import BytesIO
14
14
  from qrcode import make as qrcode_make
15
15
  from qrcode.image.pil import PilImage
@@ -42,7 +42,7 @@ monkey_image_type = monkey_path_pil_image_get_bytes()
42
42
  RImage = monkey_image_type
43
43
 
44
44
 
45
- def encode_qrcode(text: str, path: Optional[str] = None) -> bytes:
45
+ def encode_qrcode(text: str, path: str | None = None) -> bytes:
46
46
  """
47
47
  Encoding text to QR code image.
48
48
 
@@ -73,7 +73,7 @@ def encode_qrcode(text: str, path: Optional[str] = None) -> bytes:
73
73
  return file_bytes
74
74
 
75
75
 
76
- def decode_qrcode(image: Union[str, bytes]) -> list[str]:
76
+ def decode_qrcode(image: str | bytes) -> list[str]:
77
77
  """
78
78
  Decoding QR code or bar code image.
79
79
 
@@ -108,14 +108,14 @@ def decode_qrcode(image: Union[str, bytes]) -> list[str]:
108
108
 
109
109
 
110
110
  def compress_image(
111
- input_image: Union[str, bytes],
112
- ouput_image: Optional[str] = None,
111
+ input_image: str | bytes,
112
+ ouput_image: str | None = None,
113
113
  target_size: float = 0.5,
114
114
  rate: int = 5,
115
115
  reduce: bool = False,
116
116
  max_quality: int = 75,
117
117
  min_quality: int = 0
118
- ) -> Optional[bytes]:
118
+ ) -> bytes | None:
119
119
  """
120
120
  Compress image file.
121
121
 
@@ -187,7 +187,7 @@ def compress_image(
187
187
  rfile(content)
188
188
 
189
189
 
190
- def to_pimage(image: Union[str, bytes]) -> RImage:
190
+ def to_pimage(image: str | bytes) -> RImage:
191
191
  """
192
192
  Get `Image` instance of `PIL` package.
193
193
 
@@ -215,8 +215,8 @@ def to_pimage(image: Union[str, bytes]) -> RImage:
215
215
 
216
216
 
217
217
  def generate_captcha_image(
218
- text: Optional[Union[int, str]] = None,
219
- path: Optional[str] = None,
218
+ text: int | str | None = None,
219
+ path: str | None = None,
220
220
  **kwargs: Any
221
221
  ) -> bytes:
222
222
  """
reykit/rlog.py CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
  from __future__ import annotations
13
- from typing import Any, Optional, Union, Literal, Final, NoReturn, overload, override
13
+ from typing import Any, Literal, Final, NoReturn, overload, override
14
14
  from collections.abc import Callable
15
15
  from queue import Queue
16
16
  from os.path import abspath as os_abspath
@@ -291,7 +291,7 @@ class RLog(object):
291
291
  def get_default_filter_method(
292
292
  self,
293
293
  format_: str,
294
- mode : Optional[Literal['print', 'file']] = None
294
+ mode : Literal['print', 'file'] | None = None
295
295
  ) -> Callable[[LogRecord], Literal[True]]:
296
296
  """
297
297
  Get default filter method of handler.
@@ -397,8 +397,8 @@ class RLog(object):
397
397
  def add_print(
398
398
  self,
399
399
  level: int = DEBUG,
400
- format_: Optional[str] = None,
401
- filter_: Optional[Callable[[LogRecord], bool]] = None
400
+ format_: str | None = None,
401
+ filter_: Callable[[LogRecord], bool] | None = None
402
402
  ) -> StreamHandler:
403
403
  """
404
404
  Add print output record handler.
@@ -443,56 +443,56 @@ class RLog(object):
443
443
  @overload
444
444
  def add_file(
445
445
  self,
446
- path: Optional[str] = None,
447
- mb: Optional[float] = None,
446
+ path: str | None = None,
447
+ mb: float | None = None,
448
448
  time: None = None,
449
449
  level: int = DEBUG,
450
- format_: Optional[str] = None,
451
- filter_: Optional[Callable[[LogRecord], bool]] = None
450
+ format_: str | None = None,
451
+ filter_: Callable[[LogRecord], bool] | None = None
452
452
  ) -> ConcurrentRotatingFileHandler: ...
453
453
 
454
454
  @overload
455
455
  def add_file(
456
456
  self,
457
- path: Optional[str] = None,
457
+ path: str | None = None,
458
458
  mb: None = None,
459
- time: Union[float, Literal['m', 'w0', 'w1', 'w2', 'w3', 'w4', 'w5', 'w6']] = None,
459
+ time: float | Literal['m', 'w0', 'w1', 'w2', 'w3', 'w4', 'w5', 'w6'] = None,
460
460
  level: int = DEBUG,
461
- format_: Optional[str] = None,
462
- filter_: Optional[Callable[[LogRecord], bool]] = None
461
+ format_: str | None = None,
462
+ filter_: Callable[[LogRecord], bool] | None = None
463
463
  ) -> ConcurrentTimedRotatingFileHandler: ...
464
464
 
465
465
  @overload
466
466
  def add_file(
467
467
  self,
468
- path: Optional[str] = None,
468
+ path: str | None = None,
469
469
  mb: None = None,
470
470
  time: Any = None,
471
471
  level: int = DEBUG,
472
- format_: Optional[str] = None,
473
- filter_: Optional[Callable[[LogRecord], bool]] = None
472
+ format_: str | None = None,
473
+ filter_: Callable[[LogRecord], bool] | None = None
474
474
  ) -> NoReturn: ...
475
475
 
476
476
  @overload
477
477
  def add_file(
478
478
  self,
479
- path: Optional[str] = None,
479
+ path: str | None = None,
480
480
  mb: float = None,
481
- time: Union[float, Literal['m', 'w0', 'w1', 'w2', 'w3', 'w4', 'w5', 'w6']] = None,
481
+ time: float | Literal['m', 'w0', 'w1', 'w2', 'w3', 'w4', 'w5', 'w6'] = None,
482
482
  level: int = DEBUG,
483
- format_: Optional[str] = None,
484
- filter_: Optional[Callable[[LogRecord], bool]] = None
483
+ format_: str | None = None,
484
+ filter_: Callable[[LogRecord], bool] | None = None
485
485
  ) -> NoReturn: ...
486
486
 
487
487
  def add_file(
488
488
  self,
489
- path: Optional[str] = None,
490
- mb: Optional[float] = None,
491
- time: Optional[Union[float, Literal['m', 'w0', 'w1', 'w2', 'w3', 'w4', 'w5', 'w6']]] = None,
489
+ path: str | None = None,
490
+ mb: float | None = None,
491
+ time: float | Literal['m', 'w0', 'w1', 'w2', 'w3', 'w4', 'w5', 'w6'] | None = None,
492
492
  level: int = DEBUG,
493
- format_: Optional[str] = None,
494
- filter_: Optional[Callable[[LogRecord], bool]] = None
495
- ) -> Union[ConcurrentRotatingFileHandler, ConcurrentTimedRotatingFileHandler]:
493
+ format_: str | None = None,
494
+ filter_: Callable[[LogRecord], bool] | None = None
495
+ ) -> ConcurrentRotatingFileHandler | ConcurrentTimedRotatingFileHandler:
496
496
  """
497
497
  Add file output record handler, can split files based on size or time.
498
498
 
@@ -613,9 +613,9 @@ class RLog(object):
613
613
 
614
614
  def add_queue(
615
615
  self,
616
- queue: Optional[Queue] = None,
616
+ queue: Queue | None = None,
617
617
  level: int = DEBUG,
618
- filter_: Optional[Callable[[LogRecord], bool]] = None
618
+ filter_: Callable[[LogRecord], bool] | None = None
619
619
  ) -> tuple[QueueHandler, Queue[LogRecord]]:
620
620
  """
621
621
  Add queue output record handler.
@@ -655,7 +655,7 @@ class RLog(object):
655
655
  self,
656
656
  method: Callable[[LogRecord], Any],
657
657
  level: int = DEBUG,
658
- filter_: Optional[Callable[[LogRecord], bool]] = None
658
+ filter_: Callable[[LogRecord], bool] | None = None
659
659
  ) -> None:
660
660
  """
661
661
  Add method record handler.
@@ -771,7 +771,7 @@ class RLog(object):
771
771
  def log(
772
772
  self,
773
773
  *messages: Any,
774
- level: Optional[int] = None,
774
+ level: int | None = None,
775
775
  catch: bool = True,
776
776
  **params: Any
777
777
  ) -> None:
@@ -970,7 +970,7 @@ class RRecord(object):
970
970
 
971
971
  def __init__(
972
972
  self,
973
- path: Optional[str] = '_rrecord'
973
+ path: str | None = '_rrecord'
974
974
  ) -> None:
975
975
  """
976
976
  Build `record` attributes.
reykit/rmonkey.py CHANGED
@@ -29,7 +29,6 @@ def monkey_patch_sqlalchemy_result_more_fetch():
29
29
  """
30
30
 
31
31
 
32
- from typing import Optional
33
32
  from sqlalchemy.engine.cursor import CursorResult
34
33
  from pandas import DataFrame, NA, concat
35
34
 
@@ -81,7 +80,7 @@ def monkey_patch_sqlalchemy_result_more_fetch():
81
80
 
82
81
 
83
82
  # Print result.
84
- def method_show(self: RResult, limit: Optional[int] = None) -> None:
83
+ def method_show(self: RResult, limit: int | None = None) -> None:
85
84
  """
86
85
  Print result.
87
86
 
@@ -207,18 +206,18 @@ def monkey_patch_sqlalchemy_row_index_field():
207
206
  """
208
207
 
209
208
 
210
- from typing import Any, Union, overload
209
+ from typing import Any, overload
211
210
  from sqlalchemy.engine.row import Row
212
211
 
213
212
 
214
213
  # Define.
215
214
  @overload
216
- def __getitem__(self, index: Union[str, int]) -> Any: ...
215
+ def __getitem__(self, index: str | int) -> Any: ...
217
216
 
218
217
  @overload
219
218
  def __getitem__(self, index: slice) -> tuple: ...
220
219
 
221
- def __getitem__(self, index: Union[str, int, slice]) -> Union[Any, tuple]:
220
+ def __getitem__(self, index: str | int | slice) -> Any | tuple:
222
221
  """
223
222
  Index row value.
224
223