reykit 1.1.25__py3-none-any.whl → 1.1.27__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/rtable.py CHANGED
@@ -15,7 +15,7 @@ from os.path import abspath as os_abspath
15
15
  from pandas import DataFrame, ExcelWriter, isnull
16
16
  from sqlalchemy.engine.cursor import CursorResult
17
17
 
18
- from .ros import RFile
18
+ from .ros import File
19
19
  from .rtext import to_json, to_text
20
20
  from .rtime import time_to
21
21
 
@@ -96,15 +96,15 @@ def to_table(
96
96
  @overload
97
97
  def to_dict(
98
98
  data: Table | Iterable[Iterable],
99
- key_field: int | str = 0,
100
- val_field: None = None
99
+ key_field: int | str = 0
101
100
  ) -> dict[Any, dict]: ...
102
101
 
103
102
  @overload
104
103
  def to_dict(
105
104
  data: Table | Iterable[Iterable],
106
105
  key_field: int | str = 0,
107
- val_field: int | str = None
106
+ *,
107
+ val_field: int | str
108
108
  ) -> dict: ...
109
109
 
110
110
  def to_dict(
@@ -416,7 +416,7 @@ def to_csv(
416
416
 
417
417
  # Handle parameter.
418
418
  data_df = to_df(data, fields)
419
- rfile = RFile(path)
419
+ rfile = File(path)
420
420
  if rfile:
421
421
  header = False
422
422
  else:
reykit/rtask.py CHANGED
@@ -30,25 +30,24 @@ from asyncio import (
30
30
  )
31
31
  from aiohttp import ClientSession, ClientResponse
32
32
 
33
- from .rexc import throw, check_most_one, check_response_code
34
- from .rtime import randn, RTimeMark
35
- from .rtype import T, RBase
33
+ from .rbase import T, Base, throw, check_most_one, check_response_code
34
+ from .rtime import randn, TimeMark
36
35
  from .rwrap import wrap_thread
37
36
 
38
37
 
39
38
  __all__ = (
40
- 'RThreadPool',
39
+ 'ThreadPool',
41
40
  'async_run',
42
41
  'async_sleep',
43
42
  'async_wait',
44
43
  'async_request',
45
- 'RAsyncPool'
44
+ 'AsyncPool'
46
45
  )
47
46
 
48
47
 
49
- class RThreadPool(RBase):
48
+ class ThreadPool(Base):
50
49
  """
51
- Rey's `thread pool` type.
50
+ Thread pool type.
52
51
 
53
52
  Attributes
54
53
  ----------
@@ -68,7 +67,7 @@ class RThreadPool(RBase):
68
67
  **kwargs: Any
69
68
  ) -> None:
70
69
  """
71
- Build `thread pool` instance attributes.
70
+ Build instance attributes.
72
71
 
73
72
  Parameters
74
73
  ----------
@@ -157,7 +156,7 @@ class RThreadPool(RBase):
157
156
  >>> b = (3, 4, 5)
158
157
  >>> c = (11, 12)
159
158
  >>> d = (13, 14, 15)
160
- >>> thread_pool = RThreadPool(func, 0, z=0)
159
+ >>> thread_pool = ThreadPool(func, 0, z=0)
161
160
  >>> thread_pool.batch(a, b, c=c, d=d)
162
161
  (0, 1, 3) {'z': 0, 'c': 11, 'd': 13}
163
162
  (0, 2, 4) {'z': 0, 'c': 12, 'd': 14}
@@ -371,48 +370,24 @@ def async_run(
371
370
 
372
371
 
373
372
  @overload
374
- async def async_sleep(
375
- *,
376
- precision: None = None
377
- ) -> int: ...
373
+ async def async_sleep() -> int: ...
378
374
 
379
375
  @overload
380
- async def async_sleep(
381
- second: int,
382
- *,
383
- precision: None = None
384
- ) -> int: ...
376
+ async def async_sleep(second: int) -> int: ...
385
377
 
386
378
  @overload
387
- async def async_sleep(
388
- low: int = 0,
389
- high: int = 10,
390
- *,
391
- precision: None = None
392
- ) -> int: ...
379
+ async def async_sleep(low: int = 0, high: int = 10) -> int: ...
393
380
 
394
381
  @overload
395
- async def async_sleep(
396
- *thresholds: float,
397
- precision: None = None
398
- ) -> float: ...
382
+ async def async_sleep(*thresholds: float) -> float: ...
399
383
 
400
384
  @overload
401
- async def async_sleep(
402
- *thresholds: float,
403
- precision: Literal[0] = None
404
- ) -> int: ...
385
+ async def async_sleep(*thresholds: float, precision: Literal[0]) -> int: ...
405
386
 
406
387
  @overload
407
- async def async_sleep(
408
- *thresholds: float,
409
- precision: int = None
410
- ) -> float: ...
411
-
412
- async def async_sleep(
413
- *thresholds: float,
414
- precision: int | None = None
415
- ) -> float:
388
+ async def async_sleep(*thresholds: float, precision: int) -> float: ...
389
+
390
+ async def async_sleep(*thresholds: float, precision: int | None = None) -> float:
416
391
  """
417
392
  Sleep random seconds, in the coroutine.
418
393
 
@@ -474,7 +449,7 @@ async def async_wait(
474
449
  """
475
450
 
476
451
  # Set parameter.
477
- rtm = RTimeMark()
452
+ rtm = TimeMark()
478
453
  rtm()
479
454
 
480
455
  # Not set timeout.
@@ -669,9 +644,9 @@ async def async_request(
669
644
  return result
670
645
 
671
646
 
672
- class RAsyncPool(RBase):
647
+ class AsyncPool(Base):
673
648
  """
674
- Rey's `asynchronous pool` type.
649
+ Asynchronous pool type.
675
650
 
676
651
  Attributes
677
652
  ----------
@@ -690,7 +665,7 @@ class RAsyncPool(RBase):
690
665
  **kwargs: Any
691
666
  ) -> None:
692
667
  """
693
- Build `asynchronous pool` instance attributes.
668
+ Build instance attributes.
694
669
 
695
670
  Parameters
696
671
  ----------
@@ -779,7 +754,7 @@ class RAsyncPool(RBase):
779
754
  >>> b = (3, 4, 5)
780
755
  >>> c = (11, 12)
781
756
  >>> d = (13, 14, 15)
782
- >>> async_pool = RAsyncPool(func, 0, z=0)
757
+ >>> async_pool = AsyncPool(func, 0, z=0)
783
758
  >>> async_pool.batch(a, b, c=c, d=d)
784
759
  (0, 1, 3) {'z': 0, 'c': 11, 'd': 13}
785
760
  (0, 2, 4) {'z': 0, 'c': 12, 'd': 14}
reykit/rtext.py CHANGED
@@ -15,9 +15,8 @@ from decimal import Decimal
15
15
  from pprint import pformat as pprint_pformat
16
16
  from json import dumps as json_dumps
17
17
 
18
- from .rexc import throw
18
+ from .rbase import throw
19
19
  from .rmonkey import monkey_patch_pprint_modify_width_judgment
20
- from .rrand import randi
21
20
 
22
21
 
23
22
  __all__ = (
reykit/rtime.py CHANGED
@@ -9,7 +9,7 @@
9
9
  """
10
10
 
11
11
 
12
- from typing import Any, TypedDict, Literal, overload
12
+ from typing import Any, TypedDict, Literal, NoReturn, overload
13
13
  from collections.abc import Callable
14
14
  from time import (
15
15
  struct_time as StructTime,
@@ -29,12 +29,11 @@ from pandas import (
29
29
  Timedelta as PTimedelta
30
30
  )
31
31
 
32
- from .rexc import throw
33
- from .rnum import digits, to_number
32
+ from .rbase import T, Base, throw
33
+ from .rnum import digits
34
34
  from .rrand import randn
35
35
  from .rre import search
36
36
  from .rstdout import echo
37
- from .rtype import T
38
37
 
39
38
 
40
39
  __all__ = (
@@ -44,7 +43,7 @@ __all__ = (
44
43
  'to_time',
45
44
  'sleep',
46
45
  'wait',
47
- 'RTimeMark'
46
+ 'TimeMark'
48
47
  )
49
48
 
50
49
 
@@ -55,16 +54,16 @@ RecordData = TypedDict('RecordData', {'timestamp': int, 'datetime': Datetime, 't
55
54
  def now(format_: Literal['datetime'] = 'datetime') -> Datetime: ...
56
55
 
57
56
  @overload
58
- def now(format_: Literal['date'] = 'datetime') -> Date: ...
57
+ def now(format_: Literal['date']) -> Date: ...
59
58
 
60
59
  @overload
61
- def now(format_: Literal['time'] = 'datetime') -> Time: ...
60
+ def now(format_: Literal['time']) -> Time: ...
62
61
 
63
62
  @overload
64
- def now(format_: Literal['datetime_str', 'date_str', 'time_str'] = 'datetime') -> str: ...
63
+ def now(format_: Literal['datetime_str', 'date_str', 'time_str']) -> str: ...
65
64
 
66
65
  @overload
67
- def now(format_: Literal['timestamp'] = 'datetime') -> int: ...
66
+ def now(format_: Literal['timestamp']) -> int: ...
68
67
 
69
68
  def now(
70
69
  format_: Literal[
@@ -125,9 +124,16 @@ def time_to(
125
124
 
126
125
  @overload
127
126
  def time_to(
128
- obj: T,
127
+ obj: Any,
129
128
  decimal: bool = False,
130
- raising: Literal[False] = True
129
+ raising: Literal[True] = True
130
+ ) -> NoReturn: ...
131
+
132
+ @overload
133
+ def time_to(
134
+ obj: T,
135
+ *,
136
+ raising: Literal[False]
131
137
  ) -> T: ...
132
138
 
133
139
  def time_to(
@@ -301,22 +307,16 @@ def text_to_time(
301
307
 
302
308
 
303
309
  @overload
304
- def to_time(
305
- obj: str,
306
- raising: bool = True
307
- ) -> Datetime | Date | Time: ...
310
+ def to_time(obj: str, raising: bool = True) -> Datetime | Date | Time: ...
308
311
 
309
312
  @overload
310
- def to_time(
311
- obj: StructTime | float,
312
- raising: bool = True
313
- ) -> Datetime: ...
313
+ def to_time(obj: StructTime | float, raising: bool = True) -> Datetime: ...
314
314
 
315
315
  @overload
316
- def to_time(
317
- obj: T,
318
- raising: Literal[False] = True
319
- ) -> T: ...
316
+ def to_time(obj: Any, raising: Literal[True] = True) -> NoReturn: ...
317
+
318
+ @overload
319
+ def to_time(obj: T, raising: Literal[False]) -> T: ...
320
320
 
321
321
  def to_time(
322
322
  obj: Any,
@@ -379,43 +379,22 @@ def to_time(
379
379
 
380
380
 
381
381
  @overload
382
- def sleep(
383
- *,
384
- precision: None = None
385
- ) -> int: ...
382
+ def sleep() -> int: ...
386
383
 
387
384
  @overload
388
- def sleep(
389
- second: int,
390
- *,
391
- precision: None = None
392
- ) -> int: ...
385
+ def sleep(second: int) -> int: ...
393
386
 
394
387
  @overload
395
- def sleep(
396
- low: int = 0,
397
- high: int = 10,
398
- *,
399
- precision: None = None
400
- ) -> int: ...
388
+ def sleep(low: int = 0, high: int = 10) -> int: ...
401
389
 
402
390
  @overload
403
- def sleep(
404
- *thresholds: float,
405
- precision: None = None
406
- ) -> float: ...
391
+ def sleep(*thresholds: float) -> float: ...
407
392
 
408
393
  @overload
409
- def sleep(
410
- *thresholds: float,
411
- precision: Literal[0] = None
412
- ) -> int: ...
394
+ def sleep(*thresholds: float, precision: Literal[0]) -> int: ...
413
395
 
414
396
  @overload
415
- def sleep(
416
- *thresholds: float,
417
- precision: int = None
418
- ) -> float: ...
397
+ def sleep(*thresholds: float, precision: int) -> float: ...
419
398
 
420
399
  def sleep(
421
400
  *thresholds: float,
@@ -482,7 +461,7 @@ def wait(
482
461
  """
483
462
 
484
463
  # Set parameter.
485
- rtm = RTimeMark()
464
+ rtm = TimeMark()
486
465
  rtm()
487
466
 
488
467
  # Not set timeout.
@@ -520,15 +499,15 @@ def wait(
520
499
  return rtm.total_spend
521
500
 
522
501
 
523
- class RTimeMark():
502
+ class TimeMark(Base):
524
503
  """
525
- Rey`s `time mark` type.
504
+ Time mark type.
526
505
  """
527
506
 
528
507
 
529
508
  def __init__(self) -> None:
530
509
  """
531
- Build `time mark` instance attributes.
510
+ Build instance attributes.
532
511
  """
533
512
 
534
513
  # Record table.
reykit/rwrap.py CHANGED
@@ -18,10 +18,9 @@ from threading import Thread
18
18
  from argparse import ArgumentParser
19
19
  from contextlib import redirect_stdout
20
20
 
21
- from .rexc import catch_exc
21
+ from .rbase import catch_exc, get_arg_info
22
22
  from .rstdout import echo
23
- from .rsys import get_arg_info
24
- from .rtime import now, time_to, RTimeMark
23
+ from .rtime import now, time_to, TimeMark
25
24
 
26
25
 
27
26
  __all__ = (
@@ -78,13 +77,13 @@ def wrap_frame(decorator: Callable) -> Callable:
78
77
 
79
78
  # Decorate Decorator.
80
79
  @overload
81
- def wrap(func: Callable, /, *args: Any, _execute: None = None, **kwargs: Any) -> Callable | Any: ...
80
+ def wrap(func: Callable, /, *args: Any, **kwargs: Any) -> Callable | Any: ...
82
81
 
83
82
  @overload
84
- def wrap(func: Callable, /, *args: Any, _execute: Literal[True] = None, **kwargs: Any) -> Any: ...
83
+ def wrap(func: Callable, /, *args: Any, _execute: Literal[True], **kwargs: Any) -> Any: ...
85
84
 
86
85
  @overload
87
- def wrap(func: Callable, /, *args: Any, _execute: Literal[False] = None, **kwargs: Any) -> Callable: ...
86
+ def wrap(func: Callable, /, *args: Any, _execute: Literal[False], **kwargs: Any) -> Callable: ...
88
87
 
89
88
  @functools_wraps(decorator)
90
89
  def wrap(func: Callable, /, *args: Any, _execute: bool | None = None, **kwargs: Any) -> Callable | Any:
@@ -160,7 +159,7 @@ def wrap_runtime(
160
159
  func: Callable,
161
160
  /,
162
161
  *args: Any,
163
- _return_report: Literal[True] = False,
162
+ _return_report: Literal[True],
164
163
  **kwargs: Any
165
164
  ) -> tuple[Any, str]: ...
166
165
 
@@ -188,7 +187,7 @@ def wrap_runtime(
188
187
  """
189
188
 
190
189
  # Execute function and marking time.
191
- rtm = RTimeMark()
190
+ rtm = TimeMark()
192
191
  rtm()
193
192
  result = func(*args, **kwargs)
194
193
  rtm()
reykit/rzip.py CHANGED
@@ -13,7 +13,7 @@ from zipfile import ZipFile, is_zipfile, ZIP_DEFLATED
13
13
  from os import getcwd as os_getcwd, walk as os_walk
14
14
  from os.path import join as os_join, isfile as os_isfile
15
15
 
16
- from .ros import RFile, RFolder
16
+ from .ros import File, Folder
17
17
 
18
18
 
19
19
  __all__ = (
@@ -41,17 +41,17 @@ def compress(
41
41
  """
42
42
 
43
43
  # Get parameter.
44
- build_dir = RFolder(build_dir).path
44
+ build_dir = Folder(build_dir).path
45
45
  if overwrite:
46
46
  mode = 'w'
47
47
  else:
48
48
  mode = 'x'
49
49
  is_file = os_isfile(obj_path)
50
50
  if is_file:
51
- rfile = RFile(obj_path)
51
+ rfile = File(obj_path)
52
52
  obj_name = rfile.name_suffix
53
53
  else:
54
- rfolder = RFolder(obj_path)
54
+ rfolder = Folder(obj_path)
55
55
  obj_name = rfolder.name
56
56
  build_name = obj_name + '.zip'
57
57
  build_path = os_join(build_dir, build_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reykit
3
- Version: 1.1.25
3
+ Version: 1.1.27
4
4
  Summary: Rey's kit method set.
5
5
  Project-URL: homepage, https://github.com/reyxbo/reykit/
6
6
  Author-email: Rey <reyxbo@163.com>
@@ -0,0 +1,28 @@
1
+ reykit/__init__.py,sha256=44RqZ6dwYgFMsfZUNDuR9PmP0H-16lwHaryldJqXu8I,794
2
+ reykit/rall.py,sha256=7Hip02YOkIDm3_xkoSDjvvYV2LhdBV2r4UKzWWnIfIo,628
3
+ reykit/rbase.py,sha256=npUa3FMfcFF422fZDElFoZrjDESFgW9mzZrNbuWZu-w,22512
4
+ reykit/rdata.py,sha256=RDrDWcNLIVEznNqT27155eLqdQLsp9rp6gxYbopI5yg,10138
5
+ reykit/remail.py,sha256=s7TXbLgEWEqNoeM42c6FpPufB2LajHgQuahfZri3urQ,6706
6
+ reykit/rimage.py,sha256=p7caatLE71yy7GUTkTKyMOaJTeBfl6pZr_7BFjcDvY8,6159
7
+ reykit/rlog.py,sha256=JgxLeMEl2UBwZG5IiGr-Cr_NPfkkkc2Yebb6tgH1zLQ,25525
8
+ reykit/rmonkey.py,sha256=ZTHsXI3T81WE0rlfVUhf6N5SYoxPbsgVImAasFJqnKU,8315
9
+ reykit/rnet.py,sha256=uS27Ownt9ELsjVKpGMPVN1Endc9s7z7CfIBkfE8bPMs,15033
10
+ reykit/rnum.py,sha256=PhG4V_BkVfCJUsbpMDN1umGZly1Hsus80TW8bpyBtyY,3653
11
+ reykit/ros.py,sha256=GZBhU_Ni1W5EqjLoS0mYWUk5-I7lmhg6b4sv3WvkDoA,40855
12
+ reykit/rrand.py,sha256=9QPXCsREIu45g6WP-XN67X05kmW3cTmctn3InvqYxuY,8947
13
+ reykit/rre.py,sha256=4DVxy28dl5zn6_II8-cgr7E2nVPH5QJIJVB4o7Vsf1A,6078
14
+ reykit/rschedule.py,sha256=_nrfrXYxlFAKCDbM8ibTTb60zNDlHxyE310cv-A19Kw,5799
15
+ reykit/rstdout.py,sha256=U9so0RGyiJrv1lhCA392XbzxIOnT4XZUrWQ_kuPjlAk,9840
16
+ reykit/rsys.py,sha256=-1MYplwvp9HOrTiNU6eS1FW8vCnpt-iXbYxhR0yPQCE,24894
17
+ reykit/rtable.py,sha256=MYEkm-PvYyNgCy1cHodNF4JgJNg1pzTy6NtYfF6CHRs,12001
18
+ reykit/rtask.py,sha256=FPRBKVIzuH5PUR9XyY3J9YF8rXDpIMWySXLc3y6zAwk,22812
19
+ reykit/rtext.py,sha256=l8yRxaWmDxdPLkXfQufUGjXSRMbmKfbYkkiihtvNixQ,11048
20
+ reykit/rtime.py,sha256=e9I5LieY3DFQq04qzyRT_dwsxc40Dcj9CMDAEmXsGw8,16938
21
+ reykit/rwrap.py,sha256=RK3wlc2cd-lnAvzqzvKsS21EtCmBNTA3i8HRbaolWE4,15275
22
+ reykit/rzip.py,sha256=ABUDLwEHQIpcvZbJE_oV78H7dik6nC7kaRz660Ro9Os,3481
23
+ reykit/rdll/__init__.py,sha256=tdKb-BOKLFn-diCvXjSLg9x71VuRKzkg2KtpOLGLTR4,679
24
+ reykit/rdll/rdll_core.py,sha256=o6-rKcTQgxZQe0kD3GnwyNb3KL9IogzgCQNOmYLMm7A,5086
25
+ reykit-1.1.27.dist-info/METADATA,sha256=wBa8m_cgiEUJryN6Hhpjn3RS3x1yQ0aERUkRyTUQkR0,1919
26
+ reykit-1.1.27.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
+ reykit-1.1.27.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
28
+ reykit-1.1.27.dist-info/RECORD,,