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.
Files changed (59) hide show
  1. build/lib/ka_uts_com/__version__.py +1 -1
  2. build/lib/ka_uts_com/base/app_.py +50 -0
  3. build/lib/ka_uts_com/base/cfg_.py +35 -0
  4. build/lib/ka_uts_com/base/exit_.py +37 -0
  5. build/lib/ka_uts_com/base/log_.py +131 -0
  6. build/lib/ka_uts_com/com.py +91 -192
  7. build/lib/ka_uts_com/data/log.std.yml +107 -0
  8. build/lib/ka_uts_com/data/{log.standard.yml → log.usr.yml} +47 -27
  9. build/lib/ka_uts_com/decorators/dec.py +13 -0
  10. build/lib/ka_uts_com/fnc.py +29 -24
  11. build/lib/ka_uts_com/ioc/jinja2_.py +42 -0
  12. build/lib/ka_uts_com/ioc/yaml_.py +30 -0
  13. build/lib/ka_uts_com/log.py +48 -25
  14. build/lib/ka_uts_com/timer.py +24 -27
  15. build/lib/ka_uts_com/utils/aoeqstmt.py +37 -0
  16. build/lib/ka_uts_com/{date.py → utils/date.py} +4 -4
  17. build/lib/ka_uts_com/utils/doeq.py +99 -0
  18. build/lib/ka_uts_com/utils/pacmod.py +123 -0
  19. build/lib/ka_uts_com/{str.py → utils/str.py} +36 -39
  20. ka_uts_com/__version__.py +1 -1
  21. ka_uts_com/base/app_.py +50 -0
  22. ka_uts_com/base/cfg_.py +35 -0
  23. ka_uts_com/base/exit_.py +37 -0
  24. ka_uts_com/base/log_.py +131 -0
  25. ka_uts_com/com.py +91 -192
  26. ka_uts_com/data/log.std.yml +107 -0
  27. ka_uts_com/data/{log.standard.yml → log.usr.yml} +47 -27
  28. ka_uts_com/decorators/dec.py +13 -0
  29. ka_uts_com/fnc.py +29 -24
  30. ka_uts_com/ioc/jinja2_.py +42 -0
  31. ka_uts_com/ioc/yaml_.py +30 -0
  32. ka_uts_com/log.py +48 -25
  33. ka_uts_com/timer.py +24 -27
  34. ka_uts_com/utils/aoeqstmt.py +37 -0
  35. ka_uts_com/{date.py → utils/date.py} +4 -4
  36. ka_uts_com/utils/doeq.py +99 -0
  37. ka_uts_com/utils/pacmod.py +123 -0
  38. ka_uts_com/{str.py → utils/str.py} +36 -39
  39. ka_uts_com-2.0.0.250407.dist-info/METADATA +1611 -0
  40. ka_uts_com-2.0.0.250407.dist-info/RECORD +49 -0
  41. {ka_uts_com-1.0.0.240823.dist-info → ka_uts_com-2.0.0.250407.dist-info}/WHEEL +1 -1
  42. {ka_uts_com-1.0.0.240823.dist-info → ka_uts_com-2.0.0.250407.dist-info/licenses}/LICENSE.txt +1 -2
  43. build/lib/dist/ka_uts_com-1.0.0.240823-py3-none-any.whl +0 -0
  44. build/lib/dist/ka_uts_com-1.0.0.240823.tar.gz +0 -0
  45. build/lib/ka_uts_com/aeq.py +0 -87
  46. build/lib/ka_uts_com/argv.py +0 -49
  47. build/lib/ka_uts_com/data/log.personal.yml +0 -93
  48. build/lib/ka_uts_com/ioc.py +0 -57
  49. build/lib/ka_uts_com/pacmod.py +0 -111
  50. dist/ka_uts_com-1.0.0.240823-py3-none-any.whl +0 -0
  51. dist/ka_uts_com-1.0.0.240823.tar.gz +0 -0
  52. ka_uts_com/aeq.py +0 -87
  53. ka_uts_com/argv.py +0 -49
  54. ka_uts_com/data/log.personal.yml +0 -93
  55. ka_uts_com/ioc.py +0 -57
  56. ka_uts_com/pacmod.py +0 -111
  57. ka_uts_com-1.0.0.240823.dist-info/METADATA +0 -943
  58. ka_uts_com-1.0.0.240823.dist-info/RECORD +0 -41
  59. {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
- from typing import Any, List, Dict
10
+ TyArr = list[Any]
11
+ TyDic = dict[Any, Any]
12
+ TyAoA = list[TyArr]
10
13
 
11
- T_Arr = List[Any]
12
- T_Dic = Dict[Any, Any]
13
- T_AoA = List[T_Arr]
14
-
15
- TN_Int = None | int
16
- TN_Float = None | float
17
- TN_Str = None | str
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: TN_Str = None) -> TN_Datetime:
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: TN_Datetime = datetime.strptime(string, fmt)
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
- else:
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: TN_Str) -> bool:
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: TN_Str) -> TN_Str:
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: T_Arr) -> str:
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
- if string.lower() == 'true':
126
- return True
127
- elif string.lower() == 'false':
128
- return False
129
- else:
130
- raise ValueError
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) -> TN_Float:
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) -> TN_Int:
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) -> TN_Dic:
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
- dic = simplejson.loads(string, use_decimal=True)
159
+ return simplejson.loads(string, use_decimal=True)
161
160
  else:
162
- dic = orjson.loads(string)
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) -> TN_Arr:
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) -> TN_AoA:
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) -> T_Arr:
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: TN_Arr = None) -> Any:
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: TN_Arr = None) -> Any:
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: T_Arr = []
253
+ arr_new: TyArr = []
257
254
  for item in _arr:
258
255
  if isinstance(item, str):
259
256
  _item = item.strip()