encommon 0.22.5__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.5/encommon.egg-info → encommon-0.22.7}/PKG-INFO +3 -2
  2. {encommon-0.22.5 → encommon-0.22.7}/encommon/colors/color.py +46 -0
  3. {encommon-0.22.5 → encommon-0.22.7}/encommon/colors/test/test_color.py +3 -1
  4. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/config.py +20 -0
  5. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/test/test_config.py +25 -2
  6. {encommon-0.22.5 → encommon-0.22.7}/encommon/parse/jinja2.py +50 -0
  7. {encommon-0.22.5 → encommon-0.22.7}/encommon/parse/test/test_jinja2.py +42 -1
  8. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_timers.py +2 -2
  9. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_windows.py +2 -2
  10. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/timers.py +12 -11
  11. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/window.py +4 -4
  12. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/windows.py +12 -11
  13. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/test/test_classes.py +2 -1
  14. encommon-0.22.7/encommon/version.txt +1 -0
  15. {encommon-0.22.5 → encommon-0.22.7/encommon.egg-info}/PKG-INFO +3 -2
  16. encommon-0.22.5/encommon/version.txt +0 -1
  17. {encommon-0.22.5 → encommon-0.22.7}/LICENSE +0 -0
  18. {encommon-0.22.5 → encommon-0.22.7}/MANIFEST.in +0 -0
  19. {encommon-0.22.5 → encommon-0.22.7}/README.md +0 -0
  20. {encommon-0.22.5 → encommon-0.22.7}/encommon/__init__.py +0 -0
  21. {encommon-0.22.5 → encommon-0.22.7}/encommon/colors/__init__.py +0 -0
  22. {encommon-0.22.5 → encommon-0.22.7}/encommon/colors/test/__init__.py +0 -0
  23. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/__init__.py +0 -0
  24. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/files.py +0 -0
  25. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/logger.py +0 -0
  26. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/params.py +0 -0
  27. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/paths.py +0 -0
  28. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/test/__init__.py +0 -0
  29. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/test/test_files.py +0 -0
  30. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/test/test_logger.py +0 -0
  31. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/test/test_paths.py +0 -0
  32. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/test/test_utils.py +0 -0
  33. {encommon-0.22.5 → encommon-0.22.7}/encommon/config/utils.py +0 -0
  34. {encommon-0.22.5 → encommon-0.22.7}/encommon/conftest.py +0 -0
  35. {encommon-0.22.5 → encommon-0.22.7}/encommon/crypts/__init__.py +0 -0
  36. {encommon-0.22.5 → encommon-0.22.7}/encommon/crypts/crypts.py +0 -0
  37. {encommon-0.22.5 → encommon-0.22.7}/encommon/crypts/hashes.py +0 -0
  38. {encommon-0.22.5 → encommon-0.22.7}/encommon/crypts/params.py +0 -0
  39. {encommon-0.22.5 → encommon-0.22.7}/encommon/crypts/test/__init__.py +0 -0
  40. {encommon-0.22.5 → encommon-0.22.7}/encommon/crypts/test/test_crypts.py +0 -0
  41. {encommon-0.22.5 → encommon-0.22.7}/encommon/crypts/test/test_hashes.py +0 -0
  42. {encommon-0.22.5 → encommon-0.22.7}/encommon/parse/__init__.py +0 -0
  43. {encommon-0.22.5 → encommon-0.22.7}/encommon/parse/network.py +0 -0
  44. {encommon-0.22.5 → encommon-0.22.7}/encommon/parse/test/__init__.py +0 -0
  45. {encommon-0.22.5 → encommon-0.22.7}/encommon/parse/test/test_network.py +0 -0
  46. {encommon-0.22.5 → encommon-0.22.7}/encommon/py.typed +0 -0
  47. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/__init__.py +0 -0
  48. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/common.py +0 -0
  49. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/duration.py +0 -0
  50. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/params.py +0 -0
  51. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/parse.py +0 -0
  52. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/__init__.py +0 -0
  53. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_duration.py +0 -0
  54. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_params.py +0 -0
  55. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_parse.py +0 -0
  56. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_time.py +0 -0
  57. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_timer.py +0 -0
  58. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_unitime.py +0 -0
  59. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_utils.py +0 -0
  60. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/test/test_window.py +0 -0
  61. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/time.py +0 -0
  62. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/timer.py +0 -0
  63. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/unitime.py +0 -0
  64. {encommon-0.22.5 → encommon-0.22.7}/encommon/times/utils.py +0 -0
  65. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/__init__.py +0 -0
  66. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/classes.py +0 -0
  67. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/dicts.py +0 -0
  68. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/empty.py +0 -0
  69. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/funcs.py +0 -0
  70. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/lists.py +0 -0
  71. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/notate.py +0 -0
  72. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/strings.py +0 -0
  73. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/test/__init__.py +0 -0
  74. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/test/test_dicts.py +0 -0
  75. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/test/test_empty.py +0 -0
  76. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/test/test_funcs.py +0 -0
  77. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/test/test_lists.py +0 -0
  78. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/test/test_notate.py +0 -0
  79. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/test/test_strings.py +0 -0
  80. {encommon-0.22.5 → encommon-0.22.7}/encommon/types/types.py +0 -0
  81. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/__init__.py +0 -0
  82. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/common.py +0 -0
  83. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/files.py +0 -0
  84. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/match.py +0 -0
  85. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/paths.py +0 -0
  86. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/sample.py +0 -0
  87. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/stdout.py +0 -0
  88. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/test/__init__.py +0 -0
  89. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/test/test_files.py +0 -0
  90. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/test/test_match.py +0 -0
  91. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/test/test_paths.py +0 -0
  92. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/test/test_sample.py +0 -0
  93. {encommon-0.22.5 → encommon-0.22.7}/encommon/utils/test/test_stdout.py +0 -0
  94. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/__init__.py +0 -0
  95. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/content.py +0 -0
  96. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/images/enasis.svg +0 -0
  97. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/images/failure.svg +0 -0
  98. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/images/information.svg +0 -0
  99. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/images/success.svg +0 -0
  100. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/images/warning.svg +0 -0
  101. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/index.html +0 -0
  102. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/color.js +0 -0
  103. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/datagrid.js +0 -0
  104. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/datetime.js +0 -0
  105. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/default.js +0 -0
  106. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/duration.js +0 -0
  107. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/helpers.js +0 -0
  108. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/image.js +0 -0
  109. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/message.js +0 -0
  110. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/moderate.js +0 -0
  111. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/numeric.js +0 -0
  112. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/statate.js +0 -0
  113. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/scripts/tagues.js +0 -0
  114. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/color.css +0 -0
  115. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/datagrid.css +0 -0
  116. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/datetime.css +0 -0
  117. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/default.css +0 -0
  118. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/duration.css +0 -0
  119. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/image.css +0 -0
  120. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/message.css +0 -0
  121. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/moderate.css +0 -0
  122. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/numeric.css +0 -0
  123. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/statate.css +0 -0
  124. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/styles/tagues.css +0 -0
  125. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/__init__.py +0 -0
  126. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/conftest.py +0 -0
  127. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_color.py +0 -0
  128. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_content.py +0 -0
  129. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_datagrid.py +0 -0
  130. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_datetime.py +0 -0
  131. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_default.py +0 -0
  132. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_duration.py +0 -0
  133. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_helpers.py +0 -0
  134. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_image.py +0 -0
  135. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_message.py +0 -0
  136. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_moderate.py +0 -0
  137. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_numeric.py +0 -0
  138. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_statate.py +0 -0
  139. {encommon-0.22.5 → encommon-0.22.7}/encommon/webkit/test/test_tagues.py +0 -0
  140. {encommon-0.22.5 → encommon-0.22.7}/encommon.egg-info/SOURCES.txt +0 -0
  141. {encommon-0.22.5 → encommon-0.22.7}/encommon.egg-info/dependency_links.txt +0 -0
  142. {encommon-0.22.5 → encommon-0.22.7}/encommon.egg-info/requires.txt +0 -0
  143. {encommon-0.22.5 → encommon-0.22.7}/encommon.egg-info/top_level.txt +0 -0
  144. {encommon-0.22.5 → encommon-0.22.7}/pyproject.toml +0 -0
  145. {encommon-0.22.5 → encommon-0.22.7}/require/install.txt +0 -0
  146. {encommon-0.22.5 → encommon-0.22.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: encommon
3
- Version: 0.22.5
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
@@ -20,6 +20,7 @@ Requires-Dist: python-dateutil
20
20
  Requires-Dist: pyyaml
21
21
  Requires-Dist: snaptime
22
22
  Requires-Dist: sqlalchemy
23
+ Dynamic: license-file
23
24
 
24
25
  # Enasis Network Common Library
25
26
 
@@ -7,6 +7,7 @@ is permitted, for more information consult the project license file.
7
7
 
8
8
 
9
9
 
10
+ from colorsys import hls_to_rgb
10
11
  from contextlib import suppress
11
12
  from typing import Union
12
13
 
@@ -61,6 +62,51 @@ class Color:
61
62
  self.__source = source
62
63
 
63
64
 
65
+ @classmethod
66
+ def from_hsl(
67
+ cls,
68
+ hue: int,
69
+ sat: int,
70
+ lev: int,
71
+ ) -> 'Color':
72
+ """
73
+ Initialize instance for class using provided parameters.
74
+ """
75
+
76
+ h, s, l = ( # noqa: E741
77
+ hue / 360,
78
+ sat / 100,
79
+ lev / 100)
80
+
81
+ r, g, b = hls_to_rgb(h, l, s)
82
+
83
+ color = (
84
+ f'{round(r * 255):02X}'
85
+ f'{round(g * 255):02X}'
86
+ f'{round(b * 255):02X}')
87
+
88
+ return cls(color)
89
+
90
+
91
+ @classmethod
92
+ def from_rgb(
93
+ cls,
94
+ red: int,
95
+ green: int,
96
+ blue: int,
97
+ ) -> 'Color':
98
+ """
99
+ Initialize instance for class using provided parameters.
100
+ """
101
+
102
+ value = (
103
+ f'{red:02X}'
104
+ f'{green:02X}'
105
+ f'{blue:02X}')
106
+
107
+ return cls(value)
108
+
109
+
64
110
  def __repr__(
65
111
  self,
66
112
  ) -> str:
@@ -84,6 +84,7 @@ def test_Color_rgb(
84
84
  """
85
85
 
86
86
  assert Color(source).rgb == expect
87
+ assert Color.from_rgb(*expect) == source
87
88
 
88
89
 
89
90
 
@@ -155,7 +156,7 @@ def test_Color_xy(
155
156
  ('ffff00', (60, 100, 50)),
156
157
  ('00ffff', (180, 100, 50)),
157
158
  ('ff00ff', (300, 100, 50)),
158
- ('800080', (300, 100, 25))])
159
+ ('80007F', (300, 100, 25))])
159
160
  def test_Color_hsl(
160
161
  source: str,
161
162
  expect: tuple[int, ...],
@@ -168,6 +169,7 @@ def test_Color_hsl(
168
169
  """
169
170
 
170
171
  assert Color(source).hsl == expect
172
+ assert Color.from_hsl(*expect) == source
171
173
 
172
174
 
173
175
 
@@ -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 }}')
@@ -100,8 +100,8 @@ def test_Timers(
100
100
  '_Timers__params',
101
101
  '_Timers__store',
102
102
  '_Timers__group',
103
- '_Timers__store_engine',
104
- '_Timers__store_session',
103
+ '_Timers__sengine',
104
+ '_Timers__session',
105
105
  '_Timers__timers']
106
106
 
107
107
 
@@ -111,8 +111,8 @@ def test_Windows(
111
111
  '_Windows__params',
112
112
  '_Windows__store',
113
113
  '_Windows__group',
114
- '_Windows__store_engine',
115
- '_Windows__store_session',
114
+ '_Windows__sengine',
115
+ '_Windows__session',
116
116
  '_Windows__start',
117
117
  '_Windows__stop',
118
118
  '_Windows__windows']
@@ -107,8 +107,8 @@ class Timers:
107
107
  __store: str
108
108
  __group: str
109
109
 
110
- __store_engine: Engine
111
- __store_session: (
110
+ __sengine: Engine
111
+ __session: (
112
112
  # pylint: disable=unsubscriptable-object
113
113
  sessionmaker[Session])
114
114
 
@@ -152,17 +152,18 @@ class Timers:
152
152
  Construct instances using the configuration parameters.
153
153
  """
154
154
 
155
- store = self.__store
156
-
157
- engine = create_engine(store)
155
+ sengine = create_engine(
156
+ self.__store,
157
+ pool_pre_ping=True)
158
158
 
159
159
  (SQLBase.metadata
160
- .create_all(engine))
160
+ .create_all(sengine))
161
161
 
162
- session = sessionmaker(engine)
162
+ session = (
163
+ sessionmaker(sengine))
163
164
 
164
- self.__store_engine = engine
165
- self.__store_session = session
165
+ self.__sengine = sengine
166
+ self.__session = session
166
167
 
167
168
 
168
169
  @property
@@ -214,7 +215,7 @@ class Timers:
214
215
  :returns: Value for the attribute from class instance.
215
216
  """
216
217
 
217
- return self.__store_engine
218
+ return self.__sengine
218
219
 
219
220
 
220
221
  @property
@@ -227,7 +228,7 @@ class Timers:
227
228
  :returns: Value for the attribute from class instance.
228
229
  """
229
230
 
230
- return self.__store_session()
231
+ return self.__session()
231
232
 
232
233
 
233
234
  @property
@@ -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(
@@ -109,8 +109,8 @@ class Windows:
109
109
  __store: str
110
110
  __group: str
111
111
 
112
- __store_engine: Engine
113
- __store_session: (
112
+ __sengine: Engine
113
+ __session: (
114
114
  # pylint: disable=unsubscriptable-object
115
115
  sessionmaker[Session])
116
116
 
@@ -168,17 +168,18 @@ class Windows:
168
168
  Construct instances using the configuration parameters.
169
169
  """
170
170
 
171
- store = self.__store
172
-
173
- engine = create_engine(store)
171
+ sengine = create_engine(
172
+ self.__store,
173
+ pool_pre_ping=True)
174
174
 
175
175
  (SQLBase.metadata
176
- .create_all(engine))
176
+ .create_all(sengine))
177
177
 
178
- session = sessionmaker(engine)
178
+ session = (
179
+ sessionmaker(sengine))
179
180
 
180
- self.__store_engine = engine
181
- self.__store_session = session
181
+ self.__sengine = sengine
182
+ self.__session = session
182
183
 
183
184
 
184
185
  @property
@@ -230,7 +231,7 @@ class Windows:
230
231
  :returns: Value for the attribute from class instance.
231
232
  """
232
233
 
233
- return self.__store_engine
234
+ return self.__sengine
234
235
 
235
236
 
236
237
  @property
@@ -243,7 +244,7 @@ class Windows:
243
244
  :returns: Value for the attribute from class instance.
244
245
  """
245
246
 
246
- return self.__store_session()
247
+ return self.__session()
247
248
 
248
249
 
249
250
  @property
@@ -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
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: encommon
3
- Version: 0.22.5
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
@@ -20,6 +20,7 @@ Requires-Dist: python-dateutil
20
20
  Requires-Dist: pyyaml
21
21
  Requires-Dist: snaptime
22
22
  Requires-Dist: sqlalchemy
23
+ Dynamic: license-file
23
24
 
24
25
  # Enasis Network Common Library
25
26
 
@@ -1 +0,0 @@
1
- 0.22.5
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes