ka-uts-com 2.0.0.250407__py3-none-any.whl → 2.1.1.250415__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 (48) hide show
  1. ka_uts_com/__version__.py +1 -1
  2. ka_uts_com/{base/app_.py → app.py} +8 -8
  3. ka_uts_com/{base/cfg_.py → cfg.py} +8 -7
  4. ka_uts_com/com.py +47 -47
  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.1.1.250415.dist-info/METADATA +910 -0
  8. ka_uts_com-2.1.1.250415.dist-info/RECORD +14 -0
  9. {ka_uts_com-2.0.0.250407.dist-info → ka_uts_com-2.1.1.250415.dist-info}/top_level.txt +0 -1
  10. build/lib/ka_uts_com/__init__.py +0 -0
  11. build/lib/ka_uts_com/__version__.py +0 -10
  12. build/lib/ka_uts_com/base/app_.py +0 -50
  13. build/lib/ka_uts_com/base/cfg_.py +0 -35
  14. build/lib/ka_uts_com/base/log_.py +0 -131
  15. build/lib/ka_uts_com/com.py +0 -121
  16. build/lib/ka_uts_com/data/__init__.py +0 -0
  17. build/lib/ka_uts_com/data/log.std.yml +0 -107
  18. build/lib/ka_uts_com/data/log.usr.yml +0 -106
  19. build/lib/ka_uts_com/decorators/dec.py +0 -13
  20. build/lib/ka_uts_com/fnc.py +0 -42
  21. build/lib/ka_uts_com/ioc/jinja2_.py +0 -42
  22. build/lib/ka_uts_com/ioc/yaml_.py +0 -30
  23. build/lib/ka_uts_com/log.py +0 -86
  24. build/lib/ka_uts_com/py.typed +0 -0
  25. build/lib/ka_uts_com/timer.py +0 -69
  26. build/lib/ka_uts_com/utils/aoeqstmt.py +0 -37
  27. build/lib/ka_uts_com/utils/date.py +0 -15
  28. build/lib/ka_uts_com/utils/doeq.py +0 -99
  29. build/lib/ka_uts_com/utils/pacmod.py +0 -123
  30. build/lib/ka_uts_com/utils/str.py +0 -265
  31. ka_uts_com/base/exit_.py +0 -37
  32. ka_uts_com/base/log_.py +0 -131
  33. ka_uts_com/data/__init__.py +0 -0
  34. ka_uts_com/data/log.std.yml +0 -107
  35. ka_uts_com/data/log.usr.yml +0 -106
  36. ka_uts_com/fnc.py +0 -42
  37. ka_uts_com/ioc/jinja2_.py +0 -42
  38. ka_uts_com/ioc/yaml_.py +0 -30
  39. ka_uts_com/log.py +0 -86
  40. ka_uts_com/utils/aoeqstmt.py +0 -37
  41. ka_uts_com/utils/date.py +0 -15
  42. ka_uts_com/utils/doeq.py +0 -99
  43. ka_uts_com/utils/pacmod.py +0 -123
  44. ka_uts_com/utils/str.py +0 -265
  45. ka_uts_com-2.0.0.250407.dist-info/METADATA +0 -1611
  46. ka_uts_com-2.0.0.250407.dist-info/RECORD +0 -49
  47. {ka_uts_com-2.0.0.250407.dist-info → ka_uts_com-2.1.1.250415.dist-info}/WHEEL +0 -0
  48. {ka_uts_com-2.0.0.250407.dist-info → ka_uts_com-2.1.1.250415.dist-info}/licenses/LICENSE.txt +0 -0
ka_uts_com/__version__.py CHANGED
@@ -1,7 +1,7 @@
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.0.0.250407'
4
+ __version__ = '2.1.1.250415'
5
5
  __build__ = 0x022200
6
6
  __author__ = 'Bernd Stroehle'
7
7
  __author_email__ = 'bernd.stroehle@gmail.com'
@@ -3,8 +3,8 @@ from typing import Any
3
3
 
4
4
  from logging import Logger
5
5
 
6
- from ka_uts_com.utils.pacmod import PacMod
7
- from ka_uts_com.ioc.yaml_ import Yaml_
6
+ from ka_uts_uts.utils.pacmod import PacMod
7
+ from ka_uts_uts.ioc.yaml_ import Yaml_
8
8
 
9
9
  TyAny = Any
10
10
  TyArr = list[Any]
@@ -18,7 +18,7 @@ TnBool = None | bool
18
18
  TnDic = None | TyDic
19
19
 
20
20
 
21
- class App_:
21
+ class App:
22
22
  """Aplication Class
23
23
  """
24
24
  sw_init: TyBool = False
@@ -29,7 +29,7 @@ class App_:
29
29
  app: TyDic = {}
30
30
 
31
31
  @classmethod
32
- def init(cls, com, **kwargs) -> None:
32
+ def init(cls, cls_com, **kwargs) -> None:
33
33
  if cls.sw_init:
34
34
  return
35
35
  cls.sw_init = True
@@ -37,14 +37,14 @@ class App_:
37
37
  cls.sw_replace_keys = kwargs.get('sw_replace_keys', False)
38
38
  if cls.sw_replace_keys:
39
39
  try:
40
- cls.keys = Yaml_.read(PacMod.sh_path_keys(com), com.Log)
40
+ cls.keys = Yaml_.read(PacMod.sh_path_keys(cls_com), cls_com.Log)
41
41
  except Exception as exc:
42
- com.Log.error(exc, exc_info=True)
42
+ cls_com.Log.error(exc, exc_info=True)
43
43
  raise
44
44
 
45
45
  @classmethod
46
- def sh(cls, com, **kwargs) -> Any:
46
+ def sh(cls, cls_com, **kwargs) -> Any:
47
47
  if cls.sw_init:
48
48
  return cls
49
- cls.init(com, **kwargs)
49
+ cls.init(cls_com, **kwargs)
50
50
  return cls
@@ -3,8 +3,7 @@ from typing import Any
3
3
 
4
4
  from logging import Logger
5
5
 
6
- from ka_uts_com.utils.pacmod import PacMod
7
- from ka_uts_com.ioc.yaml_ import Yaml_
6
+ from ka_uts_uts.ioc.yaml_ import Yaml_
8
7
 
9
8
  TyAny = Any
10
9
  TyTimeStamp = int
@@ -14,22 +13,24 @@ TyDic = dict[Any, Any]
14
13
  TyLogger = Logger
15
14
 
16
15
 
17
- class Cfg_:
16
+ class Cfg:
18
17
  """Configuration Class
19
18
  """
20
19
  sw_init: TyBool = False
21
20
  cfg: Any = None
22
21
 
23
22
  @classmethod
24
- def init(cls, com, **kwargs) -> None:
23
+ def init(cls, cls_com, **kwargs) -> None:
25
24
  if cls.sw_init:
26
25
  return
27
26
  cls.sw_init = True
28
- cls.cfg = Yaml_.read(PacMod.sh_path_cfg(com), com.Log)
27
+ _path = cls_com.sh_path_cfg_yaml()
28
+ if _path:
29
+ cls.cfg = Yaml_.read(_path, cls_com.Log)
29
30
 
30
31
  @classmethod
31
- def sh(cls, com, **kwargs) -> Any:
32
+ def sh(cls, cls_com, **kwargs) -> Any:
32
33
  if cls.sw_init:
33
34
  return cls
34
- cls.init(com, **kwargs)
35
+ cls.init(cls_com, **kwargs)
35
36
  return cls.cfg
ka_uts_com/com.py CHANGED
@@ -4,18 +4,18 @@ from typing import Any
4
4
  import os
5
5
  import time
6
6
  import calendar
7
- import importlib.resources as resources
8
- import logging
9
- import logging.config
10
- from logging import Logger
11
7
  from datetime import datetime
12
8
 
13
- from ka_uts_com.utils.aoeqstmt import AoEqStmt
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_uts.utils.aoeqstmt import AoEqStmt
10
+ from ka_uts_arr.aoeqstmt import AoEqStmt
11
+ from ka_uts_uts.utils.pac import Pac
12
+ from ka_uts_uts.utils.pacmod import PacMod
13
+
14
+ from ka_uts_com.app import App
15
+ from ka_uts_com.cfg import Cfg
16
+ from ka_uts_com.exit import Exit
17
+
18
+ from ka_uts_log.log import Log
19
19
 
20
20
  TyAny = Any
21
21
  TyDateTime = datetime
@@ -23,7 +23,6 @@ TyTimeStamp = int
23
23
  TyArr = list[Any]
24
24
  TyBool = bool
25
25
  TyDic = dict[Any, Any]
26
- TyLogger = Logger
27
26
 
28
27
  TnAny = None | Any
29
28
  TnArr = None | TyArr
@@ -34,7 +33,8 @@ TnStr = None | str
34
33
 
35
34
 
36
35
  class Com:
37
- """Communication Class
36
+ """
37
+ Communication Class
38
38
  """
39
39
  sw_init: bool = False
40
40
  dir_dat: TnStr = None
@@ -54,14 +54,15 @@ class Com:
54
54
  ts_etime: TnDateTime = None
55
55
  d_timer: TyDic = {}
56
56
 
57
- cfg: TnDic = None
58
- Log = logging.getLogger('dummy_logger')
57
+ Cfg: TnDic = None
58
+ Log: Any = None
59
59
  App: Any = None
60
60
  Exit: Any = None
61
61
 
62
62
  @classmethod
63
- def init(cls, app_cls, kwargs: TyDic):
64
- """ set log and application (module) configuration
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
@@ -71,51 +72,50 @@ class Com:
71
72
  cls.log_type = kwargs.get('log_type', 'std')
72
73
  cls.cmd = kwargs.get('cmd')
73
74
  cls.d_com_pacmod = PacMod.sh_d_pacmod(cls)
74
- cls.d_app_pacmod = PacMod.sh_d_pacmod(app_cls)
75
-
75
+ cls.d_app_pacmod = PacMod.sh_d_pacmod(cls_app)
76
76
  cls.ts = calendar.timegm(time.gmtime())
77
77
  cls.pid = os.getpid()
78
78
 
79
- # print(f"Com.init cls.tenanat = {cls.tenant}")
80
- # print(f"Com.init cls.cmd = {cls.cmd}")
81
- # print(f"Com.init kwargs = {kwargs}")
82
-
83
- cls.set_path_bin()
84
- cls.set_path_log_cfg()
79
+ cls.path_bin = cls.sh_path_bin()
85
80
 
86
- cls.Log = Log_.sh(cls, **kwargs)
87
- cls.cfg = Cfg_.sh(cls, **kwargs)
88
- cls.App = App_.sh(cls, **kwargs)
89
- cls.Exit = Exit_.sh(**kwargs)
81
+ cls.Log = Log.sh(cls_app, **kwargs)
82
+ cls.Cfg = Cfg.sh(cls, **kwargs)
83
+ cls.App = App.sh(cls, **kwargs)
84
+ cls.Exit = Exit.sh(**kwargs)
90
85
 
91
86
  @classmethod
92
- def sh_kwargs(cls, app_cls, d_parms, *args) -> TyDic:
87
+ def sh_kwargs(cls, cls_app, d_parms, *args) -> TyDic:
88
+ """
89
+ show keyword arguments
90
+ """
93
91
  _kwargs: TyDic = AoEqStmt.sh_d_eq(*args, d_parms=d_parms)
94
- cls.init(app_cls, _kwargs)
92
+ cls.init(cls_app, _kwargs)
95
93
  _kwargs['com'] = cls
96
94
  return _kwargs
97
95
 
98
96
  @classmethod
99
- def set_path_bin(cls):
100
- """ show directory
97
+ def sh_path_bin(cls) -> Any:
98
+ """
99
+ show path to bin directory in package
101
100
  """
102
101
  package = cls.d_app_pacmod['package']
103
- path = resources.files(package).joinpath("bin")
104
- if path.is_file():
105
- cls.path_bin = path
106
- # raise ModuleNotFoundError
102
+ path = "bin"
103
+ return Pac.sh_path_by_package(package, path)
107
104
 
108
105
  @classmethod
109
- def set_path_log_cfg(cls):
110
- """ show directory
106
+ def sh_path_data(cls) -> Any:
107
+ """
108
+ show path to data directory in package
111
109
  """
112
110
  package = cls.d_app_pacmod['package']
113
- path = resources.files(package).joinpath(f"data/log.{cls.log_type}.yml")
114
- if path.is_file():
115
- cls.path_log_cfg = path
116
- return
117
- package = cls.d_com_pacmod['package']
118
- path = resources.files(package).joinpath(f"data/log.{cls.log_type}.yml")
119
- if path.is_file():
120
- cls.path_log_cfg = path
121
- # raise ModuleNotFoundError
111
+ path = "data"
112
+ return Pac.sh_path_by_package(package, path)
113
+
114
+ @classmethod
115
+ def sh_path_cfg_yaml(cls) -> Any:
116
+ """
117
+ show path to configuration yaml-file in data directory of package
118
+ """
119
+ package = cls.d_app_pacmod['package']
120
+ path = os.path.join('data', 'cfg.yml')
121
+ 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