encommon 0.7.3__tar.gz → 0.7.5__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.
- {encommon-0.7.3/encommon.egg-info → encommon-0.7.5}/PKG-INFO +1 -1
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/sample.py +21 -9
- encommon-0.7.5/encommon/version.txt +1 -0
- {encommon-0.7.3 → encommon-0.7.5/encommon.egg-info}/PKG-INFO +1 -1
- {encommon-0.7.3 → encommon-0.7.5}/setup.cfg +2 -1
- encommon-0.7.3/encommon/version.txt +0 -1
- {encommon-0.7.3 → encommon-0.7.5}/LICENSE +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/MANIFEST.in +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/README.md +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/common.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/config.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/files.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/logger.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/params.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/paths.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_common.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_config.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_files.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_logger.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_paths.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/conftest.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/crypts.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/hashes.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/params.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/test/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/test/test_crypts.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/test/test_hashes.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/py.typed +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/common.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/duration.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/parse.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_common.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_duration.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_parse.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_timers.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_times.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_window.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/timers.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/times.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/times/window.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/types/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/types/dicts.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/types/empty.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/types/strings.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/types/test/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/types/test/test_dicts.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/types/test/test_empty.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/types/test/test_strings.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/common.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/match.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/paths.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/stdout.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/__init__.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/test_match.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/test_paths.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/test_sample.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/test_stdout.py +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon.egg-info/SOURCES.txt +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon.egg-info/dependency_links.txt +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon.egg-info/requires.txt +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/encommon.egg-info/top_level.txt +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/pyproject.toml +0 -0
- {encommon-0.7.3 → encommon-0.7.5}/reqs-install.txt +0 -0
@@ -13,18 +13,26 @@ from pathlib import Path
|
|
13
13
|
from typing import Any
|
14
14
|
from typing import Callable
|
15
15
|
from typing import Optional
|
16
|
+
from typing import Union
|
16
17
|
|
17
18
|
from .. import PROJECT
|
18
19
|
from .. import WORKSPACE
|
19
20
|
|
20
21
|
|
21
22
|
|
23
|
+
_REPLACE = Union[
|
24
|
+
dict[str, str],
|
25
|
+
dict[str, str | Path],
|
26
|
+
dict[str, Path]]
|
27
|
+
|
28
|
+
|
29
|
+
|
22
30
|
def prep_sample(
|
23
|
-
content: Any,
|
31
|
+
content: Any,
|
24
32
|
*,
|
25
33
|
default: Callable[[Any], str] = str,
|
26
|
-
replace: Optional[
|
27
|
-
) -> Any:
|
34
|
+
replace: Optional[_REPLACE] = None,
|
35
|
+
) -> Any:
|
28
36
|
"""
|
29
37
|
Return the content after processing using JSON functions.
|
30
38
|
|
@@ -55,10 +63,14 @@ def prep_sample(
|
|
55
63
|
replace = replace or {}
|
56
64
|
|
57
65
|
replace |= {
|
58
|
-
'PROJECT':
|
59
|
-
'WORKSPACE':
|
66
|
+
'PROJECT': PROJECT,
|
67
|
+
'WORKSPACE': WORKSPACE}
|
60
68
|
|
61
69
|
for old, new in replace.items():
|
70
|
+
|
71
|
+
if isinstance(new, Path):
|
72
|
+
new = str(new)
|
73
|
+
|
62
74
|
content = content.replace(
|
63
75
|
new, f'_/{prefix}/{old}/_')
|
64
76
|
|
@@ -72,8 +84,8 @@ def load_sample(
|
|
72
84
|
update: bool = False,
|
73
85
|
*,
|
74
86
|
default: Callable[[Any], str] = str,
|
75
|
-
replace: Optional[
|
76
|
-
) -> Any:
|
87
|
+
replace: Optional[_REPLACE] = None,
|
88
|
+
) -> Any:
|
77
89
|
"""
|
78
90
|
Load the sample file and compare using provided content.
|
79
91
|
|
@@ -115,7 +127,7 @@ def load_sample(
|
|
115
127
|
dumps(content, indent=2))
|
116
128
|
|
117
129
|
|
118
|
-
def _load_sample() -> Any:
|
130
|
+
def _load_sample() -> Any:
|
119
131
|
return loads(
|
120
132
|
path.read_text(
|
121
133
|
encoding='utf-8'))
|
@@ -124,7 +136,7 @@ def load_sample(
|
|
124
136
|
if path.exists():
|
125
137
|
loaded = _load_sample()
|
126
138
|
|
127
|
-
if not path.exists():
|
139
|
+
if not path.exists():
|
128
140
|
_save_sample()
|
129
141
|
|
130
142
|
elif (update is True
|
@@ -0,0 +1 @@
|
|
1
|
+
0.7.5
|
@@ -12,6 +12,7 @@ ignore =
|
|
12
12
|
per-file-ignores =
|
13
13
|
encommon/crypts/hashes.py:S324,
|
14
14
|
encommon/times/timers.py:S608,
|
15
|
+
encommon/utils/sample.py:ANN401,SIM114,
|
15
16
|
encommon/utils/stdout.py:SIM114,
|
16
17
|
encommon/utils/test/test_stdout.py:LIT015,
|
17
18
|
|
@@ -21,7 +22,7 @@ strict = True
|
|
21
22
|
|
22
23
|
[coverage:report]
|
23
24
|
exclude_lines =
|
24
|
-
|
25
|
+
NOCVR
|
25
26
|
if TYPE_CHECKING
|
26
27
|
|
27
28
|
[egg_info]
|
@@ -1 +0,0 @@
|
|
1
|
-
0.7.3
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|