reykit 1.1.94__py3-none-any.whl → 1.1.96__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 +37 -17
- reykit/rdata.py +2 -2
- reykit/rlog.py +3 -3
- reykit/rschedule.py +6 -6
- {reykit-1.1.94.dist-info → reykit-1.1.96.dist-info}/METADATA +1 -1
- {reykit-1.1.94.dist-info → reykit-1.1.96.dist-info}/RECORD +8 -8
- {reykit-1.1.94.dist-info → reykit-1.1.96.dist-info}/WHEEL +0 -0
- {reykit-1.1.94.dist-info → reykit-1.1.96.dist-info}/licenses/LICENSE +0 -0
reykit/rbase.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any, Literal, Self, TypeVar, NoReturn, overload
|
12
|
+
from typing import Any, Literal, Self, TypeVar, Type, NoReturn, overload, final
|
13
13
|
from collections.abc import Callable, Iterable, Container, Mapping
|
14
14
|
from sys import exc_info as sys_exc_info
|
15
15
|
from os.path import exists as os_exists
|
@@ -35,6 +35,7 @@ __all__ = (
|
|
35
35
|
'StaticMeta',
|
36
36
|
'ConfigMeta',
|
37
37
|
'Singleton',
|
38
|
+
'NullType',
|
38
39
|
'Null',
|
39
40
|
'ErrorBase',
|
40
41
|
'Exit',
|
@@ -175,6 +176,28 @@ class ConfigMeta(StaticMeta):
|
|
175
176
|
setattr(cls, name, value)
|
176
177
|
|
177
178
|
|
179
|
+
type NullType = Type['Null']
|
180
|
+
|
181
|
+
|
182
|
+
@final
|
183
|
+
class Null(Base, metaclass=StaticMeta):
|
184
|
+
"""
|
185
|
+
Null type.
|
186
|
+
|
187
|
+
Attributes
|
188
|
+
----------
|
189
|
+
Type : Type hints of self.
|
190
|
+
|
191
|
+
Examples
|
192
|
+
--------
|
193
|
+
>>> def foo(arg: Any | Null.Type = Null):
|
194
|
+
... if arg == Null:
|
195
|
+
... ...
|
196
|
+
"""
|
197
|
+
|
198
|
+
Type = NullType
|
199
|
+
|
200
|
+
|
178
201
|
class Singleton(Base):
|
179
202
|
"""
|
180
203
|
Singleton type.
|
@@ -185,7 +208,7 @@ class Singleton(Base):
|
|
185
208
|
_instance : Global singleton instance.
|
186
209
|
"""
|
187
210
|
|
188
|
-
|
211
|
+
__instance: Self
|
189
212
|
|
190
213
|
|
191
214
|
def __new__(self, *arg: Any, **kwargs: Any) -> Self:
|
@@ -193,22 +216,19 @@ class Singleton(Base):
|
|
193
216
|
Build `singleton` instance.
|
194
217
|
"""
|
195
218
|
|
196
|
-
#
|
197
|
-
if self
|
198
|
-
self.
|
199
|
-
|
200
|
-
## Singleton method.
|
201
|
-
if hasattr(self, "__singleton__"):
|
202
|
-
__singleton__: Callable = getattr(self, "__singleton__")
|
203
|
-
__singleton__(self, *arg, **kwargs)
|
219
|
+
# Built.
|
220
|
+
if hasattr(self, '__instance'):
|
221
|
+
return self.__instance
|
204
222
|
|
205
|
-
|
223
|
+
# Build.
|
224
|
+
self.__instance = super().__new__(self)
|
206
225
|
|
226
|
+
## Singleton method.
|
227
|
+
if hasattr(self, "__singleton__"):
|
228
|
+
__singleton__: Callable = getattr(self, "__singleton__")
|
229
|
+
__singleton__(self, *arg, **kwargs)
|
207
230
|
|
208
|
-
|
209
|
-
"""
|
210
|
-
Null type.
|
211
|
-
"""
|
231
|
+
return self.__instance
|
212
232
|
|
213
233
|
|
214
234
|
class ErrorBase(Base, BaseException):
|
@@ -588,7 +608,7 @@ def get_first_notnone(*values: None) -> NoReturn: ...
|
|
588
608
|
@overload
|
589
609
|
def get_first_notnone(*values: T) -> T: ...
|
590
610
|
|
591
|
-
def get_first_notnone(*values: T, default: U | Null = Null) -> T | U:
|
611
|
+
def get_first_notnone(*values: T, default: U | Null.Type = Null) -> T | U:
|
592
612
|
"""
|
593
613
|
Get the first value that is not `None`.
|
594
614
|
|
@@ -597,7 +617,7 @@ def get_first_notnone(*values: T, default: U | Null = Null) -> T | U:
|
|
597
617
|
values : Check values.
|
598
618
|
default : When all are `None`, then return this is value, or throw exception.
|
599
619
|
- `Any`: Return this is value.
|
600
|
-
- `Null`: Throw exception.
|
620
|
+
- `Null.Type`: Throw exception.
|
601
621
|
|
602
622
|
Returns
|
603
623
|
-------
|
reykit/rdata.py
CHANGED
@@ -337,14 +337,14 @@ def chain(*iterables: dict[KT, VT] | Iterable[T]) -> ChainMap[KT, VT] | IChain[T
|
|
337
337
|
return data
|
338
338
|
|
339
339
|
|
340
|
-
def default_dict(default: T | Null = Null, data: dict[KT, VT] | None = None) -> Defaultdict[KT, VT | T]:
|
340
|
+
def default_dict(default: T | Null.Type = Null, data: dict[KT, VT] | None = None) -> Defaultdict[KT, VT | T]:
|
341
341
|
"""
|
342
342
|
Set `dict` instance, default value when key does not exist.
|
343
343
|
|
344
344
|
Parameters
|
345
345
|
----------
|
346
346
|
default : Default value.
|
347
|
-
- `Null`: Nest function self.
|
347
|
+
- `Null.Type`: Nest function self.
|
348
348
|
- `Callable`: Use call return value.
|
349
349
|
data : `dict` instance.
|
350
350
|
- `None`: Empty `dict`.
|
reykit/rlog.py
CHANGED
@@ -954,7 +954,7 @@ class Mark(Base):
|
|
954
954
|
self.data: dict[Hashable, set[int]] = {}
|
955
955
|
|
956
956
|
|
957
|
-
def mark(self, obj: Any, group: Hashable | Null = Null) -> int:
|
957
|
+
def mark(self, obj: Any, group: Hashable | Null.Type = Null) -> int:
|
958
958
|
"""
|
959
959
|
Mark object.
|
960
960
|
|
@@ -978,7 +978,7 @@ class Mark(Base):
|
|
978
978
|
return obj_id
|
979
979
|
|
980
980
|
|
981
|
-
def remove(self, obj: Any, group: Hashable | Null = Null) -> None:
|
981
|
+
def remove(self, obj: Any, group: Hashable | Null.Type = Null) -> None:
|
982
982
|
"""
|
983
983
|
Whether marked.
|
984
984
|
|
@@ -1017,7 +1017,7 @@ class Mark(Base):
|
|
1017
1017
|
del self.data[group]
|
1018
1018
|
|
1019
1019
|
|
1020
|
-
def is_marked(self, obj: Any, group: Hashable | Null = Null) -> bool:
|
1020
|
+
def is_marked(self, obj: Any, group: Hashable | Null.Type = Null) -> bool:
|
1021
1021
|
"""
|
1022
1022
|
Whether marked.
|
1023
1023
|
|
reykit/rschedule.py
CHANGED
@@ -34,12 +34,12 @@ class DatabaseTableSchedule(rorm.Model, table=True):
|
|
34
34
|
"""
|
35
35
|
|
36
36
|
__comment__ = 'Schedule execute record table.'
|
37
|
-
create_time: rorm.Datetime = rorm.Field(field_default='
|
38
|
-
update_time: rorm.Datetime = rorm.Field(field_default='
|
39
|
-
id: int = rorm.Field(
|
40
|
-
status: str = rorm.Field(
|
41
|
-
task: str = rorm.Field(
|
42
|
-
note: str = rorm.Field(
|
37
|
+
create_time: rorm.Datetime = rorm.Field(field_default=':create_time', not_null=True, index_n=True, comment='Record create time.')
|
38
|
+
update_time: rorm.Datetime = rorm.Field(field_default=':update_time', index_n=True, comment='Record update time.')
|
39
|
+
id: int = rorm.Field(rorm.types_mysql.INTEGER(unsigned=True), key_auto=True, comment='ID.')
|
40
|
+
status: str = rorm.Field(rorm.types_mysql.TINYINT(unsigned=True), not_null=True, comment='Schedule status, 0 is executing, 1 is completed, 2 is occurred error.')
|
41
|
+
task: str = rorm.Field(rorm.types.VARCHAR(100), not_null=True, comment='Schedule task function name.')
|
42
|
+
note: str = rorm.Field(rorm.types.VARCHAR(500), comment='Schedule note.')
|
43
43
|
|
44
44
|
|
45
45
|
class Schedule(Base):
|
@@ -1,17 +1,17 @@
|
|
1
1
|
reykit/__init__.py,sha256=V86CHqPAAVkooVx3_QIOKpDIFVneQCTTSwfJ-uWgBno,788
|
2
2
|
reykit/rall.py,sha256=7Hip02YOkIDm3_xkoSDjvvYV2LhdBV2r4UKzWWnIfIo,628
|
3
|
-
reykit/rbase.py,sha256=
|
4
|
-
reykit/rdata.py,sha256=
|
3
|
+
reykit/rbase.py,sha256=SLnGRzNdHyFQhTW-SI9ncIMS0V7nTjlW9GJZZBT3LF0,22104
|
4
|
+
reykit/rdata.py,sha256=oBp3G7OZwb4rLDU_f4qi80u93bCvZ41ZdSM_1FBsMIE,11356
|
5
5
|
reykit/remail.py,sha256=5ImoIRX0pHG_c1kEoMPJdeEaqakgMVIXeWBl9Db5ul4,6714
|
6
6
|
reykit/rimage.py,sha256=3fMGbDwTdbmnlsz1Q33zCw-ht-xOUpj8NXYl6CzvYq0,6145
|
7
|
-
reykit/rlog.py,sha256=
|
7
|
+
reykit/rlog.py,sha256=2-dStWPCHMmBpm-8J4HgTQ9B-pc9vDQ2bAF9R8XeanE,25762
|
8
8
|
reykit/rmonkey.py,sha256=KBxUyiBlCu7RdVDL0mCuxLqycOItU3KeU6ZWXrKdvxc,7860
|
9
9
|
reykit/rnet.py,sha256=jkFnXKyjgILK2A9CtBZwjOeuABdGwejFtwPV_YK1jNc,16862
|
10
10
|
reykit/rnum.py,sha256=jEhPQatAAaIV6kPx2tVtfjuK0F09UCWU6BjfPRamqBE,3620
|
11
11
|
reykit/ros.py,sha256=n9aqChdRQQFozOn_jXQns_UrKoEstCNRzFTgOBel4wM,47787
|
12
12
|
reykit/rrand.py,sha256=kh9yWOW8zaj8bUU0H0RL_GiOs2K8JDviVzKSoPLEuls,8566
|
13
13
|
reykit/rre.py,sha256=uqqved1_SWrJOQK-o5WYRoJf3JH0YpEktnxwA0x7TPU,6018
|
14
|
-
reykit/rschedule.py,sha256=
|
14
|
+
reykit/rschedule.py,sha256=TMus57qhT3OPmRQaFLCZW5fT8bnR2c4hehQM1KVJaQ4,12580
|
15
15
|
reykit/rstdout.py,sha256=bLN_kXsWpgTrCrBJNgaEE27DUk-ojsBV-9YJtWH41b4,8188
|
16
16
|
reykit/rsys.py,sha256=PEXUU_jyglEgIyN-URtnpUcrqKF5PFeAVAljEmaSqOs,24931
|
17
17
|
reykit/rtable.py,sha256=ItsycFuN-gb3gYhHuMx_nbAluGc8tAIMOyD5DHPS-lU,12173
|
@@ -22,7 +22,7 @@ reykit/rwrap.py,sha256=8MqbOjq56DbDKuTix75wYGXcAykzLiAPKrgl13Gk4xQ,15086
|
|
22
22
|
reykit/rzip.py,sha256=u-yyEFXY5iOysgzzqEbaaDTFfoHBj0L2sv5m4AQLt1c,3450
|
23
23
|
reykit/rdll/__init__.py,sha256=TEVZjiW9Y1_VxbZgIygcwmRp5xFHM2wLgwZccZ6gjng,698
|
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.96.dist-info/METADATA,sha256=z9LDeiyKn8ElRPyoh3LO6KtSOzo-EuPnm775N6bOsWU,1872
|
26
|
+
reykit-1.1.96.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
27
|
+
reykit-1.1.96.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
28
|
+
reykit-1.1.96.dist-info/RECORD,,
|
File without changes
|
File without changes
|