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.
Files changed (70) hide show
  1. {encommon-0.7.3/encommon.egg-info → encommon-0.7.5}/PKG-INFO +1 -1
  2. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/sample.py +21 -9
  3. encommon-0.7.5/encommon/version.txt +1 -0
  4. {encommon-0.7.3 → encommon-0.7.5/encommon.egg-info}/PKG-INFO +1 -1
  5. {encommon-0.7.3 → encommon-0.7.5}/setup.cfg +2 -1
  6. encommon-0.7.3/encommon/version.txt +0 -1
  7. {encommon-0.7.3 → encommon-0.7.5}/LICENSE +0 -0
  8. {encommon-0.7.3 → encommon-0.7.5}/MANIFEST.in +0 -0
  9. {encommon-0.7.3 → encommon-0.7.5}/README.md +0 -0
  10. {encommon-0.7.3 → encommon-0.7.5}/encommon/__init__.py +0 -0
  11. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/__init__.py +0 -0
  12. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/common.py +0 -0
  13. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/config.py +0 -0
  14. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/files.py +0 -0
  15. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/logger.py +0 -0
  16. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/params.py +0 -0
  17. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/paths.py +0 -0
  18. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/__init__.py +0 -0
  19. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_common.py +0 -0
  20. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_config.py +0 -0
  21. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_files.py +0 -0
  22. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_logger.py +0 -0
  23. {encommon-0.7.3 → encommon-0.7.5}/encommon/config/test/test_paths.py +0 -0
  24. {encommon-0.7.3 → encommon-0.7.5}/encommon/conftest.py +0 -0
  25. {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/__init__.py +0 -0
  26. {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/crypts.py +0 -0
  27. {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/hashes.py +0 -0
  28. {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/params.py +0 -0
  29. {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/test/__init__.py +0 -0
  30. {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/test/test_crypts.py +0 -0
  31. {encommon-0.7.3 → encommon-0.7.5}/encommon/crypts/test/test_hashes.py +0 -0
  32. {encommon-0.7.3 → encommon-0.7.5}/encommon/py.typed +0 -0
  33. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/__init__.py +0 -0
  34. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/common.py +0 -0
  35. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/duration.py +0 -0
  36. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/parse.py +0 -0
  37. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/__init__.py +0 -0
  38. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_common.py +0 -0
  39. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_duration.py +0 -0
  40. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_parse.py +0 -0
  41. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_timers.py +0 -0
  42. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_times.py +0 -0
  43. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/test/test_window.py +0 -0
  44. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/timers.py +0 -0
  45. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/times.py +0 -0
  46. {encommon-0.7.3 → encommon-0.7.5}/encommon/times/window.py +0 -0
  47. {encommon-0.7.3 → encommon-0.7.5}/encommon/types/__init__.py +0 -0
  48. {encommon-0.7.3 → encommon-0.7.5}/encommon/types/dicts.py +0 -0
  49. {encommon-0.7.3 → encommon-0.7.5}/encommon/types/empty.py +0 -0
  50. {encommon-0.7.3 → encommon-0.7.5}/encommon/types/strings.py +0 -0
  51. {encommon-0.7.3 → encommon-0.7.5}/encommon/types/test/__init__.py +0 -0
  52. {encommon-0.7.3 → encommon-0.7.5}/encommon/types/test/test_dicts.py +0 -0
  53. {encommon-0.7.3 → encommon-0.7.5}/encommon/types/test/test_empty.py +0 -0
  54. {encommon-0.7.3 → encommon-0.7.5}/encommon/types/test/test_strings.py +0 -0
  55. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/__init__.py +0 -0
  56. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/common.py +0 -0
  57. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/match.py +0 -0
  58. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/paths.py +0 -0
  59. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/stdout.py +0 -0
  60. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/__init__.py +0 -0
  61. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/test_match.py +0 -0
  62. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/test_paths.py +0 -0
  63. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/test_sample.py +0 -0
  64. {encommon-0.7.3 → encommon-0.7.5}/encommon/utils/test/test_stdout.py +0 -0
  65. {encommon-0.7.3 → encommon-0.7.5}/encommon.egg-info/SOURCES.txt +0 -0
  66. {encommon-0.7.3 → encommon-0.7.5}/encommon.egg-info/dependency_links.txt +0 -0
  67. {encommon-0.7.3 → encommon-0.7.5}/encommon.egg-info/requires.txt +0 -0
  68. {encommon-0.7.3 → encommon-0.7.5}/encommon.egg-info/top_level.txt +0 -0
  69. {encommon-0.7.3 → encommon-0.7.5}/pyproject.toml +0 -0
  70. {encommon-0.7.3 → encommon-0.7.5}/reqs-install.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -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, # noqa: ANN401
31
+ content: Any,
24
32
  *,
25
33
  default: Callable[[Any], str] = str,
26
- replace: Optional[dict[str, str]] = None,
27
- ) -> Any: # noqa: ANN401
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': str(PROJECT.resolve()),
59
- 'WORKSPACE': str(WORKSPACE.resolve())}
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[dict[str, str]] = None,
76
- ) -> Any: # noqa: ANN401
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: # noqa: ANN401
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(): # noqa: SIM114
139
+ if not path.exists():
128
140
  _save_sample()
129
141
 
130
142
  elif (update is True
@@ -0,0 +1 @@
1
+ 0.7.5
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -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
- pragma: no cover
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