ka-uts-com 2.1.0.250408__py3-none-any.whl → 2.2.0.250427__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.
Files changed (54) hide show
  1. ka_uts_com/__version__.py +2 -2
  2. build/lib/ka_uts_com/base/app_.py → ka_uts_com/app.py +9 -11
  3. ka_uts_com/{base/cfg_.py → cfg.py} +7 -10
  4. ka_uts_com/com.py +47 -39
  5. build/lib/ka_uts_com/base/exit_.py → ka_uts_com/exit.py +1 -1
  6. ka_uts_com/timer.py +1 -1
  7. ka_uts_com-2.2.0.250427.dist-info/METADATA +929 -0
  8. ka_uts_com-2.2.0.250427.dist-info/RECORD +14 -0
  9. {ka_uts_com-2.1.0.250408.dist-info → ka_uts_com-2.2.0.250427.dist-info}/WHEEL +1 -1
  10. {ka_uts_com-2.1.0.250408.dist-info → ka_uts_com-2.2.0.250427.dist-info}/top_level.txt +0 -1
  11. build/lib/dist/ka_uts_com-2.0.0.250407-py3-none-any.whl +0 -0
  12. build/lib/dist/ka_uts_com-2.0.0.250407.tar.gz +0 -0
  13. build/lib/ka_uts_com/__init__.py +0 -0
  14. build/lib/ka_uts_com/__version__.py +0 -10
  15. build/lib/ka_uts_com/base/cfg_.py +0 -36
  16. build/lib/ka_uts_com/base/log_.py +0 -131
  17. build/lib/ka_uts_com/com.py +0 -115
  18. build/lib/ka_uts_com/data/__init__.py +0 -0
  19. build/lib/ka_uts_com/data/log.std.yml +0 -107
  20. build/lib/ka_uts_com/data/log.usr.yml +0 -106
  21. build/lib/ka_uts_com/decorators/dec.py +0 -13
  22. build/lib/ka_uts_com/fnc.py +0 -42
  23. build/lib/ka_uts_com/ioc/jinja2_.py +0 -42
  24. build/lib/ka_uts_com/ioc/yaml_.py +0 -31
  25. build/lib/ka_uts_com/log.py +0 -86
  26. build/lib/ka_uts_com/py.typed +0 -0
  27. build/lib/ka_uts_com/timer.py +0 -69
  28. build/lib/ka_uts_com/utils/aoeqstmt.py +0 -37
  29. build/lib/ka_uts_com/utils/date.py +0 -15
  30. build/lib/ka_uts_com/utils/doeq.py +0 -99
  31. build/lib/ka_uts_com/utils/pac.py +0 -35
  32. build/lib/ka_uts_com/utils/pacmod.py +0 -109
  33. build/lib/ka_uts_com/utils/str.py +0 -265
  34. dist/ka_uts_com-2.0.0.250407-py3-none-any.whl +0 -0
  35. dist/ka_uts_com-2.0.0.250407.tar.gz +0 -0
  36. ka_uts_com/base/app_.py +0 -50
  37. ka_uts_com/base/exit_.py +0 -37
  38. ka_uts_com/base/log_.py +0 -131
  39. ka_uts_com/data/__init__.py +0 -0
  40. ka_uts_com/data/log.std.yml +0 -107
  41. ka_uts_com/data/log.usr.yml +0 -106
  42. ka_uts_com/fnc.py +0 -42
  43. ka_uts_com/ioc/jinja2_.py +0 -42
  44. ka_uts_com/ioc/yaml_.py +0 -31
  45. ka_uts_com/log.py +0 -86
  46. ka_uts_com/utils/aoeqstmt.py +0 -37
  47. ka_uts_com/utils/date.py +0 -15
  48. ka_uts_com/utils/doeq.py +0 -99
  49. ka_uts_com/utils/pac.py +0 -35
  50. ka_uts_com/utils/pacmod.py +0 -109
  51. ka_uts_com/utils/str.py +0 -265
  52. ka_uts_com-2.1.0.250408.dist-info/METADATA +0 -1611
  53. ka_uts_com-2.1.0.250408.dist-info/RECORD +0 -55
  54. {ka_uts_com-2.1.0.250408.dist-info → ka_uts_com-2.2.0.250427.dist-info}/licenses/LICENSE.txt +0 -0
ka_uts_com/utils/str.py DELETED
@@ -1,265 +0,0 @@
1
- # coding=utf-8
2
- from typing import Any
3
- import traceback
4
-
5
- from datetime import datetime
6
- import re
7
- import orjson
8
- import simplejson
9
-
10
- TyArr = list[Any]
11
- TyDic = dict[Any, Any]
12
- TyAoA = list[TyArr]
13
-
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
21
-
22
-
23
- class Str:
24
- """ Manage String Class
25
- """
26
- @staticmethod
27
- def sh_date(string: str, fmt: TnStr = None) -> TnDatetime:
28
- """ show string as date using the format string
29
- """
30
- try:
31
- if fmt is None:
32
- fmt = "%m/%d/%Y"
33
- _date: TnDatetime = datetime.strptime(string, fmt)
34
- return _date
35
- except Exception:
36
- print(traceback.format_exc())
37
- return None
38
-
39
- @staticmethod
40
- def lchop(string: str, prefix: str) -> str:
41
- """ return substring of string which starts at the
42
- end of the contained prefix
43
- """
44
- if string.startswith(prefix):
45
- return string[len(prefix):]
46
- return string
47
-
48
- @staticmethod
49
- def rchop(string: str, suffix: str) -> str:
50
- """ return substring of string which ends at the
51
- beginning of the contained suffix
52
- """
53
- if suffix and string.endswith(suffix):
54
- return string[:-len(suffix)]
55
- return string
56
-
57
- @staticmethod
58
- def strip_multiple_chars(string: str, chars: str) -> str:
59
- """ replace multiple characters in string
60
- """
61
- return string.translate(str.maketrans("", "", chars))
62
-
63
- @staticmethod
64
- def is_odd(string: str) -> bool:
65
- """ check if string is odd number
66
- """
67
- if string.isnumeric():
68
- if int(string) % 2 == 0:
69
- return False
70
- return True
71
- return False
72
-
73
- @staticmethod
74
- def is_integer(string: str) -> bool:
75
- """ check if string is integer
76
- """
77
- if string[0] in ('-', '+'):
78
- return string[1:].isdigit()
79
- return string.isdigit()
80
-
81
- @staticmethod
82
- def is_boolean(string: str) -> bool:
83
- """ check if string is boolean
84
- """
85
- if string.strip().lower() in ['true', 'false']:
86
- return True
87
- return False
88
-
89
- @staticmethod
90
- def is_undefined(string: TnStr) -> bool:
91
- """ check if string is undefined (None or empty)
92
- """
93
- if string is None or string == '':
94
- return True
95
- return False
96
-
97
- @staticmethod
98
- def nvl(string: TnStr) -> TnStr:
99
- """ nvl function similar to SQL NVL function
100
- """
101
- if string is None:
102
- return ''
103
- return string
104
-
105
- @staticmethod
106
- def strip_n(string: str) -> str:
107
- """ Replace new line characters by Blanks and strip Blanks
108
- """
109
- return string.replace('\n', ' ').strip()
110
-
111
- @staticmethod
112
- def remove(string: str, a_to_remove: TyArr) -> str:
113
- """ remove all character of a list
114
- """
115
- for to_remove in a_to_remove:
116
- string = string.replace(to_remove, '')
117
- return string
118
-
119
- @staticmethod
120
- def sh_boolean(string: str) -> bool:
121
- """ Show string as boolean if string is a boolean
122
- """
123
- match string.lower():
124
- case 'true':
125
- return True
126
- case 'false':
127
- return False
128
- case _:
129
- raise ValueError
130
-
131
- @staticmethod
132
- def sh_float(string: str) -> TnFloat:
133
- """ Returns Float if string is of Type Float
134
- otherwise None
135
- """
136
- try:
137
- return float(string)
138
- except Exception:
139
- print(traceback.format_exc())
140
- return None
141
-
142
- @staticmethod
143
- def sh_int(string: str) -> TnInt:
144
- """ Returns Int if string is of Type Int
145
- otherwise None
146
- """
147
- try:
148
- return int(string)
149
- except ValueError:
150
- return None
151
-
152
- @staticmethod
153
- def sh_dic(string: str, sw_decimal=False) -> Any:
154
- """ Returns Dic if string is of Type Json-String
155
- otherwise None
156
- """
157
- try:
158
- if sw_decimal:
159
- return simplejson.loads(string, use_decimal=True)
160
- else:
161
- return orjson.loads(string)
162
- except Exception:
163
- print(traceback.format_exc())
164
- return None
165
-
166
- @staticmethod
167
- def sh_arr(string: str) -> Any:
168
- """ Show valid Array string as Array
169
- """
170
- try:
171
- return orjson.loads(string)
172
- except Exception:
173
- print(traceback.format_exc())
174
- return None
175
-
176
- @staticmethod
177
- def sh_aoa(string: str) -> Any:
178
- """ Show valid Array string as Array
179
- """
180
- try:
181
- return orjson.loads(string)
182
- except Exception:
183
- print(traceback.format_exc())
184
- return None
185
-
186
- @staticmethod
187
- def sh_first_item(string: str) -> Any:
188
- """ Show first substring of string
189
- """
190
- return string.split()[0]
191
-
192
- @classmethod
193
- def sh_a_int(cls, string: str, sep: str) -> TyArr:
194
- """ Show first substring of string
195
- """
196
- # arr = string.split(sep)
197
- arr = re.split(sep, string)
198
- arr_new = []
199
- for item in arr:
200
- _item = item.strip()
201
- if not isinstance(_item, str):
202
- continue
203
- if not _item.isdigit():
204
- continue
205
- arr_new.append(cls.sh_int(_item))
206
- return arr_new
207
-
208
- @classmethod
209
- def sh_a_str(
210
- cls, string: str, sep: str, a_exclude: TnArr = None) -> Any:
211
- """ Show first substring of string
212
- """
213
- # arr = string.split(sep)
214
- arr = re.split(sep, string)
215
-
216
- if a_exclude is None:
217
- _arr = arr
218
- else:
219
- _arr = []
220
- for item in arr:
221
- _item = item.strip()
222
- if _item not in a_exclude:
223
- _arr.append(_item)
224
-
225
- arr_new = []
226
- for item in _arr:
227
- if isinstance(item, str):
228
- arr_new.append(item.strip())
229
- elif isinstance(item, int):
230
- arr_new.append(str(item))
231
- else:
232
- arr_new.append(item)
233
-
234
- return arr_new
235
-
236
- @classmethod
237
- def sh_a_obj(
238
- cls, string: str, sep: str, a_exclude: TnArr = None) -> Any:
239
- """ Show first substring of string
240
- """
241
- # arr = string.split(sep)
242
- arr = re.split(sep, string)
243
-
244
- if a_exclude is None:
245
- _arr = arr
246
- else:
247
- _arr = []
248
- for item in arr:
249
- _item = item.strip()
250
- if _item not in a_exclude:
251
- _arr.append(_item)
252
-
253
- arr_new: TyArr = []
254
- for item in _arr:
255
- if isinstance(item, str):
256
- _item = item.strip()
257
- if _item.isdigit():
258
- _item = cls.sh_int(_item)
259
- arr_new.append(_item)
260
- else:
261
- arr_new.append(_item)
262
- else:
263
- arr_new.append(item)
264
-
265
- return arr_new