formatize 1.0.3__tar.gz → 1.0.5__tar.gz
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.
- {formatize-1.0.3 → formatize-1.0.5}/PKG-INFO +2 -1
- {formatize-1.0.3 → formatize-1.0.5}/setup.cfg +2 -1
- formatize-1.0.5/src/formatize/__init__.py +4 -0
- formatize-1.0.5/src/formatize/const.py +317 -0
- {formatize-1.0.3 → formatize-1.0.5}/src/formatize/form.py +45 -6
- {formatize-1.0.3 → formatize-1.0.5}/src/formatize.egg-info/PKG-INFO +2 -1
- {formatize-1.0.3 → formatize-1.0.5}/src/formatize.egg-info/SOURCES.txt +1 -0
- {formatize-1.0.3 → formatize-1.0.5}/src/formatize.egg-info/requires.txt +1 -0
- formatize-1.0.3/src/formatize/__init__.py +0 -3
- {formatize-1.0.3 → formatize-1.0.5}/LICENSE +0 -0
- {formatize-1.0.3 → formatize-1.0.5}/README.md +0 -0
- {formatize-1.0.3 → formatize-1.0.5}/pyproject.toml +0 -0
- {formatize-1.0.3 → formatize-1.0.5}/src/formatize.egg-info/dependency_links.txt +0 -0
- {formatize-1.0.3 → formatize-1.0.5}/src/formatize.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: formatize
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: Literp Formatting Lib
|
|
5
5
|
Home-page: https://github.com/asinerum/formatize
|
|
6
6
|
Author: Asinerum Conlang Project
|
|
@@ -19,6 +19,7 @@ Requires-Dist: pandas>=2.3.3
|
|
|
19
19
|
Requires-Dist: pillow>=12.0.0
|
|
20
20
|
Requires-Dist: pydantic>=2.12.5
|
|
21
21
|
Requires-Dist: pyyaml>=6.0.3
|
|
22
|
+
Requires-Dist: typing-extensions>=4.15.0
|
|
22
23
|
Dynamic: license-file
|
|
23
24
|
|
|
24
25
|
Detailed tips, tricks, and examples, can be found at project's repository
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = formatize
|
|
3
|
-
version = 1.0.
|
|
3
|
+
version = 1.0.5
|
|
4
4
|
author = Asinerum Conlang Project
|
|
5
5
|
author_email = asinerum.com@gmail.com
|
|
6
6
|
description = Literp Formatting Lib
|
|
@@ -26,6 +26,7 @@ install_requires =
|
|
|
26
26
|
pillow >= 12.0.0
|
|
27
27
|
pydantic >= 2.12.5
|
|
28
28
|
pyyaml >= 6.0.3
|
|
29
|
+
typing-extensions >= 4.15.0
|
|
29
30
|
|
|
30
31
|
[options.packages.find]
|
|
31
32
|
where = src
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, field_validator
|
|
2
|
+
from pydantic.functional_validators import BeforeValidator
|
|
3
|
+
from typing_extensions import Annotated
|
|
4
|
+
from typing import List, Dict, Optional
|
|
5
|
+
|
|
6
|
+
integer = lambda val: int(val) if str(val).isnumeric() else -1
|
|
7
|
+
|
|
8
|
+
nums_to_str = ConfigDict(coerce_numbers_to_str=True, extra='ignore')
|
|
9
|
+
int_or_none = Annotated[int, BeforeValidator(lambda x: integer(x))]
|
|
10
|
+
str_or_none = Annotated[str, BeforeValidator(lambda x: x or '')]
|
|
11
|
+
|
|
12
|
+
class DbItemRow(BaseModel):
|
|
13
|
+
sub: int_or_none=None
|
|
14
|
+
ref: int_or_none=None
|
|
15
|
+
uuid: Optional[str]=None
|
|
16
|
+
head: Optional[str]=None
|
|
17
|
+
info: Optional[str]=None
|
|
18
|
+
note: Optional[str]=None
|
|
19
|
+
dated: Optional[str]=None
|
|
20
|
+
creator: int_or_none=None
|
|
21
|
+
active: bool=True
|
|
22
|
+
model_config = nums_to_str
|
|
23
|
+
|
|
24
|
+
class DbTxRow(BaseModel):
|
|
25
|
+
uuid: Optional[str]=None
|
|
26
|
+
tx: Optional[str]=None
|
|
27
|
+
info: Optional[str]=None
|
|
28
|
+
note: Optional[str]=None
|
|
29
|
+
dated: Optional[str]=None
|
|
30
|
+
ref: int_or_none=None
|
|
31
|
+
account: int_or_none=None
|
|
32
|
+
sub: int_or_none=None
|
|
33
|
+
item: int_or_none=None
|
|
34
|
+
debit: float=0
|
|
35
|
+
credit: float=0
|
|
36
|
+
creator: int_or_none=None
|
|
37
|
+
model_config = nums_to_str
|
|
38
|
+
|
|
39
|
+
class DbTxs(BaseModel):
|
|
40
|
+
uuid: Optional[str]=None
|
|
41
|
+
dated: Optional[str]=None
|
|
42
|
+
creator: int_or_none=None
|
|
43
|
+
data: List[DbTxRow]=[DbTxRow()]
|
|
44
|
+
model_config = nums_to_str
|
|
45
|
+
|
|
46
|
+
class DbTx(BaseModel):
|
|
47
|
+
id: int_or_none=None
|
|
48
|
+
uuid: Optional[str]=None
|
|
49
|
+
tx: Optional[str]=None
|
|
50
|
+
info: Optional[str]=None
|
|
51
|
+
note: Optional[str]=None
|
|
52
|
+
dated: Optional[str]=None
|
|
53
|
+
datedfrom: Optional[str]=None
|
|
54
|
+
datedto: Optional[str]=None
|
|
55
|
+
ref: int_or_none=None
|
|
56
|
+
refcode: Optional[str]=None
|
|
57
|
+
account: int_or_none=None
|
|
58
|
+
accountcode: Optional[str]=None
|
|
59
|
+
sub: int_or_none=None
|
|
60
|
+
subcode: Optional[str]=None
|
|
61
|
+
item: int_or_none=None
|
|
62
|
+
itemuuid: Optional[str]=None
|
|
63
|
+
debit: float=0
|
|
64
|
+
credit: float=0
|
|
65
|
+
created: Optional[str]=None
|
|
66
|
+
createdfrom: Optional[str]=None
|
|
67
|
+
createdto: Optional[str]=None
|
|
68
|
+
creator: int_or_none=None
|
|
69
|
+
modified: Optional[str]=None
|
|
70
|
+
modifier: int_or_none=None
|
|
71
|
+
offset: int=0
|
|
72
|
+
limit: int=20
|
|
73
|
+
model_config = nums_to_str
|
|
74
|
+
|
|
75
|
+
class DbItem(BaseModel):
|
|
76
|
+
id: int_or_none=None
|
|
77
|
+
uuid: Optional[str]=None
|
|
78
|
+
sub: int_or_none=None
|
|
79
|
+
subcode: Optional[str]=None
|
|
80
|
+
account: int_or_none=None
|
|
81
|
+
accountcode: Optional[str]=None
|
|
82
|
+
ref: int_or_none=None
|
|
83
|
+
refcode: Optional[str]=None
|
|
84
|
+
head: Optional[str]=None
|
|
85
|
+
info: Optional[str]=None
|
|
86
|
+
note: Optional[str]=None
|
|
87
|
+
dated: Optional[str]=None
|
|
88
|
+
datedfrom: Optional[str]=None
|
|
89
|
+
datedto: Optional[str]=None
|
|
90
|
+
created: Optional[str]=None
|
|
91
|
+
createdfrom: Optional[str]=None
|
|
92
|
+
createdto: Optional[str]=None
|
|
93
|
+
modified: Optional[str]=None
|
|
94
|
+
creator: int_or_none=None
|
|
95
|
+
modifier: int_or_none=None
|
|
96
|
+
active: bool=True
|
|
97
|
+
cancel: bool=False
|
|
98
|
+
offset: int=0
|
|
99
|
+
limit: int=20
|
|
100
|
+
model_config = nums_to_str
|
|
101
|
+
|
|
102
|
+
class DbItems(BaseModel):
|
|
103
|
+
modifier: int_or_none=None
|
|
104
|
+
active: bool=True
|
|
105
|
+
cancel: bool=False
|
|
106
|
+
ids: list=[]
|
|
107
|
+
uuids: list=[]
|
|
108
|
+
model_config = nums_to_str
|
|
109
|
+
|
|
110
|
+
class DbSub(BaseModel):
|
|
111
|
+
id: int_or_none=None
|
|
112
|
+
name: Optional[str]=None
|
|
113
|
+
account: int_or_none=None
|
|
114
|
+
accountcode: Optional[str]=None
|
|
115
|
+
code: Optional[str]=None
|
|
116
|
+
info: Optional[str]=None
|
|
117
|
+
note: Optional[str]=None
|
|
118
|
+
created: Optional[str]=None
|
|
119
|
+
createdfrom: Optional[str]=None
|
|
120
|
+
createdto: Optional[str]=None
|
|
121
|
+
modified: Optional[str]=None
|
|
122
|
+
creator: int_or_none=None
|
|
123
|
+
modifier: int_or_none=None
|
|
124
|
+
active: bool=True
|
|
125
|
+
offset: int=0
|
|
126
|
+
limit: int=20
|
|
127
|
+
model_config = nums_to_str
|
|
128
|
+
|
|
129
|
+
class DbAccount(BaseModel):
|
|
130
|
+
id: int_or_none=None
|
|
131
|
+
name: Optional[str]=None
|
|
132
|
+
root: int_or_none=None
|
|
133
|
+
rootcode: Optional[str]=None
|
|
134
|
+
code: Optional[str]=None
|
|
135
|
+
note: Optional[str]=None
|
|
136
|
+
created: Optional[str]=None
|
|
137
|
+
active: bool=True
|
|
138
|
+
offset: int=0
|
|
139
|
+
limit: int=20
|
|
140
|
+
model_config = nums_to_str
|
|
141
|
+
|
|
142
|
+
class DbRoot(BaseModel):
|
|
143
|
+
id: int_or_none=None
|
|
144
|
+
name: Optional[str]=None
|
|
145
|
+
grup: int_or_none=None
|
|
146
|
+
grupcode: Optional[str]=None
|
|
147
|
+
code: Optional[str]=None
|
|
148
|
+
note: Optional[str]=None
|
|
149
|
+
created: Optional[str]=None
|
|
150
|
+
active: bool=True
|
|
151
|
+
offset: int=0
|
|
152
|
+
limit: int=20
|
|
153
|
+
model_config = nums_to_str
|
|
154
|
+
|
|
155
|
+
class DbGroup(BaseModel):
|
|
156
|
+
id: int_or_none=None
|
|
157
|
+
name: Optional[str]=None
|
|
158
|
+
code: Optional[str]=None
|
|
159
|
+
note: Optional[str]=None
|
|
160
|
+
created: Optional[str]=None
|
|
161
|
+
active: bool=True
|
|
162
|
+
offset: int=0
|
|
163
|
+
limit: int=20
|
|
164
|
+
model_config = nums_to_str
|
|
165
|
+
|
|
166
|
+
class DbUserrole(BaseModel):
|
|
167
|
+
name: Optional[str]=None
|
|
168
|
+
user: int_or_none=None
|
|
169
|
+
role: int_or_none=None
|
|
170
|
+
offset: int=0
|
|
171
|
+
limit: int=20
|
|
172
|
+
model_config = nums_to_str
|
|
173
|
+
|
|
174
|
+
class DbUserroles(BaseModel):
|
|
175
|
+
name: Optional[str]=None
|
|
176
|
+
user: int_or_none=None
|
|
177
|
+
roles: list=[]
|
|
178
|
+
model_config = nums_to_str
|
|
179
|
+
|
|
180
|
+
class DbUserspec(BaseModel):
|
|
181
|
+
name: Optional[str]=None
|
|
182
|
+
user: int_or_none=None
|
|
183
|
+
spec: int_or_none=None
|
|
184
|
+
offset: int=0
|
|
185
|
+
limit: int=20
|
|
186
|
+
model_config = nums_to_str
|
|
187
|
+
|
|
188
|
+
class DbUserspecs(BaseModel):
|
|
189
|
+
name: Optional[str]=None
|
|
190
|
+
user: int_or_none=None
|
|
191
|
+
specs: list=[]
|
|
192
|
+
model_config = nums_to_str
|
|
193
|
+
|
|
194
|
+
class DbSpecrole(BaseModel):
|
|
195
|
+
spec: int_or_none=None
|
|
196
|
+
role: int_or_none=None
|
|
197
|
+
offset: int=0
|
|
198
|
+
limit: int=20
|
|
199
|
+
model_config = nums_to_str
|
|
200
|
+
|
|
201
|
+
class DbSpecroles(BaseModel):
|
|
202
|
+
spec: int_or_none=None
|
|
203
|
+
roles: list=[]
|
|
204
|
+
model_config = nums_to_str
|
|
205
|
+
|
|
206
|
+
class DbSpec(BaseModel):
|
|
207
|
+
id: int_or_none=None
|
|
208
|
+
name: Optional[str]=None
|
|
209
|
+
note: Optional[str]=None
|
|
210
|
+
created: Optional[str]=None
|
|
211
|
+
active: bool=True
|
|
212
|
+
offset: int=0
|
|
213
|
+
limit: int=20
|
|
214
|
+
model_config = nums_to_str
|
|
215
|
+
|
|
216
|
+
class DbRole(BaseModel):
|
|
217
|
+
id: int_or_none=None
|
|
218
|
+
name: Optional[str]=None
|
|
219
|
+
note: Optional[str]=None
|
|
220
|
+
created: Optional[str]=None
|
|
221
|
+
active: bool=True
|
|
222
|
+
offset: int=0
|
|
223
|
+
limit: int=20
|
|
224
|
+
model_config = nums_to_str
|
|
225
|
+
|
|
226
|
+
class DbUser(BaseModel):
|
|
227
|
+
id: int_or_none=None
|
|
228
|
+
name: Optional[str]=None
|
|
229
|
+
zone: int_or_none=None
|
|
230
|
+
zoneidn: Optional[str]=None
|
|
231
|
+
useridn: Optional[str]=None
|
|
232
|
+
conuser: Optional[str]=None
|
|
233
|
+
hpwd: Optional[str]=None
|
|
234
|
+
mail: Optional[str]=None
|
|
235
|
+
info: Optional[str]=None
|
|
236
|
+
note: Optional[str]=None
|
|
237
|
+
created: Optional[str]=None
|
|
238
|
+
modified: Optional[str]=None
|
|
239
|
+
creator: Optional[int]=1
|
|
240
|
+
modifier: int_or_none=None
|
|
241
|
+
workbegin: Optional[str]=None
|
|
242
|
+
workend: Optional[str]=None
|
|
243
|
+
active: bool=False
|
|
244
|
+
zadmin: bool=False
|
|
245
|
+
worktime: Optional[str]=None
|
|
246
|
+
newpass: Optional[str]=None
|
|
247
|
+
oldpass: Optional[str]=None
|
|
248
|
+
offset: int=0
|
|
249
|
+
limit: int=20
|
|
250
|
+
model_config = nums_to_str
|
|
251
|
+
|
|
252
|
+
class DbZone(BaseModel):
|
|
253
|
+
id: int_or_none=None
|
|
254
|
+
name: Optional[str]=None
|
|
255
|
+
zoneidn: Optional[str]=None
|
|
256
|
+
useridn: Optional[str]=None
|
|
257
|
+
info: Optional[str]=None
|
|
258
|
+
note: Optional[str]=None
|
|
259
|
+
created: Optional[str]=None
|
|
260
|
+
modified: Optional[str]=None
|
|
261
|
+
creator: int=1
|
|
262
|
+
modifier: int_or_none=None
|
|
263
|
+
active: bool=False
|
|
264
|
+
offset: int=0
|
|
265
|
+
limit: int=20
|
|
266
|
+
model_config = nums_to_str
|
|
267
|
+
|
|
268
|
+
class Token(BaseModel):
|
|
269
|
+
user: Optional[str]=None
|
|
270
|
+
id: int_or_none=None
|
|
271
|
+
zone: int_or_none=None
|
|
272
|
+
zadmin: bool=False
|
|
273
|
+
access_token: Optional[str]=None
|
|
274
|
+
token_type: Optional[str]=None
|
|
275
|
+
model_config = nums_to_str
|
|
276
|
+
|
|
277
|
+
class User(BaseModel):
|
|
278
|
+
id: int_or_none=None
|
|
279
|
+
name: Optional[str]=None
|
|
280
|
+
zone: int_or_none=None
|
|
281
|
+
mail: Optional[str]=None
|
|
282
|
+
zadmin: bool=False
|
|
283
|
+
active: bool=False
|
|
284
|
+
found: bool=False
|
|
285
|
+
zoneidn: Optional[str]=None
|
|
286
|
+
useridn: Optional[str]=None
|
|
287
|
+
conuser: Optional[str]=None
|
|
288
|
+
model_config = nums_to_str
|
|
289
|
+
|
|
290
|
+
token_crypto_algorithm = 'HS256'
|
|
291
|
+
token_expire_minutes = 30
|
|
292
|
+
|
|
293
|
+
host_for_admin = '0.0.0.0'
|
|
294
|
+
host_for_api = '0.0.0.0'
|
|
295
|
+
|
|
296
|
+
port_for_admin = 900
|
|
297
|
+
port_for_api = 911
|
|
298
|
+
port_http = 80
|
|
299
|
+
port_httpa = 8080
|
|
300
|
+
port_https = 443
|
|
301
|
+
|
|
302
|
+
port_allowed = 65535
|
|
303
|
+
client_port_not_allowed = lambda port: (port:=int(port)) in [port_for_admin,port_for_api] or port>port_allowed or port<0
|
|
304
|
+
|
|
305
|
+
cors_base_url = 'http://localhost'
|
|
306
|
+
local_common_url = 'http://localhost'
|
|
307
|
+
local_secure_url = 'https://localhost'
|
|
308
|
+
|
|
309
|
+
cors_allowed_origins = lambda baseurl=cors_base_url: [
|
|
310
|
+
f"{local_common_url}",
|
|
311
|
+
f"{local_secure_url}",
|
|
312
|
+
f"{baseurl}:{port_for_api}",
|
|
313
|
+
f"{baseurl}:{port_for_admin}",
|
|
314
|
+
f"{baseurl}:{port_http}",
|
|
315
|
+
f"{baseurl}:{port_httpa}",
|
|
316
|
+
f"{baseurl}:{port_https}",
|
|
317
|
+
]
|
|
@@ -3,15 +3,18 @@ from typing import List, Dict, Optional
|
|
|
3
3
|
from importlib import import_module
|
|
4
4
|
from bs4 import BeautifulSoup
|
|
5
5
|
|
|
6
|
-
import datetime
|
|
7
|
-
import hashlib
|
|
8
|
-
import json
|
|
9
|
-
import math
|
|
10
6
|
import re
|
|
11
|
-
import
|
|
7
|
+
import sys
|
|
8
|
+
import types
|
|
12
9
|
import string
|
|
10
|
+
import inspect
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
import math
|
|
13
14
|
import uuid
|
|
14
15
|
import yaml
|
|
16
|
+
import hashlib
|
|
17
|
+
import datetime
|
|
15
18
|
|
|
16
19
|
import socket
|
|
17
20
|
import smtplib
|
|
@@ -74,6 +77,13 @@ def caller ():
|
|
|
74
77
|
def extract (s, sep='.'):
|
|
75
78
|
return s.split(sep)
|
|
76
79
|
|
|
80
|
+
def extract_input(s: str, sep: str=',', col: str=':') -> dict: ## <1.0.4>
|
|
81
|
+
try:
|
|
82
|
+
args = ''.join(s.split()).split(sep)
|
|
83
|
+
return {item.split(col)[0].lower(): item.split(col)[1] for item in args}
|
|
84
|
+
except:
|
|
85
|
+
return None
|
|
86
|
+
|
|
77
87
|
def add_zero (n, zeros=2):
|
|
78
88
|
return str(n).zfill(zeros)
|
|
79
89
|
|
|
@@ -337,7 +347,7 @@ def parse_doc_date(time: any=None) -> str:
|
|
|
337
347
|
if not (time:=parse_time(time)): return None ## For DATE()
|
|
338
348
|
return time[:10]
|
|
339
349
|
|
|
340
|
-
def parse_date (datestr: str, dateform: str='%d/%m/%Y') -> str:
|
|
350
|
+
def parse_date (datestr: str, dateform: str='%d/%m/%Y') -> str: ## <1.0.3>
|
|
341
351
|
try:
|
|
342
352
|
date = datetime.datetime.strptime(datestr, dateform)
|
|
343
353
|
except:
|
|
@@ -613,6 +623,35 @@ def update_module(Module, vals: dict) -> bool:
|
|
|
613
623
|
except:
|
|
614
624
|
return False
|
|
615
625
|
|
|
626
|
+
def create_nested_module (nested_module_name: str) -> types.ModuleType:
|
|
627
|
+
parts = nested_module_name.split('.')
|
|
628
|
+
module = None
|
|
629
|
+
parent = None
|
|
630
|
+
full_name = ''
|
|
631
|
+
for part in parts:
|
|
632
|
+
full_name = f'{full_name}.{part}' if full_name else part
|
|
633
|
+
if full_name in sys.modules:
|
|
634
|
+
module = sys.modules[full_name]
|
|
635
|
+
else:
|
|
636
|
+
module = types.ModuleType(full_name)
|
|
637
|
+
sys.modules[full_name] = module
|
|
638
|
+
if parent:
|
|
639
|
+
setattr(parent, part, module)
|
|
640
|
+
parent = module
|
|
641
|
+
return module
|
|
642
|
+
|
|
643
|
+
def add_function_to_nested_module (module, func_name, func):
|
|
644
|
+
setattr(module, func_name, func)
|
|
645
|
+
|
|
646
|
+
def add_class_to_nested_module (module, class_name, cls):
|
|
647
|
+
setattr(module, class_name, cls)
|
|
648
|
+
|
|
649
|
+
def frender (non_f_str: str):
|
|
650
|
+
return eval(f'f"""{non_f_str}"""')
|
|
651
|
+
|
|
652
|
+
def punctescape (text: str) -> str:
|
|
653
|
+
return re.compile(f'[{re.escape(string.punctuation)}]').sub('', text)
|
|
654
|
+
|
|
616
655
|
## FRONTEND FORMATTINGS
|
|
617
656
|
|
|
618
657
|
def load_yaml_temp (filepath):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: formatize
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: Literp Formatting Lib
|
|
5
5
|
Home-page: https://github.com/asinerum/formatize
|
|
6
6
|
Author: Asinerum Conlang Project
|
|
@@ -19,6 +19,7 @@ Requires-Dist: pandas>=2.3.3
|
|
|
19
19
|
Requires-Dist: pillow>=12.0.0
|
|
20
20
|
Requires-Dist: pydantic>=2.12.5
|
|
21
21
|
Requires-Dist: pyyaml>=6.0.3
|
|
22
|
+
Requires-Dist: typing-extensions>=4.15.0
|
|
22
23
|
Dynamic: license-file
|
|
23
24
|
|
|
24
25
|
Detailed tips, tricks, and examples, can be found at project's repository
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|