encommon 0.8.2__py3-none-any.whl → 0.10.0__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 +11 -1
- encommon/config/params.py +3 -3
- encommon/config/test/test_config.py +14 -6
- encommon/config/test/test_files.py +14 -8
- encommon/config/test/test_logger.py +14 -8
- encommon/config/test/test_paths.py +14 -8
- encommon/conftest.py +2 -3
- encommon/crypts/params.py +1 -1
- encommon/crypts/test/test_crypts.py +8 -4
- encommon/crypts/test/test_hashes.py +8 -4
- encommon/times/test/test_duration.py +4 -2
- encommon/times/test/test_timers.py +8 -4
- encommon/times/test/test_times.py +8 -4
- encommon/times/test/test_window.py +8 -4
- encommon/types/__init__.py +12 -0
- encommon/types/notate.py +321 -0
- encommon/types/strings.py +75 -0
- encommon/types/test/__init__.py +37 -0
- encommon/types/test/test_dicts.py +23 -28
- encommon/types/test/test_notate.py +217 -0
- encommon/types/test/test_strings.py +42 -0
- encommon/version.txt +1 -1
- {encommon-0.8.2.dist-info → encommon-0.10.0.dist-info}/METADATA +1 -1
- {encommon-0.8.2.dist-info → encommon-0.10.0.dist-info}/RECORD +27 -25
- {encommon-0.8.2.dist-info → encommon-0.10.0.dist-info}/LICENSE +0 -0
- {encommon-0.8.2.dist-info → encommon-0.10.0.dist-info}/WHEEL +0 -0
- {encommon-0.8.2.dist-info → encommon-0.10.0.dist-info}/top_level.txt +0 -0
encommon/config/config.py
CHANGED
@@ -20,6 +20,7 @@ from .params import Params
|
|
20
20
|
from .paths import ConfigPaths
|
21
21
|
from ..crypts import Crypts
|
22
22
|
from ..types import merge_dicts
|
23
|
+
from ..types import setate
|
23
24
|
|
24
25
|
if TYPE_CHECKING:
|
25
26
|
from ..utils.common import PATHABLE
|
@@ -124,7 +125,16 @@ class Config:
|
|
124
125
|
:returns: Value for the attribute from class instance.
|
125
126
|
"""
|
126
127
|
|
127
|
-
|
128
|
+
returned: dict[str, Any] = {}
|
129
|
+
|
130
|
+
cargs = deepcopy(self.__cargs)
|
131
|
+
|
132
|
+
items = cargs.items()
|
133
|
+
|
134
|
+
for key, value in items:
|
135
|
+
setate(returned, key, value)
|
136
|
+
|
137
|
+
return deepcopy(returned)
|
128
138
|
|
129
139
|
|
130
140
|
@property
|
encommon/config/params.py
CHANGED
@@ -18,7 +18,7 @@ from ..crypts import CryptsParams
|
|
18
18
|
|
19
19
|
class ConfigParams(BaseModel, extra='forbid'):
|
20
20
|
"""
|
21
|
-
Process and validate the
|
21
|
+
Process and validate the core configuration parameters.
|
22
22
|
|
23
23
|
:param paths: Complete or relative path to config paths.
|
24
24
|
:param data: Keyword arguments passed to Pydantic model.
|
@@ -31,7 +31,7 @@ class ConfigParams(BaseModel, extra='forbid'):
|
|
31
31
|
|
32
32
|
class LoggerParams(BaseModel, extra='forbid'):
|
33
33
|
"""
|
34
|
-
Process and validate the
|
34
|
+
Process and validate the core configuration parameters.
|
35
35
|
|
36
36
|
:param stdo_level: Minimum level for the message to pass.
|
37
37
|
:param file_level: Minimum level for the message to pass.
|
@@ -48,7 +48,7 @@ class LoggerParams(BaseModel, extra='forbid'):
|
|
48
48
|
|
49
49
|
class Params(BaseModel, extra='forbid'):
|
50
50
|
"""
|
51
|
-
Process and validate the
|
51
|
+
Process and validate the core configuration parameters.
|
52
52
|
|
53
53
|
:param enconfig: Configuration for the Config instance.
|
54
54
|
:param enlogger: Configuration for the Logger instance.
|
@@ -16,6 +16,8 @@ from ..params import Params
|
|
16
16
|
from ... import ENPYRWS
|
17
17
|
from ... import PROJECT
|
18
18
|
from ...crypts import Crypts
|
19
|
+
from ...types import inrepr
|
20
|
+
from ...types import instr
|
19
21
|
from ...utils import load_sample
|
20
22
|
from ...utils import prep_sample
|
21
23
|
|
@@ -48,18 +50,24 @@ def test_Config(
|
|
48
50
|
'_Config__crypts']
|
49
51
|
|
50
52
|
|
51
|
-
assert
|
52
|
-
'config.Config object'
|
53
|
+
assert inrepr(
|
54
|
+
'config.Config object',
|
55
|
+
config)
|
53
56
|
|
54
57
|
assert hash(config) > 0
|
55
58
|
|
56
|
-
assert
|
57
|
-
'config.Config object'
|
59
|
+
assert instr(
|
60
|
+
'config.Config object',
|
61
|
+
config)
|
58
62
|
|
59
63
|
|
60
|
-
assert
|
64
|
+
assert instr(
|
65
|
+
'files.ConfigFiles object',
|
66
|
+
config.files)
|
61
67
|
|
62
|
-
assert
|
68
|
+
assert instr(
|
69
|
+
'paths.ConfigPaths object',
|
70
|
+
config.paths)
|
63
71
|
|
64
72
|
assert len(config.cargs) == 1
|
65
73
|
|
@@ -14,6 +14,8 @@ from pytest import fixture
|
|
14
14
|
from . import SAMPLES
|
15
15
|
from ..files import ConfigFile
|
16
16
|
from ..files import ConfigFiles
|
17
|
+
from ...types import inrepr
|
18
|
+
from ...types import instr
|
17
19
|
|
18
20
|
|
19
21
|
|
@@ -54,13 +56,15 @@ def test_ConfigFile(
|
|
54
56
|
'config']
|
55
57
|
|
56
58
|
|
57
|
-
assert
|
58
|
-
'files.ConfigFile object'
|
59
|
+
assert inrepr(
|
60
|
+
'files.ConfigFile object',
|
61
|
+
file)
|
59
62
|
|
60
63
|
assert hash(file) > 0
|
61
64
|
|
62
|
-
assert
|
63
|
-
'files.ConfigFile object'
|
65
|
+
assert instr(
|
66
|
+
'files.ConfigFile object',
|
67
|
+
file)
|
64
68
|
|
65
69
|
|
66
70
|
assert file.path.name == 'config.yml'
|
@@ -87,13 +91,15 @@ def test_ConfigFiles(
|
|
87
91
|
'_ConfigFiles__merged']
|
88
92
|
|
89
93
|
|
90
|
-
assert
|
91
|
-
'files.ConfigFiles object'
|
94
|
+
assert inrepr(
|
95
|
+
'files.ConfigFiles object',
|
96
|
+
files)
|
92
97
|
|
93
98
|
assert hash(files) > 0
|
94
99
|
|
95
|
-
assert
|
96
|
-
'files.ConfigFiles object'
|
100
|
+
assert instr(
|
101
|
+
'files.ConfigFiles object',
|
102
|
+
files)
|
97
103
|
|
98
104
|
|
99
105
|
assert len(files.paths) == 2
|
@@ -18,6 +18,8 @@ from ..logger import Message
|
|
18
18
|
from ..params import LoggerParams
|
19
19
|
from ...times.common import UNIXMPOCH
|
20
20
|
from ...times.common import UNIXSPOCH
|
21
|
+
from ...types import inrepr
|
22
|
+
from ...types import instr
|
21
23
|
from ...utils import strip_ansi
|
22
24
|
|
23
25
|
|
@@ -75,13 +77,15 @@ def test_Message() -> None:
|
|
75
77
|
'_Message__fields']
|
76
78
|
|
77
79
|
|
78
|
-
assert
|
79
|
-
'Message(level="info"'
|
80
|
+
assert inrepr(
|
81
|
+
'Message(level="info"',
|
82
|
+
message)
|
80
83
|
|
81
84
|
assert hash(message) > 0
|
82
85
|
|
83
|
-
assert
|
84
|
-
'Message(level="info"'
|
86
|
+
assert instr(
|
87
|
+
'Message(level="info"',
|
88
|
+
message)
|
85
89
|
|
86
90
|
|
87
91
|
assert message.level == 'info'
|
@@ -146,13 +150,15 @@ def test_Logger(
|
|
146
150
|
'_Logger__logr_file']
|
147
151
|
|
148
152
|
|
149
|
-
assert
|
150
|
-
'logger.Logger object'
|
153
|
+
assert inrepr(
|
154
|
+
'logger.Logger object',
|
155
|
+
logger)
|
151
156
|
|
152
157
|
assert hash(logger) > 0
|
153
158
|
|
154
|
-
assert
|
155
|
-
'logger.Logger object'
|
159
|
+
assert instr(
|
160
|
+
'logger.Logger object',
|
161
|
+
logger)
|
156
162
|
|
157
163
|
|
158
164
|
assert logger.stdo_level == 'info'
|
@@ -16,6 +16,8 @@ from ..paths import ConfigPath
|
|
16
16
|
from ..paths import ConfigPaths
|
17
17
|
from ... import ENPYRWS
|
18
18
|
from ... import PROJECT
|
19
|
+
from ...types import inrepr
|
20
|
+
from ...types import instr
|
19
21
|
from ...utils import load_sample
|
20
22
|
from ...utils import prep_sample
|
21
23
|
|
@@ -57,13 +59,15 @@ def test_ConfigPath(
|
|
57
59
|
'config']
|
58
60
|
|
59
61
|
|
60
|
-
assert
|
61
|
-
'paths.ConfigPath object'
|
62
|
+
assert inrepr(
|
63
|
+
'paths.ConfigPath object',
|
64
|
+
path)
|
62
65
|
|
63
66
|
assert hash(path) > 0
|
64
67
|
|
65
|
-
assert
|
66
|
-
'paths.ConfigPath object'
|
68
|
+
assert instr(
|
69
|
+
'paths.ConfigPath object',
|
70
|
+
path)
|
67
71
|
|
68
72
|
|
69
73
|
assert 'test' in path.path.name
|
@@ -89,13 +93,15 @@ def test_ConfigPaths(
|
|
89
93
|
'_ConfigPaths__merged']
|
90
94
|
|
91
95
|
|
92
|
-
assert
|
93
|
-
'paths.ConfigPaths object'
|
96
|
+
assert inrepr(
|
97
|
+
'paths.ConfigPaths object',
|
98
|
+
paths)
|
94
99
|
|
95
100
|
assert hash(paths) > 0
|
96
101
|
|
97
|
-
assert
|
98
|
-
'paths.ConfigPaths object'
|
102
|
+
assert instr(
|
103
|
+
'paths.ConfigPaths object',
|
104
|
+
paths)
|
99
105
|
|
100
106
|
|
101
107
|
assert len(paths.paths) == 2
|
encommon/conftest.py
CHANGED
@@ -43,9 +43,8 @@ def config_factory(
|
|
43
43
|
config_log = f'{tmp_path}/config.log'
|
44
44
|
|
45
45
|
cargs = {
|
46
|
-
'enlogger':
|
47
|
-
|
48
|
-
'file_level': 'info'}}
|
46
|
+
'enlogger/file_path': config_log,
|
47
|
+
'enlogger/file_level': 'info'}
|
49
48
|
|
50
49
|
return Config(
|
51
50
|
files=f'{tmp_path}/config.yml',
|
encommon/crypts/params.py
CHANGED
@@ -13,7 +13,7 @@ from pydantic import BaseModel
|
|
13
13
|
|
14
14
|
class CryptsParams(BaseModel, extra='forbid'):
|
15
15
|
"""
|
16
|
-
Process and validate the
|
16
|
+
Process and validate the core configuration parameters.
|
17
17
|
|
18
18
|
:param phrases: Passphrases that are used in operations.
|
19
19
|
:param data: Keyword arguments passed to Pydantic model.
|
@@ -13,6 +13,8 @@ from pytest import raises
|
|
13
13
|
|
14
14
|
from ..crypts import Crypts
|
15
15
|
from ..params import CryptsParams
|
16
|
+
from ...types import inrepr
|
17
|
+
from ...types import instr
|
16
18
|
|
17
19
|
|
18
20
|
|
@@ -51,13 +53,15 @@ def test_Crypts(
|
|
51
53
|
'_Crypts__phrases']
|
52
54
|
|
53
55
|
|
54
|
-
assert
|
55
|
-
'crypts.Crypts object'
|
56
|
+
assert inrepr(
|
57
|
+
'crypts.Crypts object',
|
58
|
+
crypts)
|
56
59
|
|
57
60
|
assert hash(crypts) > 0
|
58
61
|
|
59
|
-
assert
|
60
|
-
'crypts.Crypts object'
|
62
|
+
assert instr(
|
63
|
+
'crypts.Crypts object',
|
64
|
+
crypts)
|
61
65
|
|
62
66
|
|
63
67
|
assert len(crypts.phrases) == 2
|
@@ -8,6 +8,8 @@ is permitted, for more information consult the project license file.
|
|
8
8
|
|
9
9
|
|
10
10
|
from ..hashes import Hashes
|
11
|
+
from ...types import inrepr
|
12
|
+
from ...types import instr
|
11
13
|
|
12
14
|
|
13
15
|
|
@@ -25,13 +27,15 @@ def test_Hashes() -> None:
|
|
25
27
|
'_Hashes__string']
|
26
28
|
|
27
29
|
|
28
|
-
assert
|
29
|
-
'hashes.Hashes object'
|
30
|
+
assert inrepr(
|
31
|
+
'hashes.Hashes object',
|
32
|
+
hashes)
|
30
33
|
|
31
34
|
assert hash(hashes) > 0
|
32
35
|
|
33
|
-
assert
|
34
|
-
'hashes.Hashes object'
|
36
|
+
assert instr(
|
37
|
+
'hashes.Hashes object',
|
38
|
+
hashes)
|
35
39
|
|
36
40
|
|
37
41
|
assert hashes.string == 'string'
|
@@ -8,6 +8,7 @@ is permitted, for more information consult the project license file.
|
|
8
8
|
|
9
9
|
|
10
10
|
from ..duration import Duration
|
11
|
+
from ...types import inrepr
|
11
12
|
from ...types.strings import COMMAS
|
12
13
|
|
13
14
|
|
@@ -28,8 +29,9 @@ def test_Duration() -> None:
|
|
28
29
|
'_Duration__groups']
|
29
30
|
|
30
31
|
|
31
|
-
assert
|
32
|
-
'Duration(seconds=95401
|
32
|
+
assert inrepr(
|
33
|
+
'Duration(seconds=95401',
|
34
|
+
durate)
|
33
35
|
|
34
36
|
assert hash(durate) > 0
|
35
37
|
|
@@ -14,6 +14,8 @@ from pytest import fixture
|
|
14
14
|
from pytest import raises
|
15
15
|
|
16
16
|
from ..timers import Timers
|
17
|
+
from ...types import inrepr
|
18
|
+
from ...types import instr
|
17
19
|
|
18
20
|
|
19
21
|
|
@@ -54,13 +56,15 @@ def test_Timers(
|
|
54
56
|
'_Timers__cache']
|
55
57
|
|
56
58
|
|
57
|
-
assert
|
58
|
-
'timers.Timers object'
|
59
|
+
assert inrepr(
|
60
|
+
'timers.Timers object',
|
61
|
+
timers)
|
59
62
|
|
60
63
|
assert hash(timers) > 0
|
61
64
|
|
62
|
-
assert
|
63
|
-
'timers.Timers object'
|
65
|
+
assert instr(
|
66
|
+
'timers.Timers object',
|
67
|
+
timers)
|
64
68
|
|
65
69
|
|
66
70
|
assert timers.timers == {'one': 1}
|
@@ -12,6 +12,8 @@ from ..common import UNIXEPOCH
|
|
12
12
|
from ..common import UNIXHPOCH
|
13
13
|
from ..common import UNIXMPOCH
|
14
14
|
from ..times import Times
|
15
|
+
from ...types import inrepr
|
16
|
+
from ...types import instr
|
15
17
|
|
16
18
|
|
17
19
|
|
@@ -32,13 +34,15 @@ def test_Times() -> None:
|
|
32
34
|
'_Times__hashed']
|
33
35
|
|
34
36
|
|
35
|
-
assert
|
36
|
-
"Times('1970-01-01T00:00"
|
37
|
+
assert inrepr(
|
38
|
+
"Times('1970-01-01T00:00",
|
39
|
+
times)
|
37
40
|
|
38
41
|
assert hash(times) > 0
|
39
42
|
|
40
|
-
assert
|
41
|
-
'1970-01-01T00:00:00.000'
|
43
|
+
assert instr(
|
44
|
+
'1970-01-01T00:00:00.000',
|
45
|
+
times)
|
42
46
|
|
43
47
|
|
44
48
|
assert int(times) == 0
|
@@ -15,6 +15,8 @@ from pytest import mark
|
|
15
15
|
from ..window import Window
|
16
16
|
from ..window import window_croniter
|
17
17
|
from ..window import window_interval
|
18
|
+
from ...types import inrepr
|
19
|
+
from ...types import instr
|
18
20
|
|
19
21
|
if TYPE_CHECKING:
|
20
22
|
from ..common import PARSABLE
|
@@ -58,13 +60,15 @@ def test_Window(
|
|
58
60
|
'_Window__walked']
|
59
61
|
|
60
62
|
|
61
|
-
assert
|
62
|
-
'window.Window object'
|
63
|
+
assert inrepr(
|
64
|
+
'window.Window object',
|
65
|
+
window)
|
63
66
|
|
64
67
|
assert hash(window) > 0
|
65
68
|
|
66
|
-
assert
|
67
|
-
'window.Window object'
|
69
|
+
assert instr(
|
70
|
+
'window.Window object',
|
71
|
+
window)
|
68
72
|
|
69
73
|
|
70
74
|
assert window.schedule == '* * * * *'
|
encommon/types/__init__.py
CHANGED
@@ -10,12 +10,24 @@ is permitted, for more information consult the project license file.
|
|
10
10
|
from .dicts import merge_dicts
|
11
11
|
from .dicts import sort_dict
|
12
12
|
from .empty import Empty
|
13
|
+
from .notate import delate
|
14
|
+
from .notate import getate
|
15
|
+
from .notate import setate
|
16
|
+
from .strings import hasstr
|
17
|
+
from .strings import inrepr
|
18
|
+
from .strings import instr
|
13
19
|
from .strings import striplower
|
14
20
|
|
15
21
|
|
16
22
|
|
17
23
|
__all__ = [
|
24
|
+
'delate',
|
18
25
|
'Empty',
|
26
|
+
'getate',
|
27
|
+
'hasstr',
|
28
|
+
'inrepr',
|
29
|
+
'instr',
|
19
30
|
'merge_dicts',
|
31
|
+
'setate',
|
20
32
|
'sort_dict',
|
21
33
|
'striplower']
|