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,93 +0,0 @@
1
- version: 1
2
-
3
- disable_existing_loggers: False
4
-
5
- root:
6
- level: DEBUG
7
- handlers:
8
- - debug_console
9
- - debug_file
10
-
11
- loggers:
12
-
13
- # main logger
14
- main:
15
- level: 'NOTSET'
16
- handlers:
17
- - debug_console
18
- - debug_file
19
- - info_file
20
- - error_file
21
-
22
- # person logger
23
- person:
24
- level: NOTSET
25
- handlers:
26
- - debug_console
27
- - debug_file
28
- - info_file
29
- - error_file
30
-
31
- handlers:
32
-
33
- debug_console:
34
- class: 'logging.StreamHandler'
35
- level: DEBUG
36
- formatter: debug
37
- stream: 'ext://sys.stderr'
38
-
39
- debug_file:
40
- class: 'logging.FileHandler'
41
- level: DEBUG
42
- formatter: error
43
- filename: 'debug.log'
44
- mode: 'a'
45
-
46
- # info_rotating_file_handler:
47
- # class: 'logging.handlers.RotatingFileHandler'
48
- # level: INFO
49
- # formatter: info
50
- # filename: 'info.rotating.log'
51
- # mode: 'a'
52
- # maxBytes: 1048576 # 1MB
53
- # backupCount: 10
54
- # encoding: utf8
55
-
56
- info_file:
57
- class: 'logging.FileHandler'
58
- level: INFO
59
- formatter: info
60
- filename: 'info.log'
61
- mode: 'a'
62
-
63
- error_file:
64
- class: 'logging.FileHandler'
65
- level: ERROR
66
- formatter: error
67
- filename: 'error.log'
68
- mode: 'a'
69
-
70
- critical_mail:
71
- class: 'logging.handlers.SMTPHandler'
72
- level: CRITICAL
73
- formatter: critical
74
- mailhost : localhost
75
- fromaddr: 'monitoring@domain.com'
76
- toaddrs:
77
- - 'dev@domain.com'
78
- - 'qa@domain.com'
79
- subject: 'Critical error with application name'
80
-
81
- formatters:
82
-
83
- info:
84
- format: '%(asctime)s-%(levelname)s-%(name)s::%(module)s|%(lineno)s:: %(message)s'
85
- debug:
86
- format: '%(asctime)-15s %(levelname)s-%(name)s-%(process)d::%(module)s.%(funcName)s|%(lineno)s:: %(message)s'
87
- datefmt: '%Y-%m-%d %H:%M:%S'
88
- error:
89
- format: '%(asctime)-15s %(levelname)s-%(name)s-%(process)d::%(module)s.%(funcName)s|%(lineno)s:: %(message)s'
90
- datefmt: '%Y-%m-%d %H:%M:%S'
91
- critical:
92
- format: '%(asctime)-15s %(levelname)s-%(name)s-%(process)d::%(module)s.%(funcName)s|%(lineno)s:: %(message)s'
93
- datefmt: '%Y-%m-%d %H:%M:%S'
ka_uts_com/ioc.py DELETED
@@ -1,57 +0,0 @@
1
- # coding=utf-8
2
-
3
- import jinja2
4
- import os
5
- import yaml
6
-
7
- from typing import Any, Dict
8
-
9
- T_Dic = Dict[Any, Any]
10
-
11
- TN_Any = None | Any
12
-
13
-
14
- class Yaml:
15
-
16
- """ Manage Object to Yaml file affilitation
17
- """
18
- @staticmethod
19
- def load_with_safeloader(string: str) -> None | Any:
20
- _obj = yaml.load(string, Loader=yaml.SafeLoader)
21
- return _obj
22
-
23
- @staticmethod
24
- def read(path: str) -> TN_Any:
25
- with open(path) as fd:
26
- # The Loader parameter handles the conversion from YAML
27
- # scalar values to Python object format
28
- _obj = yaml.load(fd, Loader=yaml.SafeLoader)
29
- return _obj
30
- return None
31
-
32
-
33
- class Jinja2:
34
- """ Manage Object to Json file affilitation
35
- """
36
- @staticmethod
37
- def read_template(
38
- path: str) -> Any:
39
- dir, file = os.path.split(path)
40
- env = jinja2.Environment(loader=jinja2.FileSystemLoader(dir))
41
- return env.get_template(file)
42
-
43
- @classmethod
44
- def read(
45
- cls, path: str, **kwargs):
46
- try:
47
- # read jinja template from file
48
- template = cls.read_template(path)
49
-
50
- # render template as yaml string
51
- template_rendered = template.render(**kwargs)
52
-
53
- # parse yaml string as dictionary
54
- dic = Yaml.load_with_safeloader(template_rendered)
55
- return dic
56
- except Exception:
57
- raise
ka_uts_com/pacmod.py DELETED
@@ -1,111 +0,0 @@
1
- # coding=utf-8
2
-
3
- from os import path as os_path
4
- import pkg_resources
5
-
6
- from typing import Any, Dict, List
7
-
8
- T_Arr = List[Any]
9
- T_Dic = Dict[Any, Any]
10
-
11
- TN_Dic = None | T_Dic
12
-
13
-
14
- class Pacmod:
15
- """ Package Module Management
16
- """
17
- def sh_d_pacmod(root_cls, tenant: Any) -> T_Dic:
18
- """ Show Pacmod Dictionary
19
- """
20
- a_pacmod: T_Arr = root_cls.__module__.split(".")
21
- package = a_pacmod[0]
22
- module = a_pacmod[1]
23
- d_pacmod: T_Dic = {}
24
- d_pacmod['tenant'] = tenant
25
- d_pacmod['package'] = package
26
- d_pacmod['module'] = module
27
- return d_pacmod
28
-
29
- # class Cfg:
30
- # """ Configuration Sub Class of Package Module Class
31
- # """
32
- @staticmethod
33
- def sh_path_cfg_yaml(pacmod: T_Dic) -> str:
34
- """ show directory
35
- """
36
- package = pacmod['package']
37
- module = pacmod['module']
38
-
39
- dir: str = f"{package}.data"
40
-
41
- # print(f"dir = {dir}")
42
- # print(f"package = {package}")
43
- # print(f"module = {module}")
44
-
45
- path = pkg_resources.resource_filename(dir, f"{module}.yml")
46
- return path
47
-
48
- @staticmethod
49
- def sh_path_keys_yaml(
50
- pacmod: Any, filename: str = 'keys.yml') -> str:
51
- """ show directory
52
- """
53
- package = pacmod['package']
54
- dir = f"{package}.data"
55
- path = pkg_resources.resource_filename(dir, filename)
56
- return path
57
-
58
- @staticmethod
59
- def sh_pacmod_type(pacmod: Dict, type_: str) -> str:
60
- """ show Data File Path
61
- """
62
- package = pacmod['package']
63
- module = pacmod['module']
64
- return f"/data/{package}/{module}/{type_}"
65
-
66
- @classmethod
67
- def sh_file_path(
68
- cls, pacmod: T_Dic, type_: str, suffix: str,
69
- pid: Any, ts: Any, **kwargs) -> str:
70
- """ show type specific path
71
- """
72
- filename = kwargs.get('filename')
73
- if filename is not None:
74
- filename_ = filename
75
- else:
76
- filename_ = type_
77
-
78
- sw_run_pid_ts = kwargs.get('sw_run_pid_ts', True)
79
- if sw_run_pid_ts is None:
80
- sw_run_pid_ts = True
81
-
82
- # _dir: str = cls.Data.Dir.sh(pacmod, type)
83
- _dir: str = cls.sh_pacmod_type(pacmod, type_)
84
- if sw_run_pid_ts:
85
- # pid = str(Com.pid)
86
- # ts = str(Com.ts_start)
87
- file_path = os_path.join(
88
- _dir, f"{filename_}_{pid}_{ts}.{suffix}")
89
- else:
90
- file_path = os_path.join(_dir, f"{filename_}.{suffix}")
91
- return file_path
92
-
93
- @classmethod
94
- def sh_pattern(
95
- cls, pacmod: T_Dic, type_: str, suffix: str, **kwargs) -> str:
96
- """ show type specific path
97
- """
98
- filename = kwargs.get('filename')
99
- _dir: str = cls.sh_pacmod_type(pacmod, type_)
100
- path = os_path.join(_dir, f"{filename}*.{suffix}")
101
- return path
102
-
103
- @staticmethod
104
- def sh_path_cfg_log(pacmod: TN_Dic = None, filename: str = 'log.yml'):
105
- """ show directory
106
- """
107
- if pacmod is None:
108
- pacmod = {'package': 'ka_uts_com', 'module': 'com'}
109
- return pkg_resources.resource_filename(
110
- f"{pacmod['package']}.data", filename
111
- )