reykit 1.1.96__py3-none-any.whl → 1.1.97__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/rschedule.py +1 -0
- reykit/rtable.py +7 -77
- {reykit-1.1.96.dist-info → reykit-1.1.97.dist-info}/METADATA +1 -1
- {reykit-1.1.96.dist-info → reykit-1.1.97.dist-info}/RECORD +6 -6
- {reykit-1.1.96.dist-info → reykit-1.1.97.dist-info}/WHEEL +0 -0
- {reykit-1.1.96.dist-info → reykit-1.1.97.dist-info}/licenses/LICENSE +0 -0
reykit/rschedule.py
CHANGED
@@ -33,6 +33,7 @@ class DatabaseTableSchedule(rorm.Model, table=True):
|
|
33
33
|
Database `schedule` table model.
|
34
34
|
"""
|
35
35
|
|
36
|
+
__name__ = 'schedule'
|
36
37
|
__comment__ = 'Schedule execute record table.'
|
37
38
|
create_time: rorm.Datetime = rorm.Field(field_default=':create_time', not_null=True, index_n=True, comment='Record create time.')
|
38
39
|
update_time: rorm.Datetime = rorm.Field(field_default=':update_time', index_n=True, comment='Record update time.')
|
reykit/rtable.py
CHANGED
@@ -9,8 +9,8 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any, TypedDict,
|
13
|
-
from collections.abc import
|
12
|
+
from typing import Any, TypedDict, overload
|
13
|
+
from collections.abc import Iterable, MutableMapping
|
14
14
|
from os.path import abspath as os_abspath
|
15
15
|
from sqlalchemy.engine.cursor import CursorResult, Row as CursorRow
|
16
16
|
from pandas import DataFrame, Series, ExcelWriter
|
@@ -23,87 +23,20 @@ from .rtime import time_to
|
|
23
23
|
|
24
24
|
|
25
25
|
__all__ = (
|
26
|
-
'
|
27
|
-
'is_table',
|
28
|
-
'Table'
|
26
|
+
'Table',
|
29
27
|
)
|
30
28
|
|
31
29
|
|
32
|
-
type RowData = MutableMapping | CursorRow | Series
|
33
|
-
type TableData = Collection[MutableMapping] | RowData | CursorResult | DataFrame
|
34
30
|
SheetSet = TypedDict('SheetsSet', {'name': str, 'index': int, 'fields': str | list[str]})
|
35
31
|
|
36
32
|
|
37
|
-
@overload
|
38
|
-
def is_row(obj: RowData) -> Literal[True]: ...
|
39
|
-
|
40
|
-
@overload
|
41
|
-
def is_row(obj: Any) -> Literal[False]: ...
|
42
|
-
|
43
|
-
def is_row(obj: Any) -> bool:
|
44
|
-
"""
|
45
|
-
Judge whether it is row format.
|
46
|
-
|
47
|
-
Parameters
|
48
|
-
----------
|
49
|
-
obj : Ojbect.
|
50
|
-
|
51
|
-
Returns
|
52
|
-
-------
|
53
|
-
Judgment result.
|
54
|
-
"""
|
55
|
-
|
56
|
-
# Judge.
|
57
|
-
result = isinstance(obj, (MutableMapping, CursorRow, Series))
|
58
|
-
|
59
|
-
return result
|
60
|
-
|
61
|
-
|
62
|
-
@overload
|
63
|
-
def is_table(obj: TableData) -> bool: ...
|
64
|
-
|
65
|
-
@overload
|
66
|
-
def is_table(obj: Any) -> Literal[False]: ...
|
67
|
-
|
68
|
-
def is_table(obj: Any) -> bool:
|
69
|
-
"""
|
70
|
-
Judge whether it is table format, and keys sort of the row are the same.
|
71
|
-
|
72
|
-
Parameters
|
73
|
-
----------
|
74
|
-
obj : Ojbect.
|
75
|
-
|
76
|
-
Returns
|
77
|
-
-------
|
78
|
-
Judgment result.
|
79
|
-
"""
|
80
|
-
|
81
|
-
# Judge.
|
82
|
-
if is_row(obj):
|
83
|
-
return True
|
84
|
-
if isinstance(obj, (CursorResult, DataFrame)):
|
85
|
-
return True
|
86
|
-
if isinstance(obj, Collection):
|
87
|
-
keys_strs = []
|
88
|
-
for row in obj:
|
89
|
-
if not isinstance(row, MutableMapping):
|
90
|
-
break
|
91
|
-
keys_str = ':'.join(row)
|
92
|
-
keys_strs.append(keys_str)
|
93
|
-
keys_strs = set(keys_strs)
|
94
|
-
if len(keys_strs) == 1:
|
95
|
-
return True
|
96
|
-
|
97
|
-
return False
|
98
|
-
|
99
|
-
|
100
33
|
class Table(Base):
|
101
34
|
"""
|
102
35
|
Table type.
|
103
36
|
"""
|
104
37
|
|
105
38
|
|
106
|
-
def __init__(self, data:
|
39
|
+
def __init__(self, data: Iterable) -> None:
|
107
40
|
"""
|
108
41
|
Build instance attributes.
|
109
42
|
|
@@ -131,19 +64,16 @@ class Table(Base):
|
|
131
64
|
result = [dict(self.data)]
|
132
65
|
case CursorRow():
|
133
66
|
result = [dict(self.data._mapping)]
|
134
|
-
case Series():
|
135
|
-
result = [dict(self.data.items())]
|
136
67
|
case CursorResult():
|
137
68
|
result = [
|
138
69
|
dict(row)
|
139
70
|
for row in self.data.mappings()
|
140
71
|
]
|
72
|
+
case Series():
|
73
|
+
result = [dict(self.data.items())]
|
141
74
|
case DataFrame():
|
142
75
|
result = self.data.to_dict('records')
|
143
|
-
case
|
144
|
-
if not is_table(self.data):
|
145
|
-
text = 'is not table format, or keys sort of the row are the not same'
|
146
|
-
throw(TypeError, text=text)
|
76
|
+
case Iterable():
|
147
77
|
result = [
|
148
78
|
dict(row)
|
149
79
|
for row in self.data
|
@@ -11,10 +11,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=dx2lDfRhxPm8hGgH3mVGPoUSKg35OYQ3UQiRFnPo4yI,12607
|
15
15
|
reykit/rstdout.py,sha256=bLN_kXsWpgTrCrBJNgaEE27DUk-ojsBV-9YJtWH41b4,8188
|
16
16
|
reykit/rsys.py,sha256=PEXUU_jyglEgIyN-URtnpUcrqKF5PFeAVAljEmaSqOs,24931
|
17
|
-
reykit/rtable.py,sha256=
|
17
|
+
reykit/rtable.py,sha256=OP8d3qX8xhoQ2pRwD-K4on4Pn7Mi7PZ5-sF8fYmOMAo,10555
|
18
18
|
reykit/rtask.py,sha256=C-VySd7Gk_qtP7FigLckYUhDKsuWPVeGtoRlkdnpyDw,27099
|
19
19
|
reykit/rtext.py,sha256=3wbnsvNX-ibPt7QCpv-CYDUgaFq48eZjCix8jcFPj_M,13248
|
20
20
|
reykit/rtime.py,sha256=8GL2uycThxB-dODuD3D35v2RbSFO-LgTdl6U-ZhuSZc,17795
|
@@ -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.97.dist-info/METADATA,sha256=uy793_GknFh-KXeWPUD1p2j97GqUKyau25c4N_-gPY0,1872
|
26
|
+
reykit-1.1.97.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
27
|
+
reykit-1.1.97.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
28
|
+
reykit-1.1.97.dist-info/RECORD,,
|
File without changes
|
File without changes
|