encommon 0.12.3__py3-none-any.whl → 0.13.1__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.
- encommon/config/config.py +27 -0
- encommon/config/test/test_config.py +3 -0
- encommon/conftest.py +5 -1
- encommon/times/timers.py +6 -0
- encommon/times/windows.py +6 -0
- encommon/version.txt +1 -1
- {encommon-0.12.3.dist-info → encommon-0.13.1.dist-info}/METADATA +1 -1
- {encommon-0.12.3.dist-info → encommon-0.13.1.dist-info}/RECORD +11 -11
- {encommon-0.12.3.dist-info → encommon-0.13.1.dist-info}/LICENSE +0 -0
- {encommon-0.12.3.dist-info → encommon-0.13.1.dist-info}/WHEEL +0 -0
- {encommon-0.12.3.dist-info → encommon-0.13.1.dist-info}/top_level.txt +0 -0
encommon/config/config.py
CHANGED
@@ -49,12 +49,14 @@ class Config:
|
|
49
49
|
:param paths: Complete or relative path to config paths.
|
50
50
|
:param cargs: Configuration arguments in dictionary form,
|
51
51
|
which will override contents from the config files.
|
52
|
+
:param sargs: Additional arguments on the command line.
|
52
53
|
:param model: Override default config validation model.
|
53
54
|
"""
|
54
55
|
|
55
56
|
__files: ConfigFiles
|
56
57
|
__paths: ConfigPaths
|
57
58
|
__cargs: dict[str, Any]
|
59
|
+
__sargs: dict[str, Any]
|
58
60
|
|
59
61
|
__model: Callable # type: ignore
|
60
62
|
|
@@ -69,6 +71,7 @@ class Config:
|
|
69
71
|
files: Optional['PATHABLE'] = None,
|
70
72
|
paths: Optional['PATHABLE'] = None,
|
71
73
|
cargs: Optional[dict[str, Any]] = None,
|
74
|
+
sargs: Optional[dict[str, Any]] = None,
|
72
75
|
model: Optional[Callable] = None, # type: ignore
|
73
76
|
) -> None:
|
74
77
|
"""
|
@@ -78,12 +81,14 @@ class Config:
|
|
78
81
|
files = files or []
|
79
82
|
paths = paths or []
|
80
83
|
cargs = cargs or {}
|
84
|
+
sargs = sargs or {}
|
81
85
|
|
82
86
|
paths = list(config_paths(paths))
|
83
87
|
|
84
88
|
self.__model = model or Params
|
85
89
|
self.__files = ConfigFiles(files)
|
86
90
|
self.__cargs = deepcopy(cargs)
|
91
|
+
self.__sargs = deepcopy(sargs)
|
87
92
|
|
88
93
|
self.__params = None
|
89
94
|
|
@@ -147,6 +152,28 @@ class Config:
|
|
147
152
|
return deepcopy(returned)
|
148
153
|
|
149
154
|
|
155
|
+
@property
|
156
|
+
def sargs(
|
157
|
+
self,
|
158
|
+
) -> dict[str, Any]:
|
159
|
+
"""
|
160
|
+
Return the value for the attribute from class instance.
|
161
|
+
|
162
|
+
:returns: Value for the attribute from class instance.
|
163
|
+
"""
|
164
|
+
|
165
|
+
returned: dict[str, Any] = {}
|
166
|
+
|
167
|
+
sargs = deepcopy(self.__sargs)
|
168
|
+
|
169
|
+
items = sargs.items()
|
170
|
+
|
171
|
+
for key, value in items:
|
172
|
+
setate(returned, key, value)
|
173
|
+
|
174
|
+
return deepcopy(returned)
|
175
|
+
|
176
|
+
|
150
177
|
@property
|
151
178
|
def config(
|
152
179
|
self,
|
@@ -44,6 +44,7 @@ def test_Config(
|
|
44
44
|
'_Config__model',
|
45
45
|
'_Config__files',
|
46
46
|
'_Config__cargs',
|
47
|
+
'_Config__sargs',
|
47
48
|
'_Config__params',
|
48
49
|
'_Config__paths',
|
49
50
|
'_Config__logger',
|
@@ -71,6 +72,8 @@ def test_Config(
|
|
71
72
|
|
72
73
|
assert len(config.cargs) == 1
|
73
74
|
|
75
|
+
assert len(config.sargs) == 1
|
76
|
+
|
74
77
|
assert len(config.config) == 3
|
75
78
|
|
76
79
|
assert config.model is Params
|
encommon/conftest.py
CHANGED
@@ -47,9 +47,13 @@ def config_factory(
|
|
47
47
|
'enlogger/file_path': config_log,
|
48
48
|
'enlogger/file_level': 'info'}
|
49
49
|
|
50
|
+
sargs = {
|
51
|
+
'custom/parameter': 'fart'}
|
52
|
+
|
50
53
|
return Config(
|
51
54
|
files=f'{tmp_path}/config.yml',
|
52
|
-
cargs=cargs
|
55
|
+
cargs=cargs,
|
56
|
+
sargs=sargs)
|
53
57
|
|
54
58
|
|
55
59
|
|
encommon/times/timers.py
CHANGED
@@ -430,12 +430,18 @@ class Timers:
|
|
430
430
|
:param unique: Unique identifier for the related child.
|
431
431
|
"""
|
432
432
|
|
433
|
+
params = self.__params
|
433
434
|
timers = self.__timers
|
434
435
|
|
435
436
|
group = self.__group
|
436
437
|
|
437
438
|
session = self.store_session
|
438
439
|
|
440
|
+
config = params.timers
|
441
|
+
|
442
|
+
|
443
|
+
if unique in config:
|
444
|
+
del config[unique]
|
439
445
|
|
440
446
|
if unique in timers:
|
441
447
|
del timers[unique]
|
encommon/times/windows.py
CHANGED
@@ -495,12 +495,18 @@ class Windows:
|
|
495
495
|
:param unique: Unique identifier for the related child.
|
496
496
|
"""
|
497
497
|
|
498
|
+
params = self.__params
|
498
499
|
windows = self.__windows
|
499
500
|
|
500
501
|
group = self.__group
|
501
502
|
|
502
503
|
session = self.store_session
|
503
504
|
|
505
|
+
config = params.windows
|
506
|
+
|
507
|
+
|
508
|
+
if unique in config:
|
509
|
+
del config[unique]
|
504
510
|
|
505
511
|
if unique in windows:
|
506
512
|
del windows[unique]
|
encommon/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.13.1
|
@@ -1,16 +1,16 @@
|
|
1
1
|
encommon/__init__.py,sha256=VoXUcphq-gcXCraaU47EtXBftF6UVuQPMGr0fuCTt9A,525
|
2
|
-
encommon/conftest.py,sha256=
|
2
|
+
encommon/conftest.py,sha256=kGyQzZmT5jEIzwqhLhk2tTgNn7XbHaYYVBj3kjPU-W8,1899
|
3
3
|
encommon/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
encommon/version.txt,sha256=
|
4
|
+
encommon/version.txt,sha256=glJlA9UeK8GWSxgHU60Cp0ZSJ66UxBdSZJ02n6ogPqs,7
|
5
5
|
encommon/config/__init__.py,sha256=iZdbW7A4m7iN4xt5cEeQqo0Klqs-CaPLdD5ocLmUYi8,856
|
6
|
-
encommon/config/config.py,sha256=
|
6
|
+
encommon/config/config.py,sha256=d1EQ5fsexuTrsPTfs_dfmGchqysdaRa-mgXCHKJm_bM,5957
|
7
7
|
encommon/config/files.py,sha256=ueXiKTOqlQ4GKUT9lLyOlE-tfr6QAkSxdUs0VPbwEnE,2385
|
8
8
|
encommon/config/logger.py,sha256=7qjujhs0pI02gazhGpPCNa18qnuYpajVCTDlBkCtiro,14217
|
9
9
|
encommon/config/params.py,sha256=xygONdnwagGn06791nTX_mCR9hmdFl60RMe7MZr6ICw,2192
|
10
10
|
encommon/config/paths.py,sha256=f0JDqkmd1xVd9KJ6s0b5KaFk-N6MlOjz4n1W39A5JHM,2533
|
11
11
|
encommon/config/utils.py,sha256=VzTpBSZ-l6codt6vk4p4SpcmKk-H1OBy-9IUBPKP3t4,2039
|
12
12
|
encommon/config/test/__init__.py,sha256=i0JAeRcM-0YH2StGfwpaDbZV9dVribNSgFDcYcPPay8,313
|
13
|
-
encommon/config/test/test_config.py,sha256=
|
13
|
+
encommon/config/test/test_config.py,sha256=aaCRai6tsytlDw4yHpSsTphOc6hLD2y_f8ItlGzISO4,2501
|
14
14
|
encommon/config/test/test_files.py,sha256=qJgavSxTxilHOnGzfF6fBpViOmKFGcBdupOIRhDsXuk,2295
|
15
15
|
encommon/config/test/test_logger.py,sha256=6X_ZYhKExvZsXo2o8FXneYi1uUekSj-t_B3u5wmeIDM,5246
|
16
16
|
encommon/config/test/test_paths.py,sha256=jCrSEnPkZprsJSvolsfTKoyuYqxqyQdDymL9yk3elvQ,2633
|
@@ -28,11 +28,11 @@ encommon/times/duration.py,sha256=LTROiKcRXvPcs2Gz9KaB5Cmxo9NXd3TcMo5-jnTxPo0,10
|
|
28
28
|
encommon/times/params.py,sha256=qwfy7cw9_UlWUm2xWm1aRjJJZzZp36w3Bo3Rc-HU2hM,3515
|
29
29
|
encommon/times/parse.py,sha256=DXoT_NyWL2Ea_j3vlGHMDY-5P6NBeYHyGhJoiavgBS0,6144
|
30
30
|
encommon/times/timer.py,sha256=19dt7A5nJEUdr_0p3WDFGO-Q49OHt3sgPW4R2zHoScU,2901
|
31
|
-
encommon/times/timers.py,sha256=
|
31
|
+
encommon/times/timers.py,sha256=X3Aeutsp-GIEqYOxO0cXmNhTehHvT_aMgWogXI3T87Q,9343
|
32
32
|
encommon/times/times.py,sha256=FBOAVY1H21OV4BjGHj6iJrYbGQpSkWPj3Ss2Vepdvu4,9682
|
33
33
|
encommon/times/utils.py,sha256=PJ5QsKb3_pYEnD3Sz81d8QDhYQtTIj4HJfMoC9gNwmo,3100
|
34
34
|
encommon/times/window.py,sha256=3ctrDd0UWvnwrqxRZf7M-mVeEYVWvet6GZTj17YQ9sU,8526
|
35
|
-
encommon/times/windows.py,sha256=
|
35
|
+
encommon/times/windows.py,sha256=YJd1Tq97Eo2jUjIBvvhg-828A6BxecuHKSXhqIe9bSs,10838
|
36
36
|
encommon/times/test/__init__.py,sha256=PjrnBYT0efyvbaGeNx94dm3tP3EVHUHSVs-VGeLEv5g,218
|
37
37
|
encommon/times/test/test_duration.py,sha256=ofCBdQ4-tOKP5W5U2xyTaZrCVvD-dWEgnYoCvZ99MuA,4189
|
38
38
|
encommon/times/test/test_params.py,sha256=kHvs-WvKfPQCdCDnPU9tAyMVXmzH3eUjwQN-QdWBeh4,1407
|
@@ -66,8 +66,8 @@ encommon/utils/test/test_match.py,sha256=QagKpTFdRo23-Y55fSaJrSMpt5jIebScKbz0h8t
|
|
66
66
|
encommon/utils/test/test_paths.py,sha256=1yiZp5PCxljGk0J6fwIfWOUl-KWz40INybrwrN3JIog,1945
|
67
67
|
encommon/utils/test/test_sample.py,sha256=sHAeWOL1mchTGYGQaFK_A3Z28tThuULumm9kQebnIdk,1710
|
68
68
|
encommon/utils/test/test_stdout.py,sha256=TA7xQuFoPZUYW2l00e04MGp4P9gHkkVxVflvPlhpQXg,4878
|
69
|
-
encommon-0.
|
70
|
-
encommon-0.
|
71
|
-
encommon-0.
|
72
|
-
encommon-0.
|
73
|
-
encommon-0.
|
69
|
+
encommon-0.13.1.dist-info/LICENSE,sha256=otnXKCtMjPlbHs0wgZ_BWULrp3g_2dWQJ6icRk9nkgg,1071
|
70
|
+
encommon-0.13.1.dist-info/METADATA,sha256=htIjSIbgh311LEIe9kU3rz11p0vk3orU5YhXC9Mdlw8,3362
|
71
|
+
encommon-0.13.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
72
|
+
encommon-0.13.1.dist-info/top_level.txt,sha256=bP8q7-5tLDNm-3XPlqn_bDENfYNug5801H_xfz3BEAM,9
|
73
|
+
encommon-0.13.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|