encommon 0.22.6__tar.gz → 0.22.7__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 (146) hide show
  1. {encommon-0.22.6/encommon.egg-info → encommon-0.22.7}/PKG-INFO +1 -1
  2. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/config.py +20 -0
  3. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/test/test_config.py +25 -2
  4. {encommon-0.22.6 → encommon-0.22.7}/encommon/parse/jinja2.py +50 -0
  5. {encommon-0.22.6 → encommon-0.22.7}/encommon/parse/test/test_jinja2.py +42 -1
  6. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/window.py +4 -4
  7. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/test/test_classes.py +2 -1
  8. encommon-0.22.7/encommon/version.txt +1 -0
  9. {encommon-0.22.6 → encommon-0.22.7/encommon.egg-info}/PKG-INFO +1 -1
  10. encommon-0.22.6/encommon/version.txt +0 -1
  11. {encommon-0.22.6 → encommon-0.22.7}/LICENSE +0 -0
  12. {encommon-0.22.6 → encommon-0.22.7}/MANIFEST.in +0 -0
  13. {encommon-0.22.6 → encommon-0.22.7}/README.md +0 -0
  14. {encommon-0.22.6 → encommon-0.22.7}/encommon/__init__.py +0 -0
  15. {encommon-0.22.6 → encommon-0.22.7}/encommon/colors/__init__.py +0 -0
  16. {encommon-0.22.6 → encommon-0.22.7}/encommon/colors/color.py +0 -0
  17. {encommon-0.22.6 → encommon-0.22.7}/encommon/colors/test/__init__.py +0 -0
  18. {encommon-0.22.6 → encommon-0.22.7}/encommon/colors/test/test_color.py +0 -0
  19. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/__init__.py +0 -0
  20. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/files.py +0 -0
  21. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/logger.py +0 -0
  22. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/params.py +0 -0
  23. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/paths.py +0 -0
  24. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/test/__init__.py +0 -0
  25. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/test/test_files.py +0 -0
  26. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/test/test_logger.py +0 -0
  27. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/test/test_paths.py +0 -0
  28. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/test/test_utils.py +0 -0
  29. {encommon-0.22.6 → encommon-0.22.7}/encommon/config/utils.py +0 -0
  30. {encommon-0.22.6 → encommon-0.22.7}/encommon/conftest.py +0 -0
  31. {encommon-0.22.6 → encommon-0.22.7}/encommon/crypts/__init__.py +0 -0
  32. {encommon-0.22.6 → encommon-0.22.7}/encommon/crypts/crypts.py +0 -0
  33. {encommon-0.22.6 → encommon-0.22.7}/encommon/crypts/hashes.py +0 -0
  34. {encommon-0.22.6 → encommon-0.22.7}/encommon/crypts/params.py +0 -0
  35. {encommon-0.22.6 → encommon-0.22.7}/encommon/crypts/test/__init__.py +0 -0
  36. {encommon-0.22.6 → encommon-0.22.7}/encommon/crypts/test/test_crypts.py +0 -0
  37. {encommon-0.22.6 → encommon-0.22.7}/encommon/crypts/test/test_hashes.py +0 -0
  38. {encommon-0.22.6 → encommon-0.22.7}/encommon/parse/__init__.py +0 -0
  39. {encommon-0.22.6 → encommon-0.22.7}/encommon/parse/network.py +0 -0
  40. {encommon-0.22.6 → encommon-0.22.7}/encommon/parse/test/__init__.py +0 -0
  41. {encommon-0.22.6 → encommon-0.22.7}/encommon/parse/test/test_network.py +0 -0
  42. {encommon-0.22.6 → encommon-0.22.7}/encommon/py.typed +0 -0
  43. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/__init__.py +0 -0
  44. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/common.py +0 -0
  45. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/duration.py +0 -0
  46. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/params.py +0 -0
  47. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/parse.py +0 -0
  48. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/__init__.py +0 -0
  49. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_duration.py +0 -0
  50. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_params.py +0 -0
  51. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_parse.py +0 -0
  52. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_time.py +0 -0
  53. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_timer.py +0 -0
  54. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_timers.py +0 -0
  55. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_unitime.py +0 -0
  56. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_utils.py +0 -0
  57. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_window.py +0 -0
  58. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/test/test_windows.py +0 -0
  59. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/time.py +0 -0
  60. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/timer.py +0 -0
  61. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/timers.py +0 -0
  62. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/unitime.py +0 -0
  63. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/utils.py +0 -0
  64. {encommon-0.22.6 → encommon-0.22.7}/encommon/times/windows.py +0 -0
  65. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/__init__.py +0 -0
  66. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/classes.py +0 -0
  67. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/dicts.py +0 -0
  68. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/empty.py +0 -0
  69. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/funcs.py +0 -0
  70. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/lists.py +0 -0
  71. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/notate.py +0 -0
  72. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/strings.py +0 -0
  73. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/test/__init__.py +0 -0
  74. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/test/test_dicts.py +0 -0
  75. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/test/test_empty.py +0 -0
  76. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/test/test_funcs.py +0 -0
  77. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/test/test_lists.py +0 -0
  78. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/test/test_notate.py +0 -0
  79. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/test/test_strings.py +0 -0
  80. {encommon-0.22.6 → encommon-0.22.7}/encommon/types/types.py +0 -0
  81. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/__init__.py +0 -0
  82. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/common.py +0 -0
  83. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/files.py +0 -0
  84. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/match.py +0 -0
  85. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/paths.py +0 -0
  86. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/sample.py +0 -0
  87. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/stdout.py +0 -0
  88. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/test/__init__.py +0 -0
  89. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/test/test_files.py +0 -0
  90. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/test/test_match.py +0 -0
  91. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/test/test_paths.py +0 -0
  92. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/test/test_sample.py +0 -0
  93. {encommon-0.22.6 → encommon-0.22.7}/encommon/utils/test/test_stdout.py +0 -0
  94. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/__init__.py +0 -0
  95. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/content.py +0 -0
  96. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/images/enasis.svg +0 -0
  97. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/images/failure.svg +0 -0
  98. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/images/information.svg +0 -0
  99. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/images/success.svg +0 -0
  100. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/images/warning.svg +0 -0
  101. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/index.html +0 -0
  102. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/color.js +0 -0
  103. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/datagrid.js +0 -0
  104. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/datetime.js +0 -0
  105. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/default.js +0 -0
  106. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/duration.js +0 -0
  107. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/helpers.js +0 -0
  108. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/image.js +0 -0
  109. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/message.js +0 -0
  110. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/moderate.js +0 -0
  111. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/numeric.js +0 -0
  112. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/statate.js +0 -0
  113. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/scripts/tagues.js +0 -0
  114. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/color.css +0 -0
  115. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/datagrid.css +0 -0
  116. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/datetime.css +0 -0
  117. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/default.css +0 -0
  118. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/duration.css +0 -0
  119. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/image.css +0 -0
  120. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/message.css +0 -0
  121. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/moderate.css +0 -0
  122. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/numeric.css +0 -0
  123. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/statate.css +0 -0
  124. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/styles/tagues.css +0 -0
  125. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/__init__.py +0 -0
  126. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/conftest.py +0 -0
  127. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_color.py +0 -0
  128. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_content.py +0 -0
  129. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_datagrid.py +0 -0
  130. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_datetime.py +0 -0
  131. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_default.py +0 -0
  132. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_duration.py +0 -0
  133. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_helpers.py +0 -0
  134. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_image.py +0 -0
  135. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_message.py +0 -0
  136. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_moderate.py +0 -0
  137. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_numeric.py +0 -0
  138. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_statate.py +0 -0
  139. {encommon-0.22.6 → encommon-0.22.7}/encommon/webkit/test/test_tagues.py +0 -0
  140. {encommon-0.22.6 → encommon-0.22.7}/encommon.egg-info/SOURCES.txt +0 -0
  141. {encommon-0.22.6 → encommon-0.22.7}/encommon.egg-info/dependency_links.txt +0 -0
  142. {encommon-0.22.6 → encommon-0.22.7}/encommon.egg-info/requires.txt +0 -0
  143. {encommon-0.22.6 → encommon-0.22.7}/encommon.egg-info/top_level.txt +0 -0
  144. {encommon-0.22.6 → encommon-0.22.7}/pyproject.toml +0 -0
  145. {encommon-0.22.6 → encommon-0.22.7}/require/install.txt +0 -0
  146. {encommon-0.22.6 → encommon-0.22.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: encommon
3
- Version: 0.22.6
3
+ Version: 0.22.7
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Project-URL: Source, https://github.com/enasisnetwork/encommon
@@ -18,6 +18,7 @@ from .params import Params
18
18
  from .paths import ConfigPaths
19
19
  from .utils import config_paths
20
20
  from ..crypts import Crypts
21
+ from ..parse import Jinja2
21
22
  from ..types import DictStrAny
22
23
  from ..types import merge_dicts
23
24
  from ..types import setate
@@ -64,6 +65,7 @@ class Config:
64
65
  __params: Optional[Params]
65
66
  __logger: Optional[Logger]
66
67
  __crypts: Optional[Crypts]
68
+ __jinja2: Jinja2
67
69
 
68
70
 
69
71
  def __init__(
@@ -104,6 +106,11 @@ class Config:
104
106
  self.__logger = None
105
107
  self.__crypts = None
106
108
 
109
+ jinja2 = Jinja2({
110
+ 'config': self})
111
+
112
+ self.__jinja2 = jinja2
113
+
107
114
 
108
115
  @property
109
116
  def files(
@@ -325,3 +332,16 @@ class Config:
325
332
  self.__crypts = crypts
326
333
 
327
334
  return self.__crypts
335
+
336
+
337
+ @property
338
+ def jinja2(
339
+ self,
340
+ ) -> Jinja2:
341
+ """
342
+ Return the value for the attribute from class instance.
343
+
344
+ :returns: Value for the attribute from class instance.
345
+ """
346
+
347
+ return self.__jinja2
@@ -24,7 +24,7 @@ if TYPE_CHECKING:
24
24
 
25
25
 
26
26
 
27
- def test_Config(
27
+ def test_Config( # noqa: CFQ001
28
28
  tmp_path: Path,
29
29
  config: 'Config',
30
30
  ) -> None:
@@ -46,7 +46,8 @@ def test_Config(
46
46
  '_Config__params',
47
47
  '_Config__paths',
48
48
  '_Config__logger',
49
- '_Config__crypts']
49
+ '_Config__crypts',
50
+ '_Config__jinja2']
50
51
 
51
52
 
52
53
  assert inrepr(
@@ -83,6 +84,8 @@ def test_Config(
83
84
 
84
85
  assert config.crypts
85
86
 
87
+ assert config.jinja2
88
+
86
89
 
87
90
  replaces = {
88
91
  'pytemp': tmp_path,
@@ -138,6 +141,26 @@ def test_Config(
138
141
 
139
142
 
140
143
 
144
+ def test_Config_jinja2(
145
+ config: 'Config',
146
+ ) -> None:
147
+ """
148
+ Perform various tests associated with relevant routines.
149
+
150
+ :param config: Primary class instance for configuration.
151
+ """
152
+
153
+ jinja2 = config.jinja2
154
+ j2parse = jinja2.parse
155
+
156
+ parsed = j2parse(
157
+ '{{ foo }}',
158
+ {'foo': 'bar'})
159
+
160
+ assert parsed == 'bar'
161
+
162
+
163
+
141
164
  def test_Config_cover(
142
165
  config: 'Config',
143
166
  ) -> None:
@@ -331,3 +331,53 @@ class Jinja2:
331
331
 
332
332
 
333
333
  return value
334
+
335
+
336
+ def set_static(
337
+ self,
338
+ key: str,
339
+ value: Optional[Any] = None,
340
+ ) -> None:
341
+ """
342
+ Simply add the provided static into internal reference.
343
+
344
+ :param key: Where item will be inserted into reference.
345
+ :param value: Item that will be inserted into internal.
346
+ """
347
+
348
+ statics = self.__statics
349
+
350
+ if value is None:
351
+
352
+ if key in statics:
353
+ del statics[key]
354
+
355
+ return None
356
+
357
+ statics[key] = value
358
+
359
+
360
+ def set_filter(
361
+ self,
362
+ key: str,
363
+ value: Optional[FILTER] = None,
364
+ ) -> None:
365
+ """
366
+ Simply add the provided filter into internal reference.
367
+
368
+ :param key: Where item will be inserted into reference.
369
+ :param value: Item that will be inserted into internal.
370
+ """
371
+
372
+ jinjenv = self.__jinjenv
373
+
374
+ filters = jinjenv.filters
375
+
376
+ if value is None:
377
+
378
+ if key in filters:
379
+ del filters[key]
380
+
381
+ return None
382
+
383
+ filters[key] = value
@@ -11,6 +11,7 @@ from typing import Any
11
11
 
12
12
  from pytest import fixture
13
13
  from pytest import mark
14
+ from pytest import raises
14
15
 
15
16
  from ..jinja2 import Jinja2
16
17
  from ... import PROJECT
@@ -171,7 +172,7 @@ def test_Jinja2_literal(
171
172
  ('{{ "01" }}', '01'),
172
173
  ('-01', '-01'),
173
174
  ('{{ "-01" }}', '-01')])
174
- def test_Jinja2_cover(
175
+ def test_Jinja2_parse(
175
176
  jinja2: Jinja2,
176
177
  value: Any, # noqa: ANN401
177
178
  expect: Any, # noqa: ANN401
@@ -189,3 +190,43 @@ def test_Jinja2_cover(
189
190
  parsed = parse(value)
190
191
 
191
192
  assert parsed == expect
193
+
194
+
195
+
196
+ def test_Jinja2_cover(
197
+ jinja2: Jinja2,
198
+ ) -> None:
199
+ """
200
+ Perform various tests associated with relevant routines.
201
+
202
+ :param jinja2: Parsing class for the Jinja2 templating.
203
+ """
204
+
205
+ parse = jinja2.parse
206
+
207
+
208
+ jinja2.set_static(
209
+ 'key', 'value')
210
+
211
+ parsed = parse('{{ key }}')
212
+
213
+ assert parsed == 'value'
214
+
215
+ jinja2.set_static('key')
216
+
217
+ with raises(Exception):
218
+ parse('{{ key }}')
219
+
220
+
221
+ jinja2.set_filter(
222
+ 'float', float)
223
+
224
+ parsed = parse(
225
+ '{{ 1 | float }}')
226
+
227
+ assert parsed == 1.0
228
+
229
+ jinja2.set_filter('float')
230
+
231
+ with raises(Exception):
232
+ parse('{{ 1 | float }}')
@@ -331,22 +331,22 @@ def window_croniter( # noqa: CFQ004
331
331
  source: datetime,
332
332
  ) -> datetime:
333
333
 
334
- source = (
334
+ parse = (
335
335
  _operator(source)
336
336
  .get_next())
337
337
 
338
- return parse_time(source)
338
+ return parse_time(parse)
339
339
 
340
340
 
341
341
  def _wlast(
342
342
  source: datetime,
343
343
  ) -> datetime:
344
344
 
345
- source = (
345
+ parse = (
346
346
  _operator(source)
347
347
  .get_prev())
348
348
 
349
- return parse_time(source)
349
+ return parse_time(parse)
350
350
 
351
351
 
352
352
  def _operator(
@@ -71,4 +71,5 @@ def test_lattrs(
71
71
  '_Config__params',
72
72
  '_Config__paths',
73
73
  '_Config__logger',
74
- '_Config__crypts']
74
+ '_Config__crypts',
75
+ '_Config__jinja2']
@@ -0,0 +1 @@
1
+ 0.22.7
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: encommon
3
- Version: 0.22.6
3
+ Version: 0.22.7
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Project-URL: Source, https://github.com/enasisnetwork/encommon
@@ -1 +0,0 @@
1
- 0.22.6
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes