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/__version__.py CHANGED
@@ -1,10 +1,10 @@
1
1
  __title__ = 'ka_uts_com'
2
2
  __description__ = 'Communication Utilities.'
3
3
  __url__ = 'https://ka-ut-com.readthedocs.io/en/latest'
4
- __version__ = '2.1.0.250408'
4
+ __version__ = '2.2.0.250427'
5
5
  __build__ = 0x022200
6
6
  __author__ = 'Bernd Stroehle'
7
7
  __author_email__ = 'bernd.stroehle@gmail.com'
8
8
  __license__ = 'Apache-2.0'
9
- __copyright__ = 'Copyright 2024 Bernd Stroehle'
9
+ __copyright__ = 'Copyright 2025 Bernd Stroehle'
10
10
  __cake__ = u'\u2728 \U0001f370 \u2728'
@@ -1,16 +1,14 @@
1
1
  # coding=utf-8
2
2
  from typing import Any
3
3
 
4
- from logging import Logger
5
-
6
- from ka_uts_com.utils.pacmod import PacMod
7
- from ka_uts_com.ioc.yaml_ import Yaml_
4
+ from ka_uts_log.log import Log
5
+ from ka_uts_uts.utils.pacmod import PacMod
6
+ from ka_uts_uts.ioc.yaml_ import Yaml_
8
7
 
9
8
  TyAny = Any
10
9
  TyArr = list[Any]
11
10
  TyBool = bool
12
11
  TyDic = dict[Any, Any]
13
- TyLogger = Logger
14
12
 
15
13
  TnAny = None | Any
16
14
  TnArr = None | TyArr
@@ -18,7 +16,7 @@ TnBool = None | bool
18
16
  TnDic = None | TyDic
19
17
 
20
18
 
21
- class App_:
19
+ class App:
22
20
  """Aplication Class
23
21
  """
24
22
  sw_init: TyBool = False
@@ -29,7 +27,7 @@ class App_:
29
27
  app: TyDic = {}
30
28
 
31
29
  @classmethod
32
- def init(cls, com, **kwargs) -> None:
30
+ def init(cls, cls_com, **kwargs) -> None:
33
31
  if cls.sw_init:
34
32
  return
35
33
  cls.sw_init = True
@@ -37,14 +35,14 @@ class App_:
37
35
  cls.sw_replace_keys = kwargs.get('sw_replace_keys', False)
38
36
  if cls.sw_replace_keys:
39
37
  try:
40
- cls.keys = Yaml_.read(PacMod.sh_path_keys(com), com.Log)
38
+ cls.keys = Yaml_.read_with_safeloader(PacMod.sh_path_keys(cls_com))
41
39
  except Exception as exc:
42
- com.Log.error(exc, exc_info=True)
40
+ Log.error(exc, exc_info=True)
43
41
  raise
44
42
 
45
43
  @classmethod
46
- def sh(cls, com, **kwargs) -> Any:
44
+ def sh(cls, cls_com, **kwargs) -> Any:
47
45
  if cls.sw_init:
48
46
  return cls
49
- cls.init(com, **kwargs)
47
+ cls.init(cls_com, **kwargs)
50
48
  return cls
@@ -1,36 +1,33 @@
1
1
  # coding=utf-8
2
2
  from typing import Any
3
3
 
4
- from logging import Logger
5
-
6
- from ka_uts_com.ioc.yaml_ import Yaml_
4
+ from ka_uts_uts.ioc.yaml_ import Yaml_
7
5
 
8
6
  TyAny = Any
9
7
  TyTimeStamp = int
10
8
  TyArr = list[Any]
11
9
  TyBool = bool
12
10
  TyDic = dict[Any, Any]
13
- TyLogger = Logger
14
11
 
15
12
 
16
- class Cfg_:
13
+ class Cfg:
17
14
  """Configuration Class
18
15
  """
19
16
  sw_init: TyBool = False
20
17
  cfg: Any = None
21
18
 
22
19
  @classmethod
23
- def init(cls, com, **kwargs) -> None:
20
+ def init(cls, cls_com, **kwargs) -> None:
24
21
  if cls.sw_init:
25
22
  return
26
23
  cls.sw_init = True
27
- _path = com.sh_path_cfg()
24
+ _path = cls_com.sh_path_cfg_yaml()
28
25
  if _path:
29
- cls.cfg = Yaml_.read(_path, com.Log)
26
+ cls.cfg = Yaml_.read_with_safeloader(_path)
30
27
 
31
28
  @classmethod
32
- def sh(cls, com, **kwargs) -> Any:
29
+ def sh(cls, cls_com, **kwargs) -> Any:
33
30
  if cls.sw_init:
34
31
  return cls
35
- cls.init(com, **kwargs)
32
+ cls.init(cls_com, **kwargs)
36
33
  return cls.cfg
ka_uts_com/com.py CHANGED
@@ -4,18 +4,17 @@ from typing import Any
4
4
  import os
5
5
  import time
6
6
  import calendar
7
- import logging
8
- import logging.config
9
- from logging import Logger
10
7
  from datetime import datetime
11
8
 
12
- from ka_uts_com.utils.aoeqstmt import AoEqStmt
13
- from ka_uts_com.utils.pac import Pac
14
- from ka_uts_com.utils.pacmod import PacMod
15
- from ka_uts_com.base.app_ import App_
16
- from ka_uts_com.base.cfg_ import Cfg_
17
- from ka_uts_com.base.exit_ import Exit_
18
- from ka_uts_com.base.log_ import Log_
9
+ from ka_uts_equ.equ import AoEqu
10
+ from ka_uts_uts.utils.pac import Pac
11
+ from ka_uts_uts.utils.pacmod import PacMod
12
+
13
+ from ka_uts_com.app import App
14
+ from ka_uts_com.cfg import Cfg
15
+ from ka_uts_com.exit import Exit
16
+
17
+ from ka_uts_log.log import Log
19
18
 
20
19
  TyAny = Any
21
20
  TyDateTime = datetime
@@ -23,7 +22,6 @@ TyTimeStamp = int
23
22
  TyArr = list[Any]
24
23
  TyBool = bool
25
24
  TyDic = dict[Any, Any]
26
- TyLogger = Logger
27
25
 
28
26
  TnAny = None | Any
29
27
  TnArr = None | TyArr
@@ -34,7 +32,8 @@ TnStr = None | str
34
32
 
35
33
 
36
34
  class Com:
37
- """Communication Class
35
+ """
36
+ Communication Class
38
37
  """
39
38
  sw_init: bool = False
40
39
  dir_dat: TnStr = None
@@ -54,14 +53,16 @@ class Com:
54
53
  ts_etime: TnDateTime = None
55
54
  d_timer: TyDic = {}
56
55
 
57
- cfg: TnDic = None
58
- Log = logging.getLogger('dummy_logger')
56
+ Cfg: TnDic = None
57
+ Log: Any = None
59
58
  App: Any = None
60
59
  Exit: Any = None
61
60
 
62
61
  @classmethod
63
- def init(cls, app_cls, kwargs: TyDic):
64
- """ set log and application (module) configuration
62
+ def init(cls, kwargs: TyDic):
63
+ # def init(cls, cls_app, kwargs: TyDic):
64
+ """
65
+ initialise static variables of Com class
65
66
  """
66
67
  if cls.sw_init:
67
68
  return
@@ -70,46 +71,53 @@ class Com:
70
71
  cls.tenant = kwargs.get('tenant')
71
72
  cls.log_type = kwargs.get('log_type', 'std')
72
73
  cls.cmd = kwargs.get('cmd')
74
+ cls_app = kwargs.get('cls_app')
73
75
  cls.d_com_pacmod = PacMod.sh_d_pacmod(cls)
74
- cls.d_app_pacmod = PacMod.sh_d_pacmod(app_cls)
76
+ cls.d_app_pacmod = PacMod.sh_d_pacmod(cls_app)
75
77
  cls.ts = calendar.timegm(time.gmtime())
76
78
  cls.pid = os.getpid()
77
79
 
78
80
  cls.path_bin = cls.sh_path_bin()
79
- cls.path_log_cfg = cls.sh_path_log_cfg()
80
81
 
81
- cls.Log = Log_.sh(cls, **kwargs)
82
- cls.cfg = Cfg_.sh(cls, **kwargs)
83
- cls.App = App_.sh(cls, **kwargs)
84
- cls.Exit = Exit_.sh(**kwargs)
82
+ cls.Log = Log.sh(**kwargs)
83
+ cls.Cfg = Cfg.sh(cls, **kwargs)
84
+ cls.App = App.sh(cls, **kwargs)
85
+ cls.Exit = Exit.sh(**kwargs)
85
86
 
86
87
  @classmethod
87
- def sh_kwargs(cls, app_cls, d_parms, *args) -> TyDic:
88
- _kwargs: TyDic = AoEqStmt.sh_d_eq(*args, d_parms=d_parms)
89
- cls.init(app_cls, _kwargs)
88
+ def sh_kwargs(cls, cls_app, d_parms, *args) -> TyDic:
89
+ """
90
+ show keyword arguments
91
+ """
92
+ _kwargs: TyDic = AoEqu.sh_d_eq(*args, d_parms=d_parms)
93
+ _kwargs['cls_app'] = cls_app
94
+ cls.init(_kwargs)
90
95
  _kwargs['com'] = cls
91
96
  return _kwargs
92
97
 
93
98
  @classmethod
94
99
  def sh_path_bin(cls) -> Any:
95
- """ show directory
96
100
  """
97
- package = cls.d_app_pacmod['package']
98
- path = "bin"
99
- return Pac.sh_path_by_package(package, path)
101
+ show path to bin directory in package
102
+ """
103
+ _package = cls.d_app_pacmod['package']
104
+ _path = 'bin'
105
+ return Pac.sh_path_by_package(_package, _path)
100
106
 
101
107
  @classmethod
102
- def sh_path_log_cfg(cls) -> Any:
103
- """ show directory
108
+ def sh_path_data(cls) -> Any:
104
109
  """
105
- _packages = [cls.d_app_pacmod['package'], cls.d_com_pacmod['package']]
106
- _path = f"data/log.{cls.log_type}.yml"
107
- return Pac.sh_path_by_packages(_packages, _path)
110
+ show path to data directory in package
111
+ """
112
+ _package = cls.d_app_pacmod['package']
113
+ _path = 'data'
114
+ return Pac.sh_path_by_package(_package, _path)
108
115
 
109
116
  @classmethod
110
- def sh_path_cfg(cls) -> Any:
111
- """ show directory
117
+ def sh_path_cfg_yaml(cls) -> Any:
118
+ """
119
+ show path to configuration yaml-file in data directory of package
112
120
  """
113
- package = cls.d_app_pacmod['package']
114
- path = 'data/cfg.yml'
115
- return Pac.sh_path_by_package(package, path)
121
+ _package = cls.d_app_pacmod['package']
122
+ _path = os.path.join('data', 'cfg.yml')
123
+ return Pac.sh_path_by_package(_package, _path)
@@ -12,7 +12,7 @@ TnBool = None | bool
12
12
  TnDic = None | TyDic
13
13
 
14
14
 
15
- class Exit_:
15
+ class Exit:
16
16
  """Exit Class
17
17
  """
18
18
  sw_init: TyBool = False
ka_uts_com/timer.py CHANGED
@@ -2,7 +2,7 @@
2
2
  from datetime import datetime
3
3
 
4
4
  from ka_uts_com.com import Com
5
- from ka_uts_com.log import Log
5
+ from ka_uts_log.log import Log
6
6
 
7
7
  from typing import Any
8
8
  TyAny = Any