reykit 1.1.101__py3-none-any.whl → 1.1.102__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 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
  """
reykit/rschedule.py CHANGED
@@ -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,
@@ -111,7 +102,7 @@ class Schedule(Base):
111
102
 
112
103
  def build_db(self) -> None:
113
104
  """
114
- Check and build database tables, by `self.db_names`.
105
+ Check and build database tables.
115
106
  """
116
107
 
117
108
  # Check.
@@ -119,21 +110,21 @@ class Schedule(Base):
119
110
  throw(ValueError, self.db)
120
111
 
121
112
  # Parameter.
113
+ database = self.db.database
122
114
 
123
115
  ## Table.
124
- DatabaseTableSchedule._set_name(self.db_names['schedule'])
125
116
  tables = [DatabaseTableSchedule]
126
117
 
127
118
  ## View stats.
128
119
  views_stats = [
129
120
  {
130
- 'path': self.db_names['stats_schedule'],
121
+ 'path': 'stats_schedule',
131
122
  'items': [
132
123
  {
133
124
  'name': 'count',
134
125
  'select': (
135
126
  'SELECT COUNT(1)\n'
136
- f'FROM `{self.db.database}`.`{self.db_names['schedule']}`'
127
+ f'FROM `{database}`.`schedule`'
137
128
  ),
138
129
  'comment': 'Schedule count.'
139
130
  },
@@ -141,7 +132,7 @@ class Schedule(Base):
141
132
  'name': 'past_day_count',
142
133
  'select': (
143
134
  'SELECT COUNT(1)\n'
144
- f'FROM `{self.db.database}`.`{self.db_names['schedule']}`\n'
135
+ f'FROM `{database}`.`schedule`\n'
145
136
  'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) = 0'
146
137
  ),
147
138
  'comment': 'Schedule count in the past day.'
@@ -150,7 +141,7 @@ class Schedule(Base):
150
141
  'name': 'past_week_count',
151
142
  'select': (
152
143
  'SELECT COUNT(1)\n'
153
- f'FROM `{self.db.database}`.`{self.db_names['schedule']}`\n'
144
+ f'FROM `{database}`.`schedule`\n'
154
145
  'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 6'
155
146
  ),
156
147
  'comment': 'Schedule count in the past week.'
@@ -159,7 +150,7 @@ class Schedule(Base):
159
150
  'name': 'past_month_count',
160
151
  'select': (
161
152
  'SELECT COUNT(1)\n'
162
- f'FROM `{self.db.database}`.`{self.db_names['schedule']}`\n'
153
+ f'FROM `{database}`.`schedule`\n'
163
154
  'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 29'
164
155
  ),
165
156
  'comment': 'Schedule count in the past month.'
@@ -168,7 +159,7 @@ class Schedule(Base):
168
159
  'name': 'task_count',
169
160
  'select': (
170
161
  'SELECT COUNT(DISTINCT `task`)\n'
171
- f'FROM `{self.db.database}`.`{self.db_names['schedule']}`'
162
+ f'FROM `{database}`.`schedule`'
172
163
  ),
173
164
  'comment': 'Task count.'
174
165
  },
@@ -176,7 +167,7 @@ class Schedule(Base):
176
167
  'name': 'last_time',
177
168
  'select': (
178
169
  'SELECT IFNULL(MAX(`update_time`), MAX(`create_time`))\n'
179
- f'FROM `{self.db.database}`.`{self.db_names['schedule']}`'
170
+ f'FROM `{database}`.`schedule`'
180
171
  ),
181
172
  'comment': 'Schedule last record time.'
182
173
  }
@@ -266,7 +257,7 @@ class Schedule(Base):
266
257
  with self.db.connect() as conn:
267
258
  conn = self.db.connect()
268
259
  conn.execute.insert(
269
- self.db_names['schedule'],
260
+ 'schedule',
270
261
  data
271
262
  )
272
263
  id_ = conn.insert_id()
@@ -286,7 +277,7 @@ class Schedule(Base):
286
277
  'status': 2
287
278
  }
288
279
  self.db.execute.update(
289
- self.db_names['schedule'],
280
+ 'schedule',
290
281
  data
291
282
  )
292
283
  raise
@@ -298,7 +289,7 @@ class Schedule(Base):
298
289
  'status': 1
299
290
  }
300
291
  self.db.execute.update(
301
- self.db_names['schedule'],
292
+ 'schedule',
302
293
  data
303
294
  )
304
295
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reykit
3
- Version: 1.1.101
3
+ Version: 1.1.102
4
4
  Summary: Kit method set.
5
5
  Project-URL: homepage, https://github.com/reyxbo/reykit/
6
6
  Author-email: Rey <reyxbo@163.com>
@@ -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=zUjiwedMGAMRUWRV8HCvWPrjSxwkqtXmIImjTd8UT2c,22053
3
+ reykit/rbase.py,sha256=UCBNQb19cX4Hvy4zQHhi2Dm5q9qFFnJY5ZyQmGCTBlU,22335
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,7 +11,7 @@ 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=MlcA1F9wW9bIgCXL01XBZypEDvOieLUy52egKHledeU,12579
14
+ reykit/rschedule.py,sha256=mbAEjnpA7hrVIP1JTRB0SWrHhvEDZHENR3HjfS2e5CQ,12112
15
15
  reykit/rstdout.py,sha256=ZGddn5w87jy5vI5RvnMvXravtp8sB7qdrsz4wdOnbYc,8172
16
16
  reykit/rsys.py,sha256=kmk20RozJxSFgqPuUOk7mo7YcKEF1u6irTULpVW4ZLA,24903
17
17
  reykit/rtable.py,sha256=e4Eh06p4XFXLDcIfKPVvFd56nMklvPpaff_pe6NhEIM,10596
@@ -22,7 +22,7 @@ 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.101.dist-info/METADATA,sha256=L8RkF8uhB70kX75HMucTyj72kwgGQBvH3jJx5G-s42I,1861
26
- reykit-1.1.101.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
- reykit-1.1.101.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
28
- reykit-1.1.101.dist-info/RECORD,,
25
+ reykit-1.1.102.dist-info/METADATA,sha256=ZrIzzpTfR-CUdYPWAjGNcMBIV63dLyTYnpgIavy4aRk,1861
26
+ reykit-1.1.102.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
+ reykit-1.1.102.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
28
+ reykit-1.1.102.dist-info/RECORD,,