reykit 1.1.6__py3-none-any.whl → 1.1.8__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/rdata.py +5 -5
- reykit/rsystem.py +2 -2
- reykit/rtime.py +48 -61
- reykit/rtype.py +2 -2
- {reykit-1.1.6.dist-info → reykit-1.1.8.dist-info}/METADATA +1 -1
- {reykit-1.1.6.dist-info → reykit-1.1.8.dist-info}/RECORD +8 -8
- {reykit-1.1.6.dist-info → reykit-1.1.8.dist-info}/WHEEL +0 -0
- {reykit-1.1.6.dist-info → reykit-1.1.8.dist-info}/licenses/LICENSE +0 -0
reykit/rdata.py
CHANGED
@@ -14,7 +14,7 @@ from collections.abc import Callable, Iterable, Generator
|
|
14
14
|
|
15
15
|
from .rexception import check_least_one, check_most_one
|
16
16
|
from .rsystem import is_iterable
|
17
|
-
from .rtype import
|
17
|
+
from .rtype import T
|
18
18
|
|
19
19
|
|
20
20
|
__all__ = (
|
@@ -130,12 +130,12 @@ def flatten(data: Any, *, _flattern_data: list | None = None) -> list:
|
|
130
130
|
|
131
131
|
|
132
132
|
@overload
|
133
|
-
def split(data: Iterable[
|
133
|
+
def split(data: Iterable[T], share: int = None, bin_size: None = None) -> list[list[T]]: ...
|
134
134
|
|
135
135
|
@overload
|
136
|
-
def split(data: Iterable[
|
136
|
+
def split(data: Iterable[T], share: None = None, bin_size: int = None) -> list[list[T]]: ...
|
137
137
|
|
138
|
-
def split(data: Iterable[
|
138
|
+
def split(data: Iterable[T], share: int | None = None, bin_size: int | None = None) -> list[list[T]]:
|
139
139
|
"""
|
140
140
|
Split data into multiple data.
|
141
141
|
|
@@ -183,7 +183,7 @@ def split(data: Iterable[AnyValue], share: int | None = None, bin_size: int | No
|
|
183
183
|
return _data
|
184
184
|
|
185
185
|
|
186
|
-
def unique(data: Iterable[
|
186
|
+
def unique(data: Iterable[T]) -> list[T]:
|
187
187
|
"""
|
188
188
|
De duplication of data.
|
189
189
|
|
reykit/rsystem.py
CHANGED
@@ -209,10 +209,10 @@ def del_modules(path: str) -> list[str]:
|
|
209
209
|
|
210
210
|
|
211
211
|
@overload
|
212
|
-
def dos_command(command: str | Iterable[str], read: False = False) -> None: ...
|
212
|
+
def dos_command(command: str | Iterable[str], read: Literal[False] = False) -> None: ...
|
213
213
|
|
214
214
|
@overload
|
215
|
-
def dos_command(command: str | Iterable[str], read: True = False) -> str: ...
|
215
|
+
def dos_command(command: str | Iterable[str], read: Literal[True] = False) -> str: ...
|
216
216
|
|
217
217
|
def dos_command(command: str | Iterable[str], read: bool = False) -> str | None:
|
218
218
|
"""
|
reykit/rtime.py
CHANGED
@@ -9,24 +9,24 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any, TypedDict, Literal, overload
|
12
|
+
from typing import Any, TypedDict, Literal, overload
|
13
13
|
from collections.abc import Callable
|
14
|
-
from pandas import (
|
15
|
-
DataFrame,
|
16
|
-
Timestamp as pd_timestamp,
|
17
|
-
Timedelta as pd_timedelta
|
18
|
-
)
|
19
14
|
from time import (
|
20
|
-
struct_time as
|
15
|
+
struct_time as StructTime,
|
21
16
|
strftime as time_strftime,
|
22
17
|
time as time_time,
|
23
18
|
sleep as time_sleep
|
24
19
|
)
|
25
20
|
from datetime import (
|
26
|
-
datetime as
|
27
|
-
date as
|
28
|
-
time as
|
29
|
-
timedelta as
|
21
|
+
datetime as Datetime,
|
22
|
+
date as Date,
|
23
|
+
time as Time,
|
24
|
+
timedelta as Timedelta
|
25
|
+
)
|
26
|
+
from pandas import (
|
27
|
+
DataFrame,
|
28
|
+
Timestamp as PTimestamp,
|
29
|
+
Timedelta as PTimedelta
|
30
30
|
)
|
31
31
|
|
32
32
|
from .rexception import throw
|
@@ -34,7 +34,7 @@ from .rnumber import digits
|
|
34
34
|
from .rrandom import randn
|
35
35
|
from .rregex import search
|
36
36
|
from .rstdout import echo
|
37
|
-
from .rtype import
|
37
|
+
from .rtype import T
|
38
38
|
|
39
39
|
|
40
40
|
__all__ = (
|
@@ -48,17 +48,17 @@ __all__ = (
|
|
48
48
|
)
|
49
49
|
|
50
50
|
|
51
|
-
RecordData = TypedDict('RecordData', {'timestamp': int, 'datetime':
|
51
|
+
RecordData = TypedDict('RecordData', {'timestamp': int, 'datetime': Datetime, 'timedelta': Timedelta | None, 'note': str | None})
|
52
52
|
|
53
53
|
|
54
54
|
@overload
|
55
|
-
def now(format_: Literal['datetime'] = 'datetime') ->
|
55
|
+
def now(format_: Literal['datetime'] = 'datetime') -> Datetime: ...
|
56
56
|
|
57
57
|
@overload
|
58
|
-
def now(format_: Literal['date'] = 'datetime') ->
|
58
|
+
def now(format_: Literal['date'] = 'datetime') -> Date: ...
|
59
59
|
|
60
60
|
@overload
|
61
|
-
def now(format_: Literal['time'] = 'datetime') ->
|
61
|
+
def now(format_: Literal['time'] = 'datetime') -> Time: ...
|
62
62
|
|
63
63
|
@overload
|
64
64
|
def now(format_: Literal['datetime_str', 'date_str', 'time_str'] = 'datetime') -> str: ...
|
@@ -76,7 +76,7 @@ def now(
|
|
76
76
|
'time_str',
|
77
77
|
'timestamp'
|
78
78
|
] = 'datetime'
|
79
|
-
) ->
|
79
|
+
) -> Datetime | Date | Time | str | int:
|
80
80
|
"""
|
81
81
|
Get the now time.
|
82
82
|
|
@@ -99,17 +99,17 @@ def now(
|
|
99
99
|
# Return.
|
100
100
|
match format_:
|
101
101
|
case 'datetime':
|
102
|
-
return
|
102
|
+
return Datetime.now()
|
103
103
|
case 'date':
|
104
|
-
return
|
104
|
+
return Datetime.now().date()
|
105
105
|
case 'time':
|
106
|
-
return
|
106
|
+
return Datetime.now().time()
|
107
107
|
case 'datetime_str':
|
108
|
-
return
|
108
|
+
return Datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
109
109
|
case 'date_str':
|
110
|
-
return
|
110
|
+
return Datetime.now().strftime('%Y-%m-%d')
|
111
111
|
case 'time_str':
|
112
|
-
return
|
112
|
+
return Datetime.now().strftime('%H:%M:%S')
|
113
113
|
case 'timestamp':
|
114
114
|
return int(time_time() * 1000)
|
115
115
|
case _:
|
@@ -118,24 +118,17 @@ def now(
|
|
118
118
|
|
119
119
|
@overload
|
120
120
|
def time_to(
|
121
|
-
obj:
|
121
|
+
obj: Datetime | Date | Time | Timedelta | StructTime | PTimestamp | PTimedelta,
|
122
122
|
decimal: bool = False,
|
123
123
|
raising: bool = True
|
124
124
|
) -> str: ...
|
125
125
|
|
126
126
|
@overload
|
127
127
|
def time_to(
|
128
|
-
obj:
|
129
|
-
decimal: bool = False,
|
130
|
-
raising: Literal[True] = True
|
131
|
-
) -> NoReturn: ...
|
132
|
-
|
133
|
-
@overload
|
134
|
-
def time_to(
|
135
|
-
obj: AnyValue,
|
128
|
+
obj: T,
|
136
129
|
decimal: bool = False,
|
137
130
|
raising: Literal[False] = True
|
138
|
-
) ->
|
131
|
+
) -> T: ...
|
139
132
|
|
140
133
|
def time_to(
|
141
134
|
obj: Any,
|
@@ -163,7 +156,7 @@ def time_to(
|
|
163
156
|
match obj:
|
164
157
|
|
165
158
|
# Type 'datetime'.
|
166
|
-
case
|
159
|
+
case Datetime() | PTimestamp():
|
167
160
|
if decimal:
|
168
161
|
format_ = '%Y-%m-%d %H:%M:%S.%f'
|
169
162
|
else:
|
@@ -171,11 +164,11 @@ def time_to(
|
|
171
164
|
text = obj.strftime(format_)
|
172
165
|
|
173
166
|
# Type 'date'.
|
174
|
-
case
|
167
|
+
case Date():
|
175
168
|
text = obj.strftime('%Y-%m-%d')
|
176
169
|
|
177
170
|
# Type 'time'.
|
178
|
-
case
|
171
|
+
case Time():
|
179
172
|
if decimal:
|
180
173
|
format_ = '%H:%M:%S.%f'
|
181
174
|
else:
|
@@ -183,11 +176,11 @@ def time_to(
|
|
183
176
|
text = obj.strftime(format_)
|
184
177
|
|
185
178
|
# Type 'timedelta'.
|
186
|
-
case
|
179
|
+
case Timedelta() | PTimedelta():
|
187
180
|
timestamp = obj.seconds + obj.microseconds / 1000_000
|
188
181
|
if timestamp >= 0:
|
189
182
|
timestamp += 57600
|
190
|
-
time =
|
183
|
+
time = Datetime.fromtimestamp(timestamp).time()
|
191
184
|
if decimal:
|
192
185
|
format_ = '%H:%M:%S.%f'
|
193
186
|
else:
|
@@ -205,7 +198,7 @@ def time_to(
|
|
205
198
|
return obj
|
206
199
|
|
207
200
|
# Type 'struct_time'.
|
208
|
-
case
|
201
|
+
case StructTime():
|
209
202
|
if decimal:
|
210
203
|
format_ = '%Y-%m-%d %H:%M:%S.%f'
|
211
204
|
else:
|
@@ -225,7 +218,7 @@ def time_to(
|
|
225
218
|
|
226
219
|
def text_to_time(
|
227
220
|
string: str
|
228
|
-
) ->
|
221
|
+
) -> Datetime | Date | Time | None:
|
229
222
|
"""
|
230
223
|
Convert text to time object.
|
231
224
|
|
@@ -247,21 +240,21 @@ def text_to_time(
|
|
247
240
|
## Standard.
|
248
241
|
if 14 <= str_len <= 19:
|
249
242
|
try:
|
250
|
-
time_obj =
|
243
|
+
time_obj = Datetime.strptime(string, '%Y-%m-%d %H:%M:%S')
|
251
244
|
except ValueError:
|
252
245
|
pass
|
253
246
|
else:
|
254
247
|
return time_obj
|
255
248
|
if 8 <= str_len <= 10:
|
256
249
|
try:
|
257
|
-
time_obj =
|
250
|
+
time_obj = Datetime.strptime(string, '%Y-%m-%d').date()
|
258
251
|
except ValueError:
|
259
252
|
pass
|
260
253
|
else:
|
261
254
|
return time_obj
|
262
255
|
if 5 <= str_len <= 8:
|
263
256
|
try:
|
264
|
-
time_obj =
|
257
|
+
time_obj = Datetime.strptime(string, '%H:%M:%S').time()
|
265
258
|
except ValueError:
|
266
259
|
pass
|
267
260
|
else:
|
@@ -278,7 +271,7 @@ def text_to_time(
|
|
278
271
|
int(value)
|
279
272
|
for value in result
|
280
273
|
]
|
281
|
-
time_obj =
|
274
|
+
time_obj = Datetime(year, month, day, hour, minute, second)
|
282
275
|
return time_obj
|
283
276
|
|
284
277
|
### Type 'date'.
|
@@ -290,7 +283,7 @@ def text_to_time(
|
|
290
283
|
int(value)
|
291
284
|
for value in result
|
292
285
|
]
|
293
|
-
time_obj =
|
286
|
+
time_obj = Date(year, month, day)
|
294
287
|
return time_obj
|
295
288
|
|
296
289
|
### Type 'time'.
|
@@ -302,7 +295,7 @@ def text_to_time(
|
|
302
295
|
int(value)
|
303
296
|
for value in result
|
304
297
|
]
|
305
|
-
time_obj =
|
298
|
+
time_obj = Time(hour, minute, second)
|
306
299
|
return time_obj
|
307
300
|
|
308
301
|
|
@@ -310,25 +303,19 @@ def text_to_time(
|
|
310
303
|
def to_time(
|
311
304
|
obj: str,
|
312
305
|
raising: bool = True
|
313
|
-
) ->
|
306
|
+
) -> Datetime | Date | Time: ...
|
314
307
|
|
315
308
|
@overload
|
316
309
|
def to_time(
|
317
|
-
obj:
|
310
|
+
obj: StructTime | float,
|
318
311
|
raising: bool = True
|
319
|
-
) ->
|
320
|
-
|
321
|
-
@overload
|
322
|
-
def to_time(
|
323
|
-
obj: Any,
|
324
|
-
raising: Literal[True] = True
|
325
|
-
) -> NoReturn: ...
|
312
|
+
) -> Datetime: ...
|
326
313
|
|
327
314
|
@overload
|
328
315
|
def to_time(
|
329
|
-
obj:
|
316
|
+
obj: T,
|
330
317
|
raising: Literal[False] = True
|
331
|
-
) ->
|
318
|
+
) -> T: ...
|
332
319
|
|
333
320
|
def to_time(
|
334
321
|
obj: Any,
|
@@ -354,8 +341,8 @@ def to_time(
|
|
354
341
|
time_obj = text_to_time(obj)
|
355
342
|
|
356
343
|
# Type 'struct_time'.
|
357
|
-
case
|
358
|
-
time_obj =
|
344
|
+
case StructTime():
|
345
|
+
time_obj = Datetime(
|
359
346
|
obj.tm_year,
|
360
347
|
obj.tm_mon,
|
361
348
|
obj.tm_mday,
|
@@ -369,9 +356,9 @@ def to_time(
|
|
369
356
|
int_len, _ = digits(obj)
|
370
357
|
match int_len:
|
371
358
|
case 10:
|
372
|
-
time_obj =
|
359
|
+
time_obj = Datetime.fromtimestamp(obj)
|
373
360
|
case 13:
|
374
|
-
time_obj =
|
361
|
+
time_obj = Datetime.fromtimestamp(obj / 1000)
|
375
362
|
case _:
|
376
363
|
time_obj = None
|
377
364
|
|
reykit/rtype.py
CHANGED
@@ -14,7 +14,7 @@ from collections.abc import Callable
|
|
14
14
|
|
15
15
|
|
16
16
|
__all__ = (
|
17
|
-
'
|
17
|
+
'T',
|
18
18
|
'RStaticMeta',
|
19
19
|
'RConfigMeta',
|
20
20
|
'RNull',
|
@@ -22,7 +22,7 @@ __all__ = (
|
|
22
22
|
)
|
23
23
|
|
24
24
|
|
25
|
-
|
25
|
+
T = TypeVar('T')
|
26
26
|
|
27
27
|
|
28
28
|
class RStaticMeta(type):
|
@@ -1,7 +1,7 @@
|
|
1
1
|
reykit/__init__.py,sha256=QwnhdUDSXgjXJQ4ClaeP9oKXUXyQOPj5sApwGCDrILc,848
|
2
2
|
reykit/rall.py,sha256=mOFwHXZ4-BOkJ5Ptbm6lQc2zwNf_VqcqM6AYYnYPfoo,672
|
3
3
|
reykit/rcomm.py,sha256=LgSLrpUokOgdRMYwuZj6JNvxDyvENwsiOd6ZHo67HBg,11444
|
4
|
-
reykit/rdata.py,sha256=
|
4
|
+
reykit/rdata.py,sha256=nCBZxD2fsDuFCDyfLLZZPYJPod4Xuv0aKplQDDUMvI8,8285
|
5
5
|
reykit/remail.py,sha256=rK_hbqGeZh04DnVPtjODLsm_YfdrZ5L-Z6SbjplrfUc,6736
|
6
6
|
reykit/rexception.py,sha256=ftXVdEVkU0B0HXbKjQTiJRJVVGbvhorwWtMiplpN9Zk,8118
|
7
7
|
reykit/rimage.py,sha256=fQpIHX6Go3Jk_MDgsSDnZx27EZHumyGdgI9xyjP5lYQ,6275
|
@@ -14,17 +14,17 @@ reykit/rrandom.py,sha256=fMeorpkjWAAtjD2oZCux3tpYuD2RRoBSkWI0M6NPM5Q,9102
|
|
14
14
|
reykit/rregex.py,sha256=XTlnDLior8yyncFdrTr9FsVlBcqMXvsWRfpmvQS-BR8,6089
|
15
15
|
reykit/rschedule.py,sha256=7EH_6TdEhwV-T6YyBEGYEcy85I1vTSNutDci-e_veTY,5796
|
16
16
|
reykit/rstdout.py,sha256=vSvD4QjYybNiGnowWLXRU6q1u9ERPjr8YTXgq82eYDU,9648
|
17
|
-
reykit/rsystem.py,sha256=
|
17
|
+
reykit/rsystem.py,sha256=2upm4hWnYfeeIjqSgJAC3GJOcAiZt1JS3UXDs_pnMM0,34772
|
18
18
|
reykit/rtable.py,sha256=gXszf_9DE_5SMdNcxMX-xd4IpHGQVjGsN3NQIm7wVGY,12055
|
19
19
|
reykit/rtext.py,sha256=whaKpVkd36yYVtCmZ1ptp_TVRL1v3f7Jab0vPXC8wXY,11089
|
20
|
-
reykit/rtime.py,sha256=
|
21
|
-
reykit/rtype.py,sha256=
|
20
|
+
reykit/rtime.py,sha256=iMPJcJNx4LCoX5gHIvTNuTAWiYmz-pYTyphLZ38mxKU,16476
|
21
|
+
reykit/rtype.py,sha256=AmelC4UQwO5n-dnRKo5fR4n5qEWz3d2yImTtdmvlONc,2003
|
22
22
|
reykit/rwrap.py,sha256=AJBYTDLHLGlMSiGIKoVkCsQk-Y4nDHWWFVCdnz5Bwdk,15222
|
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.8.dist-info/METADATA,sha256=wZLT__rAAqQUxrb8V8i_jr3NardP5g_-xiKldhe9FZ4,1888
|
28
|
+
reykit-1.1.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
29
|
+
reykit-1.1.8.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
30
|
+
reykit-1.1.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|