ka-uts-com 1.0.0.240823__py3-none-any.whl → 1.0.1.250131__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 (61) hide show
  1. build/lib/dist/ka_uts_com-1.0.1.250131-py3-none-any.whl +0 -0
  2. build/lib/dist/ka_uts_com-1.0.1.250131.tar.gz +0 -0
  3. build/lib/ka_uts_com/__version__.py +1 -1
  4. build/lib/ka_uts_com/base/app_.py +51 -0
  5. build/lib/ka_uts_com/base/cfg_.py +27 -0
  6. build/lib/ka_uts_com/base/exit_.py +37 -0
  7. build/lib/ka_uts_com/base/log_.py +115 -0
  8. build/lib/ka_uts_com/com.py +42 -192
  9. build/lib/ka_uts_com/data/{log.standard.yml → log.std.yml} +3 -3
  10. build/lib/ka_uts_com/data/{log.personal.yml → log.usr.yml} +34 -42
  11. build/lib/ka_uts_com/decorators/dec.py +13 -0
  12. build/lib/ka_uts_com/fnc.py +29 -24
  13. build/lib/ka_uts_com/ioc/jinja2_.py +42 -0
  14. build/lib/ka_uts_com/ioc/yaml_.py +30 -0
  15. build/lib/ka_uts_com/log.py +32 -20
  16. build/lib/ka_uts_com/timer.py +17 -24
  17. build/lib/ka_uts_com/utils/aoeqstmt.py +39 -0
  18. build/lib/ka_uts_com/{date.py → utils/date.py} +4 -4
  19. build/lib/ka_uts_com/utils/doeq.py +99 -0
  20. {ka_uts_com → build/lib/ka_uts_com/utils}/pacmod.py +30 -34
  21. build/lib/ka_uts_com/utils/py.typed +0 -0
  22. build/lib/ka_uts_com/{str.py → utils/str.py} +36 -39
  23. dist/ka_uts_com-1.0.1.250131-py3-none-any.whl +0 -0
  24. dist/ka_uts_com-1.0.1.250131.tar.gz +0 -0
  25. ka_uts_com/__version__.py +1 -1
  26. ka_uts_com/base/app_.py +51 -0
  27. ka_uts_com/base/cfg_.py +27 -0
  28. ka_uts_com/base/exit_.py +37 -0
  29. ka_uts_com/base/log_.py +115 -0
  30. ka_uts_com/com.py +42 -192
  31. ka_uts_com/data/{log.standard.yml → log.std.yml} +3 -3
  32. ka_uts_com/data/{log.personal.yml → log.usr.yml} +34 -42
  33. ka_uts_com/decorators/dec.py +13 -0
  34. ka_uts_com/fnc.py +29 -24
  35. ka_uts_com/ioc/jinja2_.py +42 -0
  36. ka_uts_com/ioc/yaml_.py +30 -0
  37. ka_uts_com/log.py +32 -20
  38. ka_uts_com/timer.py +17 -24
  39. ka_uts_com/utils/aoeqstmt.py +39 -0
  40. ka_uts_com/{date.py → utils/date.py} +4 -4
  41. ka_uts_com/utils/doeq.py +99 -0
  42. {build/lib/ka_uts_com → ka_uts_com/utils}/pacmod.py +30 -34
  43. ka_uts_com/utils/py.typed +0 -0
  44. ka_uts_com/{str.py → utils/str.py} +36 -39
  45. ka_uts_com-1.0.1.250131.dist-info/METADATA +1628 -0
  46. ka_uts_com-1.0.1.250131.dist-info/RECORD +55 -0
  47. {ka_uts_com-1.0.0.240823.dist-info → ka_uts_com-1.0.1.250131.dist-info}/WHEEL +1 -1
  48. build/lib/dist/ka_uts_com-1.0.0.240823-py3-none-any.whl +0 -0
  49. build/lib/dist/ka_uts_com-1.0.0.240823.tar.gz +0 -0
  50. build/lib/ka_uts_com/aeq.py +0 -87
  51. build/lib/ka_uts_com/argv.py +0 -49
  52. build/lib/ka_uts_com/ioc.py +0 -57
  53. dist/ka_uts_com-1.0.0.240823-py3-none-any.whl +0 -0
  54. dist/ka_uts_com-1.0.0.240823.tar.gz +0 -0
  55. ka_uts_com/aeq.py +0 -87
  56. ka_uts_com/argv.py +0 -49
  57. ka_uts_com/ioc.py +0 -57
  58. ka_uts_com-1.0.0.240823.dist-info/METADATA +0 -943
  59. ka_uts_com-1.0.0.240823.dist-info/RECORD +0 -41
  60. {ka_uts_com-1.0.0.240823.dist-info → ka_uts_com-1.0.1.250131.dist-info/licenses}/LICENSE.txt +0 -0
  61. {ka_uts_com-1.0.0.240823.dist-info → ka_uts_com-1.0.1.250131.dist-info}/top_level.txt +0 -0
ka_uts_com/timer.py CHANGED
@@ -1,25 +1,22 @@
1
1
  # coding=utf-8
2
-
3
2
  from datetime import datetime
4
3
 
5
4
  from ka_uts_com.com import Com
6
5
  from ka_uts_com.log import Log
7
6
 
8
- from typing import Any, List
9
-
10
- T_Any = Any
11
- T_Arr = List[Any]
12
- T_Str = str
13
-
14
- TN_Any = None | T_Any
15
- TN_Str = None | T_Str
7
+ from typing import Any
8
+ TyAny = Any
9
+ TyArr = list[Any]
10
+ TyDic = dict[Any, Any]
11
+ TyStr = str
12
+ TnAny = None | TyAny
13
+ TnStr = None | TyStr
16
14
 
17
15
 
18
16
  class Timestamp:
19
17
 
20
18
  @staticmethod
21
- def sh_elapse_time_sec(
22
- end: Any, start: TN_Any) -> TN_Any:
19
+ def sh_elapse_time_sec(end: Any, start: TnAny) -> TnAny:
23
20
  if start is None:
24
21
  return None
25
22
  return end.timestamp()-start.timestamp()
@@ -29,12 +26,11 @@ class Timer:
29
26
  """ Timer Management
30
27
  """
31
28
  @staticmethod
32
- def sh_task_id(
33
- class_id: Any, parms: TN_Any, separator: T_Str) -> T_Str:
29
+ def sh_task_id(d_pacmod: TyDic, class_id: Any, parms: TnAny, sep: TyStr) -> TyStr:
34
30
  """ start Timer
35
31
  """
36
- package = Com.pacmod_curr['package']
37
- module = Com.pacmod_curr['module']
32
+ package = d_pacmod.get('package')
33
+ module = d_pacmod.get('module')
38
34
  if isinstance(class_id, str):
39
35
  class_name = class_id
40
36
  else:
@@ -43,28 +39,25 @@ class Timer:
43
39
  parms = ""
44
40
  else:
45
41
  parms = f" {parms}"
46
- arr: T_Arr = []
42
+ arr: TyArr = []
47
43
  for item in [package, module, class_name, parms]:
48
44
  if not item:
49
45
  continue
50
46
  arr.append(item)
51
- return separator.join(arr)
47
+ return sep.join(arr)
52
48
 
53
49
  @classmethod
54
- def start(
55
- cls, class_id: T_Any,
56
- parms: TN_Any = None, separator: T_Str = ".") -> None:
50
+ def start(cls, class_id: TyAny, parms: TnAny = None, sep: TyStr = ".") -> None:
57
51
  """ start Timer
58
52
  """
59
- task_id = cls.sh_task_id(class_id, parms, separator)
53
+ task_id = cls.sh_task_id(Com.d_pacmod, class_id, parms, sep)
60
54
  Com.d_timer[task_id] = datetime.now()
61
55
 
62
56
  @classmethod
63
- def end(cls, class_id: T_Any,
64
- parms: TN_Any = None, separator: T_Str = ".") -> None:
57
+ def end(cls, class_id: TyAny, parms: TnAny = None, sep: TyStr = ".") -> None:
65
58
  """ end Timer
66
59
  """
67
- task_id = cls.sh_task_id(class_id, parms, separator)
60
+ task_id = cls.sh_task_id(Com.d_pacmod, class_id, parms, sep)
68
61
  start = Com.d_timer.get(task_id)
69
62
  end = datetime.now()
70
63
  elapse_time_sec = Timestamp.sh_elapse_time_sec(end, start)
@@ -0,0 +1,39 @@
1
+ # coding=utf-8
2
+ from ka_uts_com.utils.doeq import DoEq
3
+
4
+ from typing import Any
5
+ TyArr = list[Any]
6
+ TyDic = dict[Any, Any]
7
+
8
+ TnArr = None | TyArr
9
+ TnDic = None | TyDic
10
+ TnStr = None | str
11
+
12
+
13
+ class AoEqStmt:
14
+ """ Dictionary of Equates
15
+ """
16
+ @staticmethod
17
+ def init_d_eq(a_eqstmt: TyArr) -> TyDic:
18
+ d_eq = {}
19
+ for s_eq in a_eqstmt[1:]:
20
+ a_eq = s_eq.split('=')
21
+ if len(a_eq) == 1:
22
+ d_eq['cmd'] = a_eq[0]
23
+ else:
24
+ d_eq[a_eq[0]] = a_eq[1]
25
+ d_eq[a_eq[0]] = a_eq[1]
26
+ return d_eq
27
+
28
+ @classmethod
29
+ def sh_d_eq(cls, a_eqstmt: TyArr, **kwargs) -> TyDic:
30
+ """ show equates dictionary
31
+ """
32
+ root_cls = kwargs.get('root_cls')
33
+ d_parms: TnDic = kwargs.get('d_parms')
34
+ _sh_prof = kwargs.get('sh_prof')
35
+ d_eq: TyDic = cls.init_d_eq(a_eqstmt)
36
+ d_eq_new: TyDic = DoEq.verify(d_eq, d_parms)
37
+ DoEq._set_d_pacmod(d_eq_new, root_cls)
38
+ DoEq._set_sh_prof(d_eq_new, _sh_prof)
39
+ return d_eq_new
@@ -1,15 +1,15 @@
1
1
  from datetime import datetime
2
2
  from datetime import date
3
3
 
4
- T_Date = date
5
- TN_Date = None | T_Date
6
- TN_Str = None | str
4
+ TyDate = date
5
+ TnDate = None | TyDate
6
+ TnStr = None | str
7
7
 
8
8
 
9
9
  class Date:
10
10
 
11
11
  @staticmethod
12
- def sh(datestring: TN_Str, fmt: str) -> TN_Date:
12
+ def sh(datestring: TnStr, fmt: str) -> TnDate:
13
13
  if not datestring:
14
14
  return None
15
15
  return datetime.strptime(datestring, fmt).date()
@@ -0,0 +1,99 @@
1
+ # coding=utf-8
2
+ from collections.abc import Callable
3
+ from typing import Any
4
+
5
+ from ka_uts_com.utils.pacmod import PacMod
6
+ from ka_uts_com.utils.str import Str
7
+ from ka_uts_com.utils.date import Date
8
+
9
+
10
+ TyArr = list[Any]
11
+ TyCall = Callable[..., Any]
12
+ TyDic = dict[Any, Any]
13
+ TyStr = str
14
+
15
+ TnArr = None | TyArr
16
+ TnDic = None | TyDic
17
+ TnStr = None | TyStr
18
+
19
+
20
+ class DoEq:
21
+ """ Manage Commandline Arguments
22
+ """
23
+ @classmethod
24
+ def sh_value(cls, key: str, value: Any, d_valid_parms: TnDic) -> Any:
25
+
26
+ # print(f"key = {key}, type(key) = {type(key)}")
27
+ # print(f"value = {value}, type(value) = {type(value)}")
28
+ if not d_valid_parms:
29
+ return value
30
+ _type: TnStr = d_valid_parms.get(key)
31
+ # print(f"_type = {_type}")
32
+ if not _type:
33
+ return value
34
+ if isinstance(_type, str):
35
+ match _type:
36
+ case 'int':
37
+ value = int(value)
38
+ case 'bool':
39
+ value = Str.sh_boolean(value)
40
+ case 'dict':
41
+ value = Str.sh_dic(value)
42
+ case 'list':
43
+ value = Str.sh_arr(value)
44
+ case '%Y-%m-%d':
45
+ value = Date.sh(value, _type)
46
+ case '_':
47
+ match _type[0]:
48
+ case '[', '{':
49
+ _obj = Str.sh_dic(_type)
50
+ if value not in _obj:
51
+ msg = (f"parameter={key} value={value} is invalid; "
52
+ f"valid values are={_obj}")
53
+ raise Exception(msg)
54
+
55
+ # print(f"value = {value}, type(value) = {type(value)}")
56
+ return value
57
+
58
+ @staticmethod
59
+ def _set_d_pacmod(d_eq: TyDic, root_cls) -> None:
60
+ """ set current pacmod dictionary
61
+ """
62
+ tenant = d_eq.get('tenant')
63
+ d_eq['d_pacmod'] = PacMod.sh_d_pacmod(root_cls, tenant)
64
+
65
+ @staticmethod
66
+ def _set_sh_prof(d_eq: TyDic, sh_prof: TyCall | Any) -> None:
67
+ """ set current pacmod dictionary
68
+ """
69
+ if callable(sh_prof):
70
+ d_eq['sh_prof'] = sh_prof()
71
+ else:
72
+ d_eq['sh_prof'] = sh_prof
73
+
74
+ @classmethod
75
+ def verify(cls, d_eq: TyDic, d_parms: TnDic) -> TyDic:
76
+ if d_parms is None:
77
+ return d_eq
78
+ if 'cmd' in d_eq:
79
+ _d_valid_parms = d_parms
80
+ _cmd = d_eq['cmd']
81
+ _valid_commands = list(d_parms.keys())
82
+ if _cmd not in _valid_commands:
83
+ msg = (f"Wrong command: {_cmd}; "
84
+ f"valid commands are: {_valid_commands}")
85
+ raise Exception(msg)
86
+ _d_valid_parms = d_parms[_cmd]
87
+ else:
88
+ _d_valid_parms = d_parms
89
+ if _d_valid_parms is None:
90
+ return d_eq
91
+
92
+ d_eq_new = {}
93
+ for key, value in d_eq.items():
94
+ if key not in _d_valid_parms:
95
+ msg = (f"Wrong parameter: {key}; "
96
+ f"valid parameters are: {_d_valid_parms}")
97
+ raise Exception(msg)
98
+ d_eq_new[key] = cls.sh_value(key, value, _d_valid_parms)
99
+ return d_eq_new
@@ -1,26 +1,25 @@
1
1
  # coding=utf-8
2
+ from typing import Any
2
3
 
3
4
  from os import path as os_path
4
5
  import pkg_resources
5
6
 
6
- from typing import Any, Dict, List
7
+ TyArr = list[Any]
8
+ TyDic = dict[Any, Any]
9
+ TnDic = None | TyDic
7
10
 
8
- T_Arr = List[Any]
9
- T_Dic = Dict[Any, Any]
10
11
 
11
- TN_Dic = None | T_Dic
12
-
13
-
14
- class Pacmod:
12
+ class PacMod:
15
13
  """ Package Module Management
16
14
  """
17
- def sh_d_pacmod(root_cls, tenant: Any) -> T_Dic:
15
+ @staticmethod
16
+ def sh_d_pacmod(root_cls, tenant: Any) -> TyDic:
18
17
  """ Show Pacmod Dictionary
19
18
  """
20
- a_pacmod: T_Arr = root_cls.__module__.split(".")
19
+ a_pacmod: TyArr = root_cls.__module__.split(".")
21
20
  package = a_pacmod[0]
22
21
  module = a_pacmod[1]
23
- d_pacmod: T_Dic = {}
22
+ d_pacmod: TyDic = {}
24
23
  d_pacmod['tenant'] = tenant
25
24
  d_pacmod['package'] = package
26
25
  d_pacmod['module'] = module
@@ -30,42 +29,42 @@ class Pacmod:
30
29
  # """ Configuration Sub Class of Package Module Class
31
30
  # """
32
31
  @staticmethod
33
- def sh_path_cfg_yaml(pacmod: T_Dic) -> str:
32
+ def sh_path_cfg_yaml(d_pacmod: TyDic) -> str:
34
33
  """ show directory
35
34
  """
36
- package = pacmod['package']
37
- module = pacmod['module']
35
+ package = d_pacmod['package']
36
+ module = d_pacmod['module']
38
37
 
39
- dir: str = f"{package}.data"
38
+ directory: str = f"{package}.data"
40
39
 
41
40
  # print(f"dir = {dir}")
42
41
  # print(f"package = {package}")
43
42
  # print(f"module = {module}")
44
43
 
45
- path = pkg_resources.resource_filename(dir, f"{module}.yml")
44
+ path: str = pkg_resources.resource_filename(directory, f"{module}.yml")
46
45
  return path
47
46
 
48
47
  @staticmethod
49
48
  def sh_path_keys_yaml(
50
- pacmod: Any, filename: str = 'keys.yml') -> str:
49
+ d_pacmod: TyDic, filename: str = 'keys.yml') -> str:
51
50
  """ show directory
52
51
  """
53
- package = pacmod['package']
54
- dir = f"{package}.data"
55
- path = pkg_resources.resource_filename(dir, filename)
52
+ package = d_pacmod['package']
53
+ directory = f"{package}.data"
54
+ path: str = pkg_resources.resource_filename(directory, filename)
56
55
  return path
57
56
 
58
57
  @staticmethod
59
- def sh_pacmod_type(pacmod: Dict, type_: str) -> str:
58
+ def sh_pacmod_type(d_pacmod: TyDic, type_: str) -> str:
60
59
  """ show Data File Path
61
60
  """
62
- package = pacmod['package']
63
- module = pacmod['module']
61
+ package = d_pacmod['package']
62
+ module = d_pacmod['module']
64
63
  return f"/data/{package}/{module}/{type_}"
65
64
 
66
65
  @classmethod
67
66
  def sh_file_path(
68
- cls, pacmod: T_Dic, type_: str, suffix: str,
67
+ cls, d_pacmod: TyDic, type_: str, suffix: str,
69
68
  pid: Any, ts: Any, **kwargs) -> str:
70
69
  """ show type specific path
71
70
  """
@@ -79,11 +78,8 @@ class Pacmod:
79
78
  if sw_run_pid_ts is None:
80
79
  sw_run_pid_ts = True
81
80
 
82
- # _dir: str = cls.Data.Dir.sh(pacmod, type)
83
- _dir: str = cls.sh_pacmod_type(pacmod, type_)
81
+ _dir: str = cls.sh_pacmod_type(d_pacmod, type_)
84
82
  if sw_run_pid_ts:
85
- # pid = str(Com.pid)
86
- # ts = str(Com.ts_start)
87
83
  file_path = os_path.join(
88
84
  _dir, f"{filename_}_{pid}_{ts}.{suffix}")
89
85
  else:
@@ -92,20 +88,20 @@ class Pacmod:
92
88
 
93
89
  @classmethod
94
90
  def sh_pattern(
95
- cls, pacmod: T_Dic, type_: str, suffix: str, **kwargs) -> str:
91
+ cls, d_pacmod: TyDic, type_: str, suffix: str, **kwargs) -> str:
96
92
  """ show type specific path
97
93
  """
98
94
  filename = kwargs.get('filename')
99
- _dir: str = cls.sh_pacmod_type(pacmod, type_)
100
- path = os_path.join(_dir, f"{filename}*.{suffix}")
95
+ _directory: str = cls.sh_pacmod_type(d_pacmod, type_)
96
+ path = os_path.join(_directory, f"{filename}*.{suffix}")
101
97
  return path
102
98
 
103
99
  @staticmethod
104
- def sh_path_cfg_log(pacmod: TN_Dic = None, filename: str = 'log.yml'):
100
+ def sh_path_cfg_log(d_pacmod: TnDic = None, filename: str = 'log.yml'):
105
101
  """ show directory
106
102
  """
107
- if pacmod is None:
108
- pacmod = {'package': 'ka_uts_com', 'module': 'com'}
103
+ if d_pacmod is None:
104
+ d_pacmod = {'package': 'ka_uts_com', 'module': 'com'}
109
105
  return pkg_resources.resource_filename(
110
- f"{pacmod['package']}.data", filename
106
+ f"{d_pacmod['package']}.data", filename
111
107
  )
File without changes
@@ -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()