ka-uts-com 1.0.0.240823__py3-none-any.whl → 2.0.0.250407__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.
- build/lib/ka_uts_com/__version__.py +1 -1
- build/lib/ka_uts_com/base/app_.py +50 -0
- build/lib/ka_uts_com/base/cfg_.py +35 -0
- build/lib/ka_uts_com/base/exit_.py +37 -0
- build/lib/ka_uts_com/base/log_.py +131 -0
- build/lib/ka_uts_com/com.py +91 -192
- build/lib/ka_uts_com/data/log.std.yml +107 -0
- build/lib/ka_uts_com/data/{log.standard.yml → log.usr.yml} +47 -27
- build/lib/ka_uts_com/decorators/dec.py +13 -0
- build/lib/ka_uts_com/fnc.py +29 -24
- build/lib/ka_uts_com/ioc/jinja2_.py +42 -0
- build/lib/ka_uts_com/ioc/yaml_.py +30 -0
- build/lib/ka_uts_com/log.py +48 -25
- build/lib/ka_uts_com/timer.py +24 -27
- build/lib/ka_uts_com/utils/aoeqstmt.py +37 -0
- build/lib/ka_uts_com/{date.py → utils/date.py} +4 -4
- build/lib/ka_uts_com/utils/doeq.py +99 -0
- build/lib/ka_uts_com/utils/pacmod.py +123 -0
- build/lib/ka_uts_com/{str.py → utils/str.py} +36 -39
- ka_uts_com/__version__.py +1 -1
- ka_uts_com/base/app_.py +50 -0
- ka_uts_com/base/cfg_.py +35 -0
- ka_uts_com/base/exit_.py +37 -0
- ka_uts_com/base/log_.py +131 -0
- ka_uts_com/com.py +91 -192
- ka_uts_com/data/log.std.yml +107 -0
- ka_uts_com/data/{log.standard.yml → log.usr.yml} +47 -27
- ka_uts_com/decorators/dec.py +13 -0
- ka_uts_com/fnc.py +29 -24
- ka_uts_com/ioc/jinja2_.py +42 -0
- ka_uts_com/ioc/yaml_.py +30 -0
- ka_uts_com/log.py +48 -25
- ka_uts_com/timer.py +24 -27
- ka_uts_com/utils/aoeqstmt.py +37 -0
- ka_uts_com/{date.py → utils/date.py} +4 -4
- ka_uts_com/utils/doeq.py +99 -0
- ka_uts_com/utils/pacmod.py +123 -0
- ka_uts_com/{str.py → utils/str.py} +36 -39
- ka_uts_com-2.0.0.250407.dist-info/METADATA +1611 -0
- ka_uts_com-2.0.0.250407.dist-info/RECORD +49 -0
- {ka_uts_com-1.0.0.240823.dist-info → ka_uts_com-2.0.0.250407.dist-info}/WHEEL +1 -1
- {ka_uts_com-1.0.0.240823.dist-info → ka_uts_com-2.0.0.250407.dist-info/licenses}/LICENSE.txt +1 -2
- build/lib/dist/ka_uts_com-1.0.0.240823-py3-none-any.whl +0 -0
- build/lib/dist/ka_uts_com-1.0.0.240823.tar.gz +0 -0
- build/lib/ka_uts_com/aeq.py +0 -87
- build/lib/ka_uts_com/argv.py +0 -49
- build/lib/ka_uts_com/data/log.personal.yml +0 -93
- build/lib/ka_uts_com/ioc.py +0 -57
- build/lib/ka_uts_com/pacmod.py +0 -111
- dist/ka_uts_com-1.0.0.240823-py3-none-any.whl +0 -0
- dist/ka_uts_com-1.0.0.240823.tar.gz +0 -0
- ka_uts_com/aeq.py +0 -87
- ka_uts_com/argv.py +0 -49
- ka_uts_com/data/log.personal.yml +0 -93
- ka_uts_com/ioc.py +0 -57
- ka_uts_com/pacmod.py +0 -111
- ka_uts_com-1.0.0.240823.dist-info/METADATA +0 -943
- ka_uts_com-1.0.0.240823.dist-info/RECORD +0 -41
- {ka_uts_com-1.0.0.240823.dist-info → ka_uts_com-2.0.0.250407.dist-info}/top_level.txt +0 -0
@@ -1,37 +1,36 @@
|
|
1
1
|
# coding=utf-8
|
2
|
+
from typing import Any
|
3
|
+
import traceback
|
2
4
|
|
3
5
|
from datetime import datetime
|
4
6
|
import re
|
5
7
|
import orjson
|
6
8
|
import simplejson
|
7
|
-
import traceback
|
8
9
|
|
9
|
-
|
10
|
+
TyArr = list[Any]
|
11
|
+
TyDic = dict[Any, Any]
|
12
|
+
TyAoA = list[TyArr]
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
TN_AoA = None | T_AoA
|
19
|
-
TN_Arr = None | T_Arr
|
20
|
-
TN_Dic = None | T_Dic
|
21
|
-
TN_Datetime = None | datetime
|
14
|
+
TnInt = None | int
|
15
|
+
TnFloat = None | float
|
16
|
+
TnStr = None | str
|
17
|
+
TnAoA = None | TyAoA
|
18
|
+
TnArr = None | TyArr
|
19
|
+
TnDic = None | TyDic
|
20
|
+
TnDatetime = None | datetime
|
22
21
|
|
23
22
|
|
24
23
|
class Str:
|
25
24
|
""" Manage String Class
|
26
25
|
"""
|
27
26
|
@staticmethod
|
28
|
-
def sh_date(string: str, fmt:
|
27
|
+
def sh_date(string: str, fmt: TnStr = None) -> TnDatetime:
|
29
28
|
""" show string as date using the format string
|
30
29
|
"""
|
31
30
|
try:
|
32
31
|
if fmt is None:
|
33
32
|
fmt = "%m/%d/%Y"
|
34
|
-
_date:
|
33
|
+
_date: TnDatetime = datetime.strptime(string, fmt)
|
35
34
|
return _date
|
36
35
|
except Exception:
|
37
36
|
print(traceback.format_exc())
|
@@ -69,8 +68,7 @@ class Str:
|
|
69
68
|
if int(string) % 2 == 0:
|
70
69
|
return False
|
71
70
|
return True
|
72
|
-
|
73
|
-
return False
|
71
|
+
return False
|
74
72
|
|
75
73
|
@staticmethod
|
76
74
|
def is_integer(string: str) -> bool:
|
@@ -89,7 +87,7 @@ class Str:
|
|
89
87
|
return False
|
90
88
|
|
91
89
|
@staticmethod
|
92
|
-
def is_undefined(string:
|
90
|
+
def is_undefined(string: TnStr) -> bool:
|
93
91
|
""" check if string is undefined (None or empty)
|
94
92
|
"""
|
95
93
|
if string is None or string == '':
|
@@ -97,7 +95,7 @@ class Str:
|
|
97
95
|
return False
|
98
96
|
|
99
97
|
@staticmethod
|
100
|
-
def nvl(string:
|
98
|
+
def nvl(string: TnStr) -> TnStr:
|
101
99
|
""" nvl function similar to SQL NVL function
|
102
100
|
"""
|
103
101
|
if string is None:
|
@@ -111,7 +109,7 @@ class Str:
|
|
111
109
|
return string.replace('\n', ' ').strip()
|
112
110
|
|
113
111
|
@staticmethod
|
114
|
-
def remove(string: str, a_to_remove:
|
112
|
+
def remove(string: str, a_to_remove: TyArr) -> str:
|
115
113
|
""" remove all character of a list
|
116
114
|
"""
|
117
115
|
for to_remove in a_to_remove:
|
@@ -122,15 +120,16 @@ class Str:
|
|
122
120
|
def sh_boolean(string: str) -> bool:
|
123
121
|
""" Show string as boolean if string is a boolean
|
124
122
|
"""
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
123
|
+
match string.lower():
|
124
|
+
case 'true':
|
125
|
+
return True
|
126
|
+
case 'false':
|
127
|
+
return False
|
128
|
+
case _:
|
129
|
+
raise ValueError
|
131
130
|
|
132
131
|
@staticmethod
|
133
|
-
def sh_float(string: str) ->
|
132
|
+
def sh_float(string: str) -> TnFloat:
|
134
133
|
""" Returns Float if string is of Type Float
|
135
134
|
otherwise None
|
136
135
|
"""
|
@@ -141,7 +140,7 @@ class Str:
|
|
141
140
|
return None
|
142
141
|
|
143
142
|
@staticmethod
|
144
|
-
def sh_int(string: str) ->
|
143
|
+
def sh_int(string: str) -> TnInt:
|
145
144
|
""" Returns Int if string is of Type Int
|
146
145
|
otherwise None
|
147
146
|
"""
|
@@ -151,23 +150,21 @@ class Str:
|
|
151
150
|
return None
|
152
151
|
|
153
152
|
@staticmethod
|
154
|
-
def sh_dic(string: str, sw_decimal=False) ->
|
153
|
+
def sh_dic(string: str, sw_decimal=False) -> Any:
|
155
154
|
""" Returns Dic if string is of Type Json-String
|
156
155
|
otherwise None
|
157
156
|
"""
|
158
157
|
try:
|
159
158
|
if sw_decimal:
|
160
|
-
|
159
|
+
return simplejson.loads(string, use_decimal=True)
|
161
160
|
else:
|
162
|
-
|
163
|
-
return dic
|
161
|
+
return orjson.loads(string)
|
164
162
|
except Exception:
|
165
|
-
# print(f"string = {string}")
|
166
163
|
print(traceback.format_exc())
|
167
164
|
return None
|
168
165
|
|
169
166
|
@staticmethod
|
170
|
-
def sh_arr(string: str) ->
|
167
|
+
def sh_arr(string: str) -> Any:
|
171
168
|
""" Show valid Array string as Array
|
172
169
|
"""
|
173
170
|
try:
|
@@ -177,7 +174,7 @@ class Str:
|
|
177
174
|
return None
|
178
175
|
|
179
176
|
@staticmethod
|
180
|
-
def sh_aoa(string: str) ->
|
177
|
+
def sh_aoa(string: str) -> Any:
|
181
178
|
""" Show valid Array string as Array
|
182
179
|
"""
|
183
180
|
try:
|
@@ -193,7 +190,7 @@ class Str:
|
|
193
190
|
return string.split()[0]
|
194
191
|
|
195
192
|
@classmethod
|
196
|
-
def sh_a_int(cls, string: str, sep: str) ->
|
193
|
+
def sh_a_int(cls, string: str, sep: str) -> TyArr:
|
197
194
|
""" Show first substring of string
|
198
195
|
"""
|
199
196
|
# arr = string.split(sep)
|
@@ -210,7 +207,7 @@ class Str:
|
|
210
207
|
|
211
208
|
@classmethod
|
212
209
|
def sh_a_str(
|
213
|
-
cls, string: str, sep: str, a_exclude:
|
210
|
+
cls, string: str, sep: str, a_exclude: TnArr = None) -> Any:
|
214
211
|
""" Show first substring of string
|
215
212
|
"""
|
216
213
|
# arr = string.split(sep)
|
@@ -238,7 +235,7 @@ class Str:
|
|
238
235
|
|
239
236
|
@classmethod
|
240
237
|
def sh_a_obj(
|
241
|
-
cls, string: str, sep: str, a_exclude:
|
238
|
+
cls, string: str, sep: str, a_exclude: TnArr = None) -> Any:
|
242
239
|
""" Show first substring of string
|
243
240
|
"""
|
244
241
|
# arr = string.split(sep)
|
@@ -253,7 +250,7 @@ class Str:
|
|
253
250
|
if _item not in a_exclude:
|
254
251
|
_arr.append(_item)
|
255
252
|
|
256
|
-
arr_new:
|
253
|
+
arr_new: TyArr = []
|
257
254
|
for item in _arr:
|
258
255
|
if isinstance(item, str):
|
259
256
|
_item = item.strip()
|