ka-uts-com 2.0.0.250407__tar.gz → 2.1.0.250408__tar.gz

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 (39) hide show
  1. {ka_uts_com-2.0.0.250407/ka_uts_com.egg-info → ka_uts_com-2.1.0.250408}/PKG-INFO +1 -1
  2. ka_uts_com-2.1.0.250408/dist/ka_uts_com-2.1.0.250408-py3-none-any.whl +0 -0
  3. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/__version__.py +1 -1
  4. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/base/cfg_.py +3 -2
  5. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/com.py +17 -23
  6. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/ioc/jinja2_.py +1 -1
  7. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/ioc/yaml_.py +2 -1
  8. ka_uts_com-2.1.0.250408/ka_uts_com/utils/pac.py +35 -0
  9. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/utils/pacmod.py +18 -32
  10. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408/ka_uts_com.egg-info}/PKG-INFO +1 -1
  11. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com.egg-info/SOURCES.txt +2 -1
  12. ka_uts_com-2.0.0.250407/dist/ka_uts_com-2.0.0.250407-py3-none-any.whl +0 -0
  13. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/LICENSE.txt +0 -0
  14. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/MANIFEST.in +0 -0
  15. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/README.rst +0 -0
  16. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/classifiers.txt +0 -0
  17. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/__init__.py +0 -0
  18. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/base/app_.py +0 -0
  19. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/base/exit_.py +0 -0
  20. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/base/log_.py +0 -0
  21. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/data/__init__.py +0 -0
  22. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/data/log.std.yml +0 -0
  23. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/data/log.usr.yml +0 -0
  24. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/decorators/dec.py +0 -0
  25. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/fnc.py +0 -0
  26. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/log.py +0 -0
  27. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/py.typed +0 -0
  28. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/timer.py +0 -0
  29. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/utils/aoeqstmt.py +0 -0
  30. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/utils/date.py +0 -0
  31. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/utils/doeq.py +0 -0
  32. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com/utils/str.py +0 -0
  33. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com.egg-info/dependency_links.txt +0 -0
  34. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com.egg-info/not-zip-safe +0 -0
  35. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com.egg-info/requires.txt +0 -0
  36. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/ka_uts_com.egg-info/top_level.txt +0 -0
  37. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/pyproject.toml +0 -0
  38. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/requirements.txt +0 -0
  39. {ka_uts_com-2.0.0.250407 → ka_uts_com-2.1.0.250408}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ka_uts_com
3
- Version: 2.0.0.250407
3
+ Version: 2.1.0.250408
4
4
  Summary: Communication Class Utilities
5
5
  Author-email: Bernd Stroehle <bernd.stroehle@gmail.com>
6
6
  Maintainer-email: Bernd Stroehle <bernd.stroehle@gmail.com>
@@ -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.0.250408'
5
5
  __build__ = 0x022200
6
6
  __author__ = 'Bernd Stroehle'
7
7
  __author_email__ = 'bernd.stroehle@gmail.com'
@@ -3,7 +3,6 @@ from typing import Any
3
3
 
4
4
  from logging import Logger
5
5
 
6
- from ka_uts_com.utils.pacmod import PacMod
7
6
  from ka_uts_com.ioc.yaml_ import Yaml_
8
7
 
9
8
  TyAny = Any
@@ -25,7 +24,9 @@ class Cfg_:
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 = com.sh_path_cfg()
28
+ if _path:
29
+ cls.cfg = Yaml_.read(_path, com.Log)
29
30
 
30
31
  @classmethod
31
32
  def sh(cls, com, **kwargs) -> Any:
@@ -4,13 +4,13 @@ from typing import Any
4
4
  import os
5
5
  import time
6
6
  import calendar
7
- import importlib.resources as resources
8
7
  import logging
9
8
  import logging.config
10
9
  from logging import Logger
11
10
  from datetime import datetime
12
11
 
13
12
  from ka_uts_com.utils.aoeqstmt import AoEqStmt
13
+ from ka_uts_com.utils.pac import Pac
14
14
  from ka_uts_com.utils.pacmod import PacMod
15
15
  from ka_uts_com.base.app_ import App_
16
16
  from ka_uts_com.base.cfg_ import Cfg_
@@ -72,16 +72,11 @@ class Com:
72
72
  cls.cmd = kwargs.get('cmd')
73
73
  cls.d_com_pacmod = PacMod.sh_d_pacmod(cls)
74
74
  cls.d_app_pacmod = PacMod.sh_d_pacmod(app_cls)
75
-
76
75
  cls.ts = calendar.timegm(time.gmtime())
77
76
  cls.pid = os.getpid()
78
77
 
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()
78
+ cls.path_bin = cls.sh_path_bin()
79
+ cls.path_log_cfg = cls.sh_path_log_cfg()
85
80
 
86
81
  cls.Log = Log_.sh(cls, **kwargs)
87
82
  cls.cfg = Cfg_.sh(cls, **kwargs)
@@ -96,26 +91,25 @@ class Com:
96
91
  return _kwargs
97
92
 
98
93
  @classmethod
99
- def set_path_bin(cls):
94
+ def sh_path_bin(cls) -> Any:
100
95
  """ show directory
101
96
  """
102
97
  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
98
+ path = "bin"
99
+ return Pac.sh_path_by_package(package, path)
107
100
 
108
101
  @classmethod
109
- def set_path_log_cfg(cls):
102
+ def sh_path_log_cfg(cls) -> Any:
103
+ """ show directory
104
+ """
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)
108
+
109
+ @classmethod
110
+ def sh_path_cfg(cls) -> Any:
110
111
  """ show directory
111
112
  """
112
113
  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
114
+ path = 'data/cfg.yml'
115
+ return Pac.sh_path_by_package(package, path)
@@ -38,5 +38,5 @@ class Jinja2_:
38
38
  return obj
39
39
  except IOError as exc:
40
40
  log.error(exc, exc_info=True)
41
- # log.error(f"No such file or directory: {path}")
41
+ # log.error(f"No such file or directory: path='{path'}")
42
42
  raise
@@ -21,7 +21,8 @@ class Yaml_:
21
21
  obj = yaml.load(fd, Loader=yaml.SafeLoader)
22
22
  return obj
23
23
  except FileNotFoundError:
24
- log.error(f"No such file or directory: {path}")
24
+ log.error(f"No such file or directory: path='{path}'")
25
+ raise
25
26
  except IOError:
26
27
  # if Com.Log is not None:
27
28
  # fnc_error = Com.Log.error
@@ -0,0 +1,35 @@
1
+ # coding=utf-8
2
+ from typing import Any
3
+
4
+ import os
5
+ import importlib.resources as resources
6
+
7
+ TyArr = list[Any]
8
+ TyDic = dict[Any, Any]
9
+ TyPackage = str
10
+ TyPackages = list[str]
11
+ TyPath = str
12
+
13
+
14
+ class Pac:
15
+
16
+ @staticmethod
17
+ def sh_path_by_package(package: TyPackage, path: TyPath) -> Any:
18
+ """ show directory
19
+ """
20
+ _path = str(resources.files(package).joinpath(path))
21
+ # if _path.is_file():
22
+ if _path is not None and _path != '':
23
+ if os.path.exists(_path):
24
+ return _path
25
+ return ''
26
+
27
+ @classmethod
28
+ def sh_path_by_packages(cls, packages: TyPackages, path: TyPath) -> Any:
29
+ """ show directory
30
+ """
31
+ for _package in packages:
32
+ _path = cls.sh_path_by_package(_package, path)
33
+ if _path:
34
+ return _path
35
+ return ''
@@ -2,16 +2,13 @@
2
2
  from typing import Any
3
3
 
4
4
  from os import path as os_path
5
- # import pkg_resources
6
- import importlib.resources as resources
5
+
6
+ from ka_uts_com.utils.pac import Pac
7
7
 
8
8
  TyArr = list[Any]
9
9
  TyDic = dict[Any, Any]
10
10
  TyPath = str
11
11
 
12
- TnDic = None | TyDic
13
- TnPath = None | TyPath
14
-
15
12
 
16
13
  class PacMod:
17
14
  """ Package Module Management
@@ -24,28 +21,21 @@ class PacMod:
24
21
  return {'package': a_pacmod[0], 'module': a_pacmod[1]}
25
22
 
26
23
  @staticmethod
27
- def sh_path_module_yaml(d_pacmod: TyDic) -> str:
24
+ def sh_path_module_yaml(d_pacmod: TyDic) -> Any:
28
25
  """ show directory
29
26
  """
30
- # def sh_path_cfg_yaml(d_pacmod: TyDic) -> str:
31
27
  package = d_pacmod['package']
32
28
  module = d_pacmod['module']
33
- filename = f"{module}.yml"
34
- file = resources.files(f"{package}.data")
35
- print("sh_path_module_yaml files = {files}")
36
- path: TyPath = file.joinpath(filename)
37
- return path
29
+ path = f"{module}/data/{module}.yml"
30
+ return Pac.sh_path_by_package(package, path)
38
31
 
39
32
  @staticmethod
40
- def sh_path_keys(
41
- d_pacmod: TyDic, filename: str = 'keys.yml') -> TyPath:
33
+ def sh_path_keys(d_pacmod: TyDic) -> Any:
42
34
  """ show directory
43
35
  """
44
36
  package = d_pacmod['package']
45
- files = resources.files(f"{package}.data")
46
- print("sh_path_keys files = {files}")
47
- path: TyPath = files.joinpath(filename)
48
- return path
37
+ path = 'data/keys.yml'
38
+ return Pac.sh_path_by_package(package, path)
49
39
 
50
40
  # @staticmethod
51
41
  # def sh_path_log_cfg(com) -> TyPath:
@@ -61,16 +51,13 @@ class PacMod:
61
51
  # return path
62
52
  # raise ModuleNotFoundError
63
53
 
64
- @staticmethod
65
- def sh_path_cfg(com) -> TyPath:
66
- """ show directory
67
- """
68
- filename = 'cfg.yml'
69
- package = com.d_app_pacmod['package']
70
- files = resources.files(f"{package}.data")
71
- print(f"sh_path_cfg files = {files}")
72
- path: TyPath = files.joinpath(filename)
73
- return path
54
+ # @staticmethod
55
+ # def sh_path_cfg(d_pacmod: TyDic) -> Any:
56
+ # """ show directory
57
+ # """
58
+ # package = com.d_app_pacmod['package']
59
+ # path = 'dat/cfg.yml'
60
+ # return Pac.sh_path(package, path)
74
61
 
75
62
  # @staticmethod
76
63
  # def sh_path_type(d_pacmod: TyDic, type_: str) -> str:
@@ -101,7 +88,7 @@ class PacMod:
101
88
  # return file_path
102
89
 
103
90
  @staticmethod
104
- def sh_dir_type(com, type_: str) -> str:
91
+ def sh_dir_type(com, type_: str) -> TyPath:
105
92
  """Show run_dir
106
93
  """
107
94
  dir_dat: str = com.dir_dat
@@ -115,9 +102,8 @@ class PacMod:
115
102
 
116
103
  @classmethod
117
104
  def sh_path_pattern(
118
- cls, com, filename, type_: str, suffix: str) -> str:
105
+ cls, com, filename, type_: str, suffix: str) -> TyPath:
119
106
  """ show type specific path
120
107
  """
121
108
  _dir: str = cls.sh_dir_type(com, type_)
122
- path: TyPath = os_path.join(_dir, f"{filename}*.{suffix}")
123
- return path
109
+ return os_path.join(_dir, f"{filename}*.{suffix}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ka_uts_com
3
- Version: 2.0.0.250407
3
+ Version: 2.1.0.250408
4
4
  Summary: Communication Class Utilities
5
5
  Author-email: Bernd Stroehle <bernd.stroehle@gmail.com>
6
6
  Maintainer-email: Bernd Stroehle <bernd.stroehle@gmail.com>
@@ -5,7 +5,7 @@ classifiers.txt
5
5
  pyproject.toml
6
6
  requirements.txt
7
7
  setup.cfg
8
- dist/ka_uts_com-2.0.0.250407-py3-none-any.whl
8
+ dist/ka_uts_com-2.1.0.250408-py3-none-any.whl
9
9
  ka_uts_com/__init__.py
10
10
  ka_uts_com/__version__.py
11
11
  ka_uts_com/com.py
@@ -32,5 +32,6 @@ ka_uts_com/ioc/yaml_.py
32
32
  ka_uts_com/utils/aoeqstmt.py
33
33
  ka_uts_com/utils/date.py
34
34
  ka_uts_com/utils/doeq.py
35
+ ka_uts_com/utils/pac.py
35
36
  ka_uts_com/utils/pacmod.py
36
37
  ka_uts_com/utils/str.py