reykit 1.1.101__py3-none-any.whl → 1.1.103__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/rbase.py +11 -9
- reykit/rschedule.py +20 -25
- reykit/rstdout.py +1 -4
- reykit/rtask.py +0 -10
- {reykit-1.1.101.dist-info → reykit-1.1.103.dist-info}/METADATA +1 -1
- {reykit-1.1.101.dist-info → reykit-1.1.103.dist-info}/RECORD +8 -8
- {reykit-1.1.101.dist-info → reykit-1.1.103.dist-info}/WHEEL +0 -0
- {reykit-1.1.101.dist-info → reykit-1.1.103.dist-info}/licenses/LICENSE +0 -0
reykit/rbase.py
CHANGED
@@ -9,7 +9,8 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any, Literal, Self, TypeVar, Type, NoReturn, overload, final
|
12
|
+
from typing import Any, Literal, Callable, Self, TypeVar, Type, NoReturn, overload, final
|
13
|
+
from types import CoroutineType
|
13
14
|
from collections.abc import Callable, Iterable, Container, Mapping
|
14
15
|
from sys import exc_info as sys_exc_info
|
15
16
|
from os.path import exists as os_exists
|
@@ -30,6 +31,9 @@ __all__ = (
|
|
30
31
|
'KT',
|
31
32
|
'VT',
|
32
33
|
'CallableT',
|
34
|
+
'CallableSimple',
|
35
|
+
'CoroutineFunction',
|
36
|
+
'CoroutineFunctionSimple',
|
33
37
|
'Base',
|
34
38
|
'StaticMeta',
|
35
39
|
'ConfigMeta',
|
@@ -70,6 +74,10 @@ KT = TypeVar('KT') # Dictionary key.
|
|
70
74
|
VT = TypeVar('VT') # Dictionary value.
|
71
75
|
CallableT = TypeVar('CallableT', bound=Callable) # Callable.
|
72
76
|
|
77
|
+
type CallableSimple = Callable[[], Any]
|
78
|
+
type CoroutineFunction = Callable[..., CoroutineType]
|
79
|
+
type CoroutineFunctionSimple = Callable[[], CoroutineType]
|
80
|
+
|
73
81
|
|
74
82
|
class Base(object):
|
75
83
|
"""
|
@@ -183,10 +191,6 @@ class Null(Base, metaclass=StaticMeta):
|
|
183
191
|
"""
|
184
192
|
Null type.
|
185
193
|
|
186
|
-
Attributes
|
187
|
-
----------
|
188
|
-
Type : Type hints of self.
|
189
|
-
|
190
194
|
Examples
|
191
195
|
--------
|
192
196
|
>>> def foo(arg: Any | Null.Type = Null):
|
@@ -195,19 +199,17 @@ class Null(Base, metaclass=StaticMeta):
|
|
195
199
|
"""
|
196
200
|
|
197
201
|
Type = NullType
|
202
|
+
'Type hints of self.'
|
198
203
|
|
199
204
|
|
200
205
|
class Singleton(Base):
|
201
206
|
"""
|
202
207
|
Singleton type.
|
203
208
|
When instantiated, method `__singleton__` will be called only once, and will accept arguments.
|
204
|
-
|
205
|
-
Attributes
|
206
|
-
----------
|
207
|
-
_instance : Global singleton instance.
|
208
209
|
"""
|
209
210
|
|
210
211
|
__instance: Self
|
212
|
+
'Global singleton instance.'
|
211
213
|
|
212
214
|
|
213
215
|
def __new__(self, *arg: Any, **kwargs: Any) -> Self:
|
reykit/rschedule.py
CHANGED
@@ -23,14 +23,14 @@ from .rbase import Base, throw
|
|
23
23
|
|
24
24
|
|
25
25
|
__all__ = (
|
26
|
-
'
|
26
|
+
'DatabaseORMTableSchedule',
|
27
27
|
'Schedule'
|
28
28
|
)
|
29
29
|
|
30
30
|
|
31
|
-
class
|
31
|
+
class DatabaseORMTableSchedule(rorm.Model, table=True):
|
32
32
|
"""
|
33
|
-
Database `schedule` table model.
|
33
|
+
Database `schedule` table ORM model.
|
34
34
|
"""
|
35
35
|
|
36
36
|
__name__ = 'schedule'
|
@@ -47,17 +47,8 @@ class Schedule(Base):
|
|
47
47
|
"""
|
48
48
|
Schedule type.
|
49
49
|
Can create database used `self.build_db` method.
|
50
|
-
|
51
|
-
Attributes
|
52
|
-
----------
|
53
|
-
db_names : Database table name mapping dictionary.
|
54
50
|
"""
|
55
51
|
|
56
|
-
db_names = {
|
57
|
-
'schedule': 'schedule',
|
58
|
-
'stats_schedule': 'stats_schedule'
|
59
|
-
}
|
60
|
-
|
61
52
|
|
62
53
|
def __init__(
|
63
54
|
self,
|
@@ -108,10 +99,14 @@ class Schedule(Base):
|
|
108
99
|
## Database.
|
109
100
|
self.db = db
|
110
101
|
|
102
|
+
### Build Database.
|
103
|
+
if self.db is not None:
|
104
|
+
self.build_db()
|
105
|
+
|
111
106
|
|
112
107
|
def build_db(self) -> None:
|
113
108
|
"""
|
114
|
-
Check and build database tables
|
109
|
+
Check and build database tables.
|
115
110
|
"""
|
116
111
|
|
117
112
|
# Check.
|
@@ -119,21 +114,21 @@ class Schedule(Base):
|
|
119
114
|
throw(ValueError, self.db)
|
120
115
|
|
121
116
|
# Parameter.
|
117
|
+
database = self.db.database
|
122
118
|
|
123
119
|
## Table.
|
124
|
-
|
125
|
-
tables = [DatabaseTableSchedule]
|
120
|
+
tables = [DatabaseORMTableSchedule]
|
126
121
|
|
127
122
|
## View stats.
|
128
123
|
views_stats = [
|
129
124
|
{
|
130
|
-
'path':
|
125
|
+
'path': 'stats_schedule',
|
131
126
|
'items': [
|
132
127
|
{
|
133
128
|
'name': 'count',
|
134
129
|
'select': (
|
135
130
|
'SELECT COUNT(1)\n'
|
136
|
-
f'FROM `{
|
131
|
+
f'FROM `{database}`.`schedule`'
|
137
132
|
),
|
138
133
|
'comment': 'Schedule count.'
|
139
134
|
},
|
@@ -141,7 +136,7 @@ class Schedule(Base):
|
|
141
136
|
'name': 'past_day_count',
|
142
137
|
'select': (
|
143
138
|
'SELECT COUNT(1)\n'
|
144
|
-
f'FROM `{
|
139
|
+
f'FROM `{database}`.`schedule`\n'
|
145
140
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) = 0'
|
146
141
|
),
|
147
142
|
'comment': 'Schedule count in the past day.'
|
@@ -150,7 +145,7 @@ class Schedule(Base):
|
|
150
145
|
'name': 'past_week_count',
|
151
146
|
'select': (
|
152
147
|
'SELECT COUNT(1)\n'
|
153
|
-
f'FROM `{
|
148
|
+
f'FROM `{database}`.`schedule`\n'
|
154
149
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 6'
|
155
150
|
),
|
156
151
|
'comment': 'Schedule count in the past week.'
|
@@ -159,7 +154,7 @@ class Schedule(Base):
|
|
159
154
|
'name': 'past_month_count',
|
160
155
|
'select': (
|
161
156
|
'SELECT COUNT(1)\n'
|
162
|
-
f'FROM `{
|
157
|
+
f'FROM `{database}`.`schedule`\n'
|
163
158
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 29'
|
164
159
|
),
|
165
160
|
'comment': 'Schedule count in the past month.'
|
@@ -168,7 +163,7 @@ class Schedule(Base):
|
|
168
163
|
'name': 'task_count',
|
169
164
|
'select': (
|
170
165
|
'SELECT COUNT(DISTINCT `task`)\n'
|
171
|
-
f'FROM `{
|
166
|
+
f'FROM `{database}`.`schedule`'
|
172
167
|
),
|
173
168
|
'comment': 'Task count.'
|
174
169
|
},
|
@@ -176,7 +171,7 @@ class Schedule(Base):
|
|
176
171
|
'name': 'last_time',
|
177
172
|
'select': (
|
178
173
|
'SELECT IFNULL(MAX(`update_time`), MAX(`create_time`))\n'
|
179
|
-
f'FROM `{
|
174
|
+
f'FROM `{database}`.`schedule`'
|
180
175
|
),
|
181
176
|
'comment': 'Schedule last record time.'
|
182
177
|
}
|
@@ -266,7 +261,7 @@ class Schedule(Base):
|
|
266
261
|
with self.db.connect() as conn:
|
267
262
|
conn = self.db.connect()
|
268
263
|
conn.execute.insert(
|
269
|
-
|
264
|
+
'schedule',
|
270
265
|
data
|
271
266
|
)
|
272
267
|
id_ = conn.insert_id()
|
@@ -286,7 +281,7 @@ class Schedule(Base):
|
|
286
281
|
'status': 2
|
287
282
|
}
|
288
283
|
self.db.execute.update(
|
289
|
-
|
284
|
+
'schedule',
|
290
285
|
data
|
291
286
|
)
|
292
287
|
raise
|
@@ -298,7 +293,7 @@ class Schedule(Base):
|
|
298
293
|
'status': 1
|
299
294
|
}
|
300
295
|
self.db.execute.update(
|
301
|
-
|
296
|
+
'schedule',
|
302
297
|
data
|
303
298
|
)
|
304
299
|
|
reykit/rstdout.py
CHANGED
@@ -35,10 +35,6 @@ __all__ = (
|
|
35
35
|
class ConfigStdout(Base, metaclass=ConfigMeta):
|
36
36
|
"""
|
37
37
|
Config standard output type.
|
38
|
-
|
39
|
-
Attributes
|
40
|
-
----------
|
41
|
-
force_print_ascii : Whether force methods print frame use ascii border.
|
42
38
|
"""
|
43
39
|
|
44
40
|
# Module path.
|
@@ -55,6 +51,7 @@ class ConfigStdout(Base, metaclass=ConfigMeta):
|
|
55
51
|
|
56
52
|
# Force print ascii.
|
57
53
|
force_print_ascii: bool = False
|
54
|
+
'Whether force methods print frame use ascii border.'
|
58
55
|
|
59
56
|
# Added print position.
|
60
57
|
_added_print_position: set = set()
|
reykit/rtask.py
CHANGED
@@ -51,11 +51,6 @@ type CallableCoroutine = Coroutine | ATask | Callable[[], Coroutine]
|
|
51
51
|
class ThreadPool(Base):
|
52
52
|
"""
|
53
53
|
Thread pool type.
|
54
|
-
|
55
|
-
Attributes
|
56
|
-
----------
|
57
|
-
Queue : Thread queue type.
|
58
|
-
Lock : Thread lock type.
|
59
54
|
"""
|
60
55
|
|
61
56
|
Queue = QQueue
|
@@ -788,11 +783,6 @@ async def async_request(
|
|
788
783
|
class AsyncPool(Base):
|
789
784
|
"""
|
790
785
|
Asynchronous pool type.
|
791
|
-
|
792
|
-
Attributes
|
793
|
-
----------
|
794
|
-
Queue : asynchronous queue type.
|
795
|
-
Lock : asynchronous lock type.
|
796
786
|
"""
|
797
787
|
|
798
788
|
Queue = AQueue
|
@@ -1,6 +1,6 @@
|
|
1
1
|
reykit/__init__.py,sha256=V86CHqPAAVkooVx3_QIOKpDIFVneQCTTSwfJ-uWgBno,788
|
2
2
|
reykit/rall.py,sha256=7Hip02YOkIDm3_xkoSDjvvYV2LhdBV2r4UKzWWnIfIo,628
|
3
|
-
reykit/rbase.py,sha256=
|
3
|
+
reykit/rbase.py,sha256=nQWIODrCkrcNEWY0tNW5Gm894kfqKxkVlr3jsXQRnwI,22252
|
4
4
|
reykit/rdata.py,sha256=JLdq6vAaHsMIV59GifWqb9J5WSuWJr313WtcKI_XvJY,11332
|
5
5
|
reykit/remail.py,sha256=ybWJ2mXSgtIzr-p_OYyrijxjNxQXt5wEMtUUMbhQfLg,6702
|
6
6
|
reykit/rimage.py,sha256=onM8cdkIY2L84nocvSyBoY9-JieIAJn0eWBh30WRPeg,6133
|
@@ -11,18 +11,18 @@ reykit/rnum.py,sha256=O8tFLAbDIGG25SvC3i_d9Jq8lRaR1JrzZe5WN0pqIiU,3612
|
|
11
11
|
reykit/ros.py,sha256=0QIBlhDUv3BCeiuVRBZQbhS6wHLF1RWrLHW1Uq9nUw8,47723
|
12
12
|
reykit/rrand.py,sha256=dcBVVzlRDmSsdWs9MH4SSNMZ_ORhnIBwLzLzX2yvKDk,8558
|
13
13
|
reykit/rre.py,sha256=gNRM94qXWWdyha5kaXeDj03WFs4BGFirq_Orhgi18wY,6010
|
14
|
-
reykit/rschedule.py,sha256=
|
15
|
-
reykit/rstdout.py,sha256=
|
14
|
+
reykit/rschedule.py,sha256=Uq3r0BwvypJ2ScGZgXCV41KZsmh1StcfCvfWADg4rwo,12218
|
15
|
+
reykit/rstdout.py,sha256=s2l8cpNrJjtLwRqVv2zPVKcPbIlIncSevK9jzqKmgUo,8120
|
16
16
|
reykit/rsys.py,sha256=kmk20RozJxSFgqPuUOk7mo7YcKEF1u6irTULpVW4ZLA,24903
|
17
17
|
reykit/rtable.py,sha256=e4Eh06p4XFXLDcIfKPVvFd56nMklvPpaff_pe6NhEIM,10596
|
18
|
-
reykit/rtask.py,sha256=
|
18
|
+
reykit/rtask.py,sha256=iAd_ihPZTrdzb9c1ZzvTf_oEQILF-8IrcsGin5h6-mA,27541
|
19
19
|
reykit/rtext.py,sha256=M92jCkmak5nELlue7YCFNXS02g_d2Uc1YQSjsdw3KA8,13236
|
20
20
|
reykit/rtime.py,sha256=p6mcGqQZX7XRFOIv4VyOI7K8XWADoltXPT26b2ha2wY,17775
|
21
21
|
reykit/rwrap.py,sha256=noJ_tNqAH95ZgXcFtyiLzKr4MCLkGXFPZvREM-4J068,15074
|
22
22
|
reykit/rzip.py,sha256=kPSjz1hCgPFqmINn3qw_8yVCb6wAPbSq4-VIcan98z8,3442
|
23
23
|
reykit/rdll/__init__.py,sha256=DUYGZzREGzhis36rKYGzI5JYCZJlUoKb80mkoXFfsV4,694
|
24
24
|
reykit/rdll/rdll_core.py,sha256=o6-rKcTQgxZQe0kD3GnwyNb3KL9IogzgCQNOmYLMm7A,5086
|
25
|
-
reykit-1.1.
|
26
|
-
reykit-1.1.
|
27
|
-
reykit-1.1.
|
28
|
-
reykit-1.1.
|
25
|
+
reykit-1.1.103.dist-info/METADATA,sha256=uHCLJBa65DCI0QuEIRTTzPVgpLf5v_WhFX-AFQ6kl-s,1861
|
26
|
+
reykit-1.1.103.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
27
|
+
reykit-1.1.103.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
28
|
+
reykit-1.1.103.dist-info/RECORD,,
|
File without changes
|
File without changes
|