reykit 1.0.1__py3-none-any.whl → 1.1.1__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.
- reydb/__init__.py +1 -1
- reydb/rbuild.py +44 -44
- reydb/rconnection.py +107 -107
- reydb/rexecute.py +9 -13
- reydb/rfile.py +8 -8
- reydb/rinformation.py +13 -25
- reydb/rparameter.py +10 -10
- reykit/__init__.py +1 -1
- reykit/rcomm.py +12 -12
- reykit/rdata.py +4 -4
- reykit/remail.py +12 -14
- reykit/rexception.py +4 -4
- reykit/rimage.py +9 -9
- reykit/rlog.py +30 -30
- reykit/rmonkey.py +4 -5
- reykit/rmultitask.py +14 -15
- reykit/rnumber.py +2 -2
- reykit/ros.py +21 -21
- reykit/rrandom.py +11 -11
- reykit/rregex.py +10 -13
- reykit/rschedule.py +10 -10
- reykit/rstdout.py +13 -13
- reykit/rsystem.py +224 -30
- reykit/rtable.py +31 -31
- reykit/rtext.py +3 -3
- reykit/rtime.py +11 -31
- reykit/rtype.py +2 -2
- reykit/rwrap.py +16 -16
- reykit/rzip.py +4 -5
- {reykit-1.0.1.dist-info → reykit-1.1.1.dist-info}/METADATA +1 -1
- reykit-1.1.1.dist-info/RECORD +38 -0
- reykit-1.0.1.dist-info/RECORD +0 -64
- reyweb/__init__.py +0 -19
- reyweb/rall.py +0 -12
- reyweb/rbaidu/__init__.py +0 -21
- reyweb/rbaidu/rbaidu_base.py +0 -186
- reyweb/rbaidu/rbaidu_chat.py +0 -299
- reyweb/rbaidu/rbaidu_image.py +0 -183
- reyweb/rbaidu/rbaidu_voice.py +0 -256
- reywechat/__init__.py +0 -32
- reywechat/data/client_api.dll +0 -0
- reywechat/rall.py +0 -20
- reywechat/rclient.py +0 -912
- reywechat/rdatabase.py +0 -1189
- reywechat/rexception.py +0 -65
- reywechat/rexecute.py +0 -201
- reywechat/rlog.py +0 -198
- reywechat/rreceive.py +0 -1232
- reywechat/rschedule.py +0 -136
- reywechat/rsend.py +0 -630
- reywechat/rwechat.py +0 -201
- reyworm/__init__.py +0 -24
- reyworm/rall.py +0 -16
- reyworm/rbrowser.py +0 -134
- reyworm/rcalendar.py +0 -159
- reyworm/rnews.py +0 -126
- reyworm/rsecurity.py +0 -239
- reyworm/rtranslate.py +0 -75
- {reykit-1.0.1.dist-info → reykit-1.1.1.dist-info}/WHEEL +0 -0
- {reykit-1.0.1.dist-info → reykit-1.1.1.dist-info}/top_level.txt +0 -0
reydb/rconnection.py
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
from __future__ import annotations
|
13
|
-
from typing import Any,
|
13
|
+
from typing import Any, Literal, NoReturn, Self, overload, override
|
14
14
|
from types import TracebackType
|
15
15
|
from collections.abc import Iterable, Generator
|
16
16
|
from urllib.parse import quote as urllib_quote
|
@@ -62,15 +62,15 @@ class RDatabase(object):
|
|
62
62
|
def __init__(
|
63
63
|
self,
|
64
64
|
host: None = None,
|
65
|
-
port:
|
66
|
-
username:
|
67
|
-
password:
|
68
|
-
database:
|
69
|
-
drivername:
|
65
|
+
port: str | int | None = None,
|
66
|
+
username: str | None = None,
|
67
|
+
password: str | None = None,
|
68
|
+
database: str | None = None,
|
69
|
+
drivername: str | None = None,
|
70
70
|
pool_size: int = 5,
|
71
71
|
max_overflow: int = 10,
|
72
72
|
pool_timeout: float = 30.0,
|
73
|
-
pool_recycle:
|
73
|
+
pool_recycle: int | None = None,
|
74
74
|
retry: bool = False,
|
75
75
|
url: None = None,
|
76
76
|
engine: None = None,
|
@@ -80,16 +80,16 @@ class RDatabase(object):
|
|
80
80
|
@overload
|
81
81
|
def __init__(
|
82
82
|
self,
|
83
|
-
host:
|
83
|
+
host: str | None = None,
|
84
84
|
port: None = None,
|
85
|
-
username:
|
86
|
-
password:
|
87
|
-
database:
|
88
|
-
drivername:
|
85
|
+
username: str | None = None,
|
86
|
+
password: str | None = None,
|
87
|
+
database: str | None = None,
|
88
|
+
drivername: str | None = None,
|
89
89
|
pool_size: int = 5,
|
90
90
|
max_overflow: int = 10,
|
91
91
|
pool_timeout: float = 30.0,
|
92
|
-
pool_recycle:
|
92
|
+
pool_recycle: int | None = None,
|
93
93
|
retry: bool = False,
|
94
94
|
url: None = None,
|
95
95
|
engine: None = None,
|
@@ -99,16 +99,16 @@ class RDatabase(object):
|
|
99
99
|
@overload
|
100
100
|
def __init__(
|
101
101
|
self,
|
102
|
-
host:
|
103
|
-
port:
|
102
|
+
host: str | None = None,
|
103
|
+
port: str | int | None = None,
|
104
104
|
username: None = None,
|
105
|
-
password:
|
106
|
-
database:
|
107
|
-
drivername:
|
105
|
+
password: str | None = None,
|
106
|
+
database: str | None = None,
|
107
|
+
drivername: str | None = None,
|
108
108
|
pool_size: int = 5,
|
109
109
|
max_overflow: int = 10,
|
110
110
|
pool_timeout: float = 30.0,
|
111
|
-
pool_recycle:
|
111
|
+
pool_recycle: int | None = None,
|
112
112
|
retry: bool = False,
|
113
113
|
url: None = None,
|
114
114
|
engine: None = None,
|
@@ -118,16 +118,16 @@ class RDatabase(object):
|
|
118
118
|
@overload
|
119
119
|
def __init__(
|
120
120
|
self,
|
121
|
-
host:
|
122
|
-
port:
|
123
|
-
username:
|
121
|
+
host: str | None = None,
|
122
|
+
port: str | int | None = None,
|
123
|
+
username: str | None = None,
|
124
124
|
password: None = None,
|
125
|
-
database:
|
126
|
-
drivername:
|
125
|
+
database: str | None = None,
|
126
|
+
drivername: str | None = None,
|
127
127
|
pool_size: int = 5,
|
128
128
|
max_overflow: int = 10,
|
129
129
|
pool_timeout: float = 30.0,
|
130
|
-
pool_recycle:
|
130
|
+
pool_recycle: int | None = None,
|
131
131
|
retry: bool = False,
|
132
132
|
url: None = None,
|
133
133
|
engine: None = None,
|
@@ -137,37 +137,37 @@ class RDatabase(object):
|
|
137
137
|
@overload
|
138
138
|
def __init__(
|
139
139
|
self,
|
140
|
-
host:
|
141
|
-
port:
|
142
|
-
username:
|
143
|
-
password:
|
144
|
-
database:
|
145
|
-
drivername:
|
140
|
+
host: str | None = None,
|
141
|
+
port: str | int | None = None,
|
142
|
+
username: str | None = None,
|
143
|
+
password: str | None = None,
|
144
|
+
database: str | None = None,
|
145
|
+
drivername: str | None = None,
|
146
146
|
pool_size: int = 5,
|
147
147
|
max_overflow: int = 10,
|
148
148
|
pool_timeout: float = 30.0,
|
149
|
-
pool_recycle:
|
149
|
+
pool_recycle: int | None = None,
|
150
150
|
retry: bool = False,
|
151
|
-
url:
|
152
|
-
engine:
|
151
|
+
url: str | URL | None = None,
|
152
|
+
engine: Engine | Connection | None = None,
|
153
153
|
**query: str
|
154
154
|
) -> None: ...
|
155
155
|
|
156
156
|
def __init__(
|
157
157
|
self,
|
158
|
-
host:
|
159
|
-
port:
|
160
|
-
username:
|
161
|
-
password:
|
162
|
-
database:
|
163
|
-
drivername:
|
158
|
+
host: str | None = None,
|
159
|
+
port: str | int | None = None,
|
160
|
+
username: str | None = None,
|
161
|
+
password: str | None = None,
|
162
|
+
database: str | None = None,
|
163
|
+
drivername: str | None = None,
|
164
164
|
pool_size: int = 5,
|
165
165
|
max_overflow: int = 10,
|
166
166
|
pool_timeout: float = 30.0,
|
167
|
-
pool_recycle:
|
167
|
+
pool_recycle: int | None = None,
|
168
168
|
retry: bool = False,
|
169
|
-
url:
|
170
|
-
engine:
|
169
|
+
url: str | URL | None = None,
|
170
|
+
engine: Engine | Connection | None = None,
|
171
171
|
**query: str
|
172
172
|
) -> None:
|
173
173
|
"""
|
@@ -222,7 +222,7 @@ class RDatabase(object):
|
|
222
222
|
self.password: str = params['password']
|
223
223
|
self.host: str = params['host']
|
224
224
|
self.port: str = params['port']
|
225
|
-
self.database:
|
225
|
+
self.database: str | None = params['database']
|
226
226
|
self.query: dict = params['query']
|
227
227
|
self.pool_size: int = params['pool_size']
|
228
228
|
self.max_overflow: int = params['max_overflow']
|
@@ -255,7 +255,7 @@ class RDatabase(object):
|
|
255
255
|
self.password: str = get_first_notnull(password, params['password'], default='exception')
|
256
256
|
self.host: str = get_first_notnull(host, params['host'], default='exception')
|
257
257
|
self.port: str = get_first_notnull(port, params['port'], default='exception')
|
258
|
-
self.database:
|
258
|
+
self.database: str | None = get_first_notnull(database, params['database'])
|
259
259
|
self.query: dict = get_first_notnull(query, params['query'])
|
260
260
|
self.pool_size = pool_size
|
261
261
|
self.max_overflow = max_overflow
|
@@ -273,7 +273,7 @@ class RDatabase(object):
|
|
273
273
|
self.engine = self.create_engine()
|
274
274
|
|
275
275
|
|
276
|
-
def extract_url(self, url:
|
276
|
+
def extract_url(self, url: str | URL) -> dict[
|
277
277
|
Literal['drivername', 'username', 'password', 'host', 'port', 'database', 'query'],
|
278
278
|
Any
|
279
279
|
]:
|
@@ -338,7 +338,7 @@ class RDatabase(object):
|
|
338
338
|
return params
|
339
339
|
|
340
340
|
|
341
|
-
def extract_engine(self, engine:
|
341
|
+
def extract_engine(self, engine: Engine | Connection) -> dict[
|
342
342
|
Literal[
|
343
343
|
'drivername', 'username', 'password', 'host', 'port', 'database', 'query',
|
344
344
|
'pool_size', 'max_overflow', 'pool_timeout', 'pool_recycle'
|
@@ -397,20 +397,20 @@ class RDatabase(object):
|
|
397
397
|
self,
|
398
398
|
path: str,
|
399
399
|
main: Literal['table'] = 'table'
|
400
|
-
) -> tuple[
|
400
|
+
) -> tuple[str | None, str, str | None]: ...
|
401
401
|
|
402
402
|
@overload
|
403
403
|
def extract_path(
|
404
404
|
self,
|
405
405
|
path: str,
|
406
406
|
main: Literal['database'] = 'table'
|
407
|
-
) -> tuple[str,
|
407
|
+
) -> tuple[str, str | None, str | None]: ...
|
408
408
|
|
409
409
|
def extract_path(
|
410
410
|
self,
|
411
411
|
path: str,
|
412
412
|
main: Literal['table', 'database'] = 'table'
|
413
|
-
) -> tuple[
|
413
|
+
) -> tuple[str | None, str | None, str | None]:
|
414
414
|
"""
|
415
415
|
Extract table name and database name and column name from path.
|
416
416
|
|
@@ -561,7 +561,7 @@ class RDatabase(object):
|
|
561
561
|
def handle_data(
|
562
562
|
self,
|
563
563
|
data: Table,
|
564
|
-
sql:
|
564
|
+
sql: str | TextClause,
|
565
565
|
) -> list[dict]:
|
566
566
|
"""
|
567
567
|
Handle data based on the content of SQL.
|
@@ -618,7 +618,7 @@ class RDatabase(object):
|
|
618
618
|
return data
|
619
619
|
|
620
620
|
|
621
|
-
def get_syntax(self, sql:
|
621
|
+
def get_syntax(self, sql: str | TextClause) -> list[str]:
|
622
622
|
"""
|
623
623
|
Extract SQL syntax type for each segment form SQL.
|
624
624
|
|
@@ -644,7 +644,7 @@ class RDatabase(object):
|
|
644
644
|
return syntax
|
645
645
|
|
646
646
|
|
647
|
-
def is_multi_sql(self, sql:
|
647
|
+
def is_multi_sql(self, sql: str | TextClause) -> bool:
|
648
648
|
"""
|
649
649
|
Judge whether it is multi segment SQL.
|
650
650
|
|
@@ -719,9 +719,9 @@ class RDatabase(object):
|
|
719
719
|
|
720
720
|
def execute(
|
721
721
|
self,
|
722
|
-
sql:
|
723
|
-
data:
|
724
|
-
report:
|
722
|
+
sql: str | TextClause,
|
723
|
+
data: Table | None = None,
|
724
|
+
report: bool | None = None,
|
725
725
|
**kwdata: Any
|
726
726
|
) -> RResult:
|
727
727
|
"""
|
@@ -797,14 +797,14 @@ class RDatabase(object):
|
|
797
797
|
|
798
798
|
def execute_select(
|
799
799
|
self,
|
800
|
-
path:
|
801
|
-
fields:
|
802
|
-
where:
|
803
|
-
group:
|
804
|
-
having:
|
805
|
-
order:
|
806
|
-
limit:
|
807
|
-
report:
|
800
|
+
path: str | tuple[str, str],
|
801
|
+
fields: str | Iterable[str] | None = None,
|
802
|
+
where: str | None = None,
|
803
|
+
group: str | None = None,
|
804
|
+
having: str | None = None,
|
805
|
+
order: str | None = None,
|
806
|
+
limit: int | str | tuple[int, int] | None = None,
|
807
|
+
report: bool | None = None,
|
808
808
|
**kwdata: Any
|
809
809
|
) -> RResult:
|
810
810
|
"""
|
@@ -826,7 +826,7 @@ class RDatabase(object):
|
|
826
826
|
having : Clause `HAVING` content, join as `HAVING str`.
|
827
827
|
order : Clause `ORDER BY` content, join as `ORDER BY str`.
|
828
828
|
limit : Clause `LIMIT` content.
|
829
|
-
- `
|
829
|
+
- `int | str`: Join as `LIMIT int/str`.
|
830
830
|
- `tuple[int, int]`: Join as `LIMIT int, int`.
|
831
831
|
report : Whether report SQL execute information.
|
832
832
|
- `None`, Use attribute `report_execute_info`: of object `ROption`.
|
@@ -928,10 +928,10 @@ class RDatabase(object):
|
|
928
928
|
|
929
929
|
def execute_insert(
|
930
930
|
self,
|
931
|
-
path:
|
931
|
+
path: str | tuple[str, str],
|
932
932
|
data: Table,
|
933
|
-
duplicate:
|
934
|
-
report:
|
933
|
+
duplicate: Literal['ignore', 'update'] | None = None,
|
934
|
+
report: bool | None = None,
|
935
935
|
**kwdata: Any
|
936
936
|
) -> RResult:
|
937
937
|
"""
|
@@ -1081,10 +1081,10 @@ class RDatabase(object):
|
|
1081
1081
|
|
1082
1082
|
def execute_update(
|
1083
1083
|
self,
|
1084
|
-
path:
|
1084
|
+
path: str | tuple[str, str],
|
1085
1085
|
data: Table,
|
1086
|
-
where_fields:
|
1087
|
-
report:
|
1086
|
+
where_fields: str | Iterable[str] | None = None,
|
1087
|
+
report: bool | None = None,
|
1088
1088
|
**kwdata: Any
|
1089
1089
|
) -> RResult:
|
1090
1090
|
"""
|
@@ -1101,7 +1101,7 @@ class RDatabase(object):
|
|
1101
1101
|
`literal['limit']`: Clause `LIMIT` content, join as `LIMIT str`.
|
1102
1102
|
`Other`: Clause `SET` and `WHERE` content.
|
1103
1103
|
- `Value`: Table value.
|
1104
|
-
`
|
1104
|
+
`list | tuple`: Join as `field IN :str`.
|
1105
1105
|
`Any`: Join as `field = :str`.
|
1106
1106
|
where_fields : Clause `WHERE` content fields.
|
1107
1107
|
- `None`: The first key value pair of each item is judged.
|
@@ -1256,11 +1256,11 @@ class RDatabase(object):
|
|
1256
1256
|
|
1257
1257
|
def execute_delete(
|
1258
1258
|
self,
|
1259
|
-
path:
|
1260
|
-
where:
|
1261
|
-
order:
|
1262
|
-
limit:
|
1263
|
-
report:
|
1259
|
+
path: str | tuple[str, str],
|
1260
|
+
where: str | None = None,
|
1261
|
+
order: str | None = None,
|
1262
|
+
limit: int | str | None = None,
|
1263
|
+
report: bool | None = None,
|
1264
1264
|
**kwdata: Any
|
1265
1265
|
) -> RResult:
|
1266
1266
|
"""
|
@@ -1335,10 +1335,10 @@ class RDatabase(object):
|
|
1335
1335
|
|
1336
1336
|
def execute_copy(
|
1337
1337
|
self,
|
1338
|
-
path:
|
1339
|
-
where:
|
1340
|
-
limit:
|
1341
|
-
report:
|
1338
|
+
path: str | tuple[str, str],
|
1339
|
+
where: str | None = None,
|
1340
|
+
limit: int | str | tuple[int, int] | None = None,
|
1341
|
+
report: bool | None = None,
|
1342
1342
|
**kwdata: Any
|
1343
1343
|
) -> RResult:
|
1344
1344
|
"""
|
@@ -1351,7 +1351,7 @@ class RDatabase(object):
|
|
1351
1351
|
- `tuple[str, str]`: Database name and table name.
|
1352
1352
|
where : Clause `WHERE` content, join as `WHERE str`.
|
1353
1353
|
limit : Clause `LIMIT` content.
|
1354
|
-
- `
|
1354
|
+
- `int | str`: Join as `LIMIT int/str`.
|
1355
1355
|
- `tuple[int, int]`: Join as `LIMIT int, int`.
|
1356
1356
|
report : Whether report SQL execute information.
|
1357
1357
|
- `None`, Use attribute `report_execute_info`: of object `ROption`.
|
@@ -1482,9 +1482,9 @@ class RDatabase(object):
|
|
1482
1482
|
|
1483
1483
|
def execute_exist(
|
1484
1484
|
self,
|
1485
|
-
path:
|
1486
|
-
where:
|
1487
|
-
report:
|
1485
|
+
path: str | tuple[str, str],
|
1486
|
+
where: str | None = None,
|
1487
|
+
report: bool | None = None,
|
1488
1488
|
**kwdata: Any
|
1489
1489
|
) -> bool:
|
1490
1490
|
"""
|
@@ -1536,9 +1536,9 @@ class RDatabase(object):
|
|
1536
1536
|
|
1537
1537
|
def execute_count(
|
1538
1538
|
self,
|
1539
|
-
path:
|
1540
|
-
where:
|
1541
|
-
report:
|
1539
|
+
path: str | tuple[str, str],
|
1540
|
+
where: str | None = None,
|
1541
|
+
report: bool | None = None,
|
1542
1542
|
**kwdata: Any
|
1543
1543
|
) -> int:
|
1544
1544
|
"""
|
@@ -1586,9 +1586,9 @@ class RDatabase(object):
|
|
1586
1586
|
|
1587
1587
|
def execute_generator(
|
1588
1588
|
self,
|
1589
|
-
sql:
|
1589
|
+
sql: str | TextClause,
|
1590
1590
|
data: Table,
|
1591
|
-
report:
|
1591
|
+
report: bool | None = None,
|
1592
1592
|
**kwdata: Any
|
1593
1593
|
) -> Generator[RResult, Any, None]:
|
1594
1594
|
"""
|
@@ -1929,9 +1929,9 @@ class RDatabase(object):
|
|
1929
1929
|
@overload
|
1930
1930
|
def __call__(
|
1931
1931
|
self,
|
1932
|
-
sql:
|
1933
|
-
data:
|
1934
|
-
report:
|
1932
|
+
sql: str | TextClause,
|
1933
|
+
data: Table | None = None,
|
1934
|
+
report: bool | None = None,
|
1935
1935
|
generator: Literal[False] = False,
|
1936
1936
|
**kwdata: Any
|
1937
1937
|
) -> RResult: ...
|
@@ -1939,9 +1939,9 @@ class RDatabase(object):
|
|
1939
1939
|
@overload
|
1940
1940
|
def __call__(
|
1941
1941
|
self,
|
1942
|
-
sql:
|
1942
|
+
sql: str | TextClause,
|
1943
1943
|
data: Table = None,
|
1944
|
-
report:
|
1944
|
+
report: bool | None = None,
|
1945
1945
|
generator: Literal[True] = False,
|
1946
1946
|
**kwdata: Any
|
1947
1947
|
) -> Generator[RResult, Any, None]: ...
|
@@ -1949,21 +1949,21 @@ class RDatabase(object):
|
|
1949
1949
|
@overload
|
1950
1950
|
def __call__(
|
1951
1951
|
self,
|
1952
|
-
sql:
|
1952
|
+
sql: str | TextClause,
|
1953
1953
|
data: None = None,
|
1954
|
-
report:
|
1954
|
+
report: bool | None = None,
|
1955
1955
|
generator: Literal[True] = False,
|
1956
1956
|
**kwdata: Any
|
1957
1957
|
) -> NoReturn: ...
|
1958
1958
|
|
1959
1959
|
def __call__(
|
1960
1960
|
self,
|
1961
|
-
sql:
|
1962
|
-
data:
|
1963
|
-
report:
|
1961
|
+
sql: str | TextClause,
|
1962
|
+
data: Table | None = None,
|
1963
|
+
report: bool | None = None,
|
1964
1964
|
generator: bool = False,
|
1965
1965
|
**kwdata: Any
|
1966
|
-
) ->
|
1966
|
+
) -> RResult | Generator[RResult, Any, None]:
|
1967
1967
|
"""
|
1968
1968
|
Execute SQL or return a generator that can execute SQL.
|
1969
1969
|
|
@@ -2129,9 +2129,9 @@ class RDBConnection(RDatabase):
|
|
2129
2129
|
@override
|
2130
2130
|
def execute(
|
2131
2131
|
self,
|
2132
|
-
sql:
|
2133
|
-
data:
|
2134
|
-
report:
|
2132
|
+
sql: str | TextClause,
|
2133
|
+
data: Table | None = None,
|
2134
|
+
report: bool | None = None,
|
2135
2135
|
**kwdata: Any
|
2136
2136
|
) -> RResult:
|
2137
2137
|
"""
|
@@ -2250,9 +2250,9 @@ class RDBConnection(RDatabase):
|
|
2250
2250
|
|
2251
2251
|
def __exit__(
|
2252
2252
|
self,
|
2253
|
-
exc_type:
|
2254
|
-
exc_instance:
|
2255
|
-
exc_traceback:
|
2253
|
+
exc_type: type[BaseException] | None,
|
2254
|
+
exc_instance: BaseException | None,
|
2255
|
+
exc_traceback: TracebackType | None
|
2256
2256
|
) -> None:
|
2257
2257
|
"""
|
2258
2258
|
Exit syntax `with`.
|
reydb/rexecute.py
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
from __future__ import annotations
|
13
|
-
from typing import Any,
|
13
|
+
from typing import Any, Literal, overload
|
14
14
|
from reykit.rexception import throw
|
15
15
|
from reykit.rtable import Table
|
16
16
|
|
@@ -79,7 +79,7 @@ class RDBExecute(object):
|
|
79
79
|
"""
|
80
80
|
|
81
81
|
|
82
|
-
def __init__(self, rdatabase:
|
82
|
+
def __init__(self, rdatabase: RDatabase | RDBConnection) -> None:
|
83
83
|
"""
|
84
84
|
Build `database execute` attributes.
|
85
85
|
|
@@ -94,7 +94,7 @@ class RDBExecute(object):
|
|
94
94
|
|
95
95
|
|
96
96
|
@overload
|
97
|
-
def __getattr__(self, key: Literal['_rdatabase']) ->
|
97
|
+
def __getattr__(self, key: Literal['_rdatabase']) -> RDatabase | RDBConnection: ...
|
98
98
|
|
99
99
|
@overload
|
100
100
|
def __getattr__(self, key: Literal['_path']) -> list[str]: ...
|
@@ -102,11 +102,7 @@ class RDBExecute(object):
|
|
102
102
|
@overload
|
103
103
|
def __getattr__(self, key: str) -> RDBExecute: ...
|
104
104
|
|
105
|
-
def __getattr__(self, key: str) ->
|
106
|
-
Union[RDatabase, RDBConnection],
|
107
|
-
list[str],
|
108
|
-
RDBExecute
|
109
|
-
]:
|
105
|
+
def __getattr__(self, key: str) -> RDatabase | RDBConnection | list[str] | RDBExecute:
|
110
106
|
"""
|
111
107
|
Get attribute or set database name or set table name.
|
112
108
|
|
@@ -184,7 +180,7 @@ class RDBExecute(object):
|
|
184
180
|
|
185
181
|
def __add__(
|
186
182
|
self,
|
187
|
-
params:
|
183
|
+
params: tuple | dict | Table
|
188
184
|
) -> RResult:
|
189
185
|
"""
|
190
186
|
Insert the data of table in the datebase.
|
@@ -215,7 +211,7 @@ class RDBExecute(object):
|
|
215
211
|
|
216
212
|
def __and__(
|
217
213
|
self,
|
218
|
-
params:
|
214
|
+
params: tuple | dict | Table
|
219
215
|
) -> RResult:
|
220
216
|
"""
|
221
217
|
Update the data of table in the datebase.
|
@@ -246,7 +242,7 @@ class RDBExecute(object):
|
|
246
242
|
|
247
243
|
def __sub__(
|
248
244
|
self,
|
249
|
-
params:
|
245
|
+
params: tuple | dict | str
|
250
246
|
) -> RResult:
|
251
247
|
"""
|
252
248
|
Delete the data of table in the datebase.
|
@@ -277,7 +273,7 @@ class RDBExecute(object):
|
|
277
273
|
|
278
274
|
def __mul__(
|
279
275
|
self,
|
280
|
-
params:
|
276
|
+
params: tuple | dict | str
|
281
277
|
) -> RResult:
|
282
278
|
"""
|
283
279
|
Copy record of table in the datebase.
|
@@ -308,7 +304,7 @@ class RDBExecute(object):
|
|
308
304
|
|
309
305
|
def __contains__(
|
310
306
|
self,
|
311
|
-
params:
|
307
|
+
params: tuple | dict | str
|
312
308
|
) -> bool:
|
313
309
|
"""
|
314
310
|
Judge the exist of record.
|
reydb/rfile.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import TypedDict,
|
12
|
+
from typing import TypedDict, overload
|
13
13
|
from os.path import join as os_join
|
14
14
|
from datetime import datetime
|
15
15
|
from reykit.ros import RFile, RFolder, get_md5
|
@@ -22,7 +22,7 @@ __all__ = (
|
|
22
22
|
)
|
23
23
|
|
24
24
|
|
25
|
-
FileInfo = TypedDict('FileInfo', {'create_time': datetime, 'md5': str, 'name':
|
25
|
+
FileInfo = TypedDict('FileInfo', {'create_time': datetime, 'md5': str, 'name': str | None, 'size': int, 'note': str | None})
|
26
26
|
|
27
27
|
|
28
28
|
class RDBFile(object):
|
@@ -33,7 +33,7 @@ class RDBFile(object):
|
|
33
33
|
|
34
34
|
def __init__(
|
35
35
|
self,
|
36
|
-
rdatabase:
|
36
|
+
rdatabase: RDatabase | RDBConnection
|
37
37
|
) -> None:
|
38
38
|
"""
|
39
39
|
Build `database file` attributes.
|
@@ -208,9 +208,9 @@ class RDBFile(object):
|
|
208
208
|
|
209
209
|
def upload(
|
210
210
|
self,
|
211
|
-
file:
|
212
|
-
name:
|
213
|
-
note:
|
211
|
+
file: str | bytes,
|
212
|
+
name: str | None = None,
|
213
|
+
note: str | None = None
|
214
214
|
) -> int:
|
215
215
|
"""
|
216
216
|
Upload file.
|
@@ -315,8 +315,8 @@ class RDBFile(object):
|
|
315
315
|
def download(
|
316
316
|
self,
|
317
317
|
file_id: int,
|
318
|
-
path:
|
319
|
-
) ->
|
318
|
+
path: str | None = None
|
319
|
+
) -> bytes | str:
|
320
320
|
"""
|
321
321
|
Download file.
|
322
322
|
|