encommon 0.22.1__py3-none-any.whl → 0.22.3__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/parse/jinja2.py CHANGED
@@ -45,6 +45,7 @@ from ..utils import rgxp_match
45
45
 
46
46
 
47
47
  FILTER = Callable[..., Any]
48
+ FILTERS = dict[str, FILTER]
48
49
 
49
50
  JINJA2 = (
50
51
  r'(\{\{.+?\}\})|'
@@ -57,7 +58,7 @@ LITERAL = (
57
58
 
58
59
 
59
60
 
60
- DEFAULT: dict[str, FILTER] = {
61
+ DEFAULT: FILTERS = {
61
62
 
62
63
  # Python builtins
63
64
  'all': all,
@@ -115,7 +116,7 @@ class Jinja2:
115
116
  """
116
117
 
117
118
  __statics: DictStrAny
118
- __filters: dict[str, FILTER]
119
+ __filters: FILTERS
119
120
 
120
121
  __jinjenv: Environment
121
122
 
@@ -123,7 +124,7 @@ class Jinja2:
123
124
  def __init__(
124
125
  self,
125
126
  statics: Optional[DictStrAny] = None,
126
- filters: Optional[dict[str, FILTER]] = None,
127
+ filters: Optional[FILTERS] = None,
127
128
  ) -> None:
128
129
  """
129
130
  Initialize instance for class using provided parameters.
@@ -176,7 +177,7 @@ class Jinja2:
176
177
  @property
177
178
  def filters(
178
179
  self,
179
- ) -> dict[str, FILTER]:
180
+ ) -> FILTERS:
180
181
  """
181
182
  Return the value for the attribute from class instance.
182
183
 
encommon/version.txt CHANGED
@@ -1 +1 @@
1
- 0.22.1
1
+ 0.22.3
@@ -91,6 +91,9 @@ is permitted, for more information consult the project license file.
91
91
  $.prototype
92
92
  .attr = _enquery_attr;
93
93
 
94
+ $.prototype
95
+ .prop = _enquery_prop;
96
+
94
97
  })(window);
95
98
 
96
99
 
@@ -181,20 +184,51 @@ function _enquery_remcls(
181
184
  function _enquery_hide() {
182
185
  // Helper function for Enasis Network jQuery replacement.
183
186
 
184
- let returned =
185
- this.css('display', 'none');
186
187
 
187
- return returned; }
188
+ function _each() {
189
+
190
+ let dataset = this.dataset;
191
+ let style = this.style;
192
+ let hide = dataset.enqHide;
193
+
194
+ if (hide === undefined
195
+ && style.display != 'none'
196
+ && !isempty(style.display))
197
+ dataset.enqHide =
198
+ style.display;
199
+
200
+ style.display = 'none'; }
201
+
202
+
203
+ return this.each(_each); }
188
204
 
189
205
 
190
206
 
191
207
  function _enquery_show() {
192
208
  // Helper function for Enasis Network jQuery replacement.
193
209
 
194
- let returned =
195
- this.css('display', 'block');
196
210
 
197
- return returned; }
211
+ function _each() {
212
+
213
+ let dataset = this.dataset;
214
+ let style = this.style;
215
+ let hide = dataset.enqHide;
216
+
217
+ if (hide !== undefined) {
218
+ if (!isempty(hide))
219
+ style.display = hide;
220
+ else
221
+ style
222
+ .removeProperty('display');
223
+
224
+ delete dataset.enqHide; }
225
+
226
+ else
227
+ style
228
+ .removeProperty('display'); }
229
+
230
+
231
+ return this.each(_each); }
198
232
 
199
233
 
200
234
 
@@ -262,7 +296,7 @@ function _enquery_append(
262
296
  (x) => {
263
297
  const element =
264
298
  index < 1 ?
265
- x : node.cloneNode(true);
299
+ x : x.cloneNode(true);
266
300
  this
267
301
  .appendChild(element); }); }
268
302
 
@@ -305,9 +339,17 @@ function _enquery_attr(
305
339
  if (this.length === 0)
306
340
  return undefined;
307
341
 
342
+
343
+ function _each() {
344
+ if (value === null)
345
+ this.removeAttribute(name);
346
+ else
347
+ this.setAttribute(
348
+ name, value); }
349
+
308
350
  if (value !== undefined)
309
- this[0]
310
- .setAttribute(name, value);
351
+ return this.each(_each);
352
+
311
353
 
312
354
  let returned =
313
355
  this[0]
@@ -317,6 +359,30 @@ function _enquery_attr(
317
359
 
318
360
 
319
361
 
362
+ function _enquery_prop(
363
+ name,
364
+ value,
365
+ ) {
366
+ // Helper function for Enasis Network jQuery replacement.
367
+
368
+ if (this.length === 0)
369
+ return undefined;
370
+
371
+
372
+ function _each() {
373
+ if (value === null)
374
+ this.removeProperty(name);
375
+ else
376
+ this[name] = value; }
377
+
378
+ if (value !== undefined)
379
+ return this.each(_each);
380
+
381
+
382
+ return this[0][name]; }
383
+
384
+
385
+
320
386
  function _enquery_clone() {
321
387
 
322
388
  let clones =
@@ -63,6 +63,18 @@ is permitted, for more information consult the project license file.
63
63
 
64
64
 
65
65
 
66
+ /*****************************************/
67
+ /* Extended structure for image elements */
68
+ /*****************************************/
69
+
70
+ :root {
71
+ --svgicon-failure: url('/images/failure');
72
+ --svgicon-information: url('/images/information');
73
+ --svgicon-success: url('/images/success');
74
+ --svgicon-warning: url('/images/warning'); }
75
+
76
+
77
+
66
78
  /************************************/
67
79
  /* Initial default for all elements */
68
80
  /************************************/
@@ -23,18 +23,6 @@ is permitted, for more information consult the project license file.
23
23
 
24
24
 
25
25
 
26
- /*****************************************/
27
- /* Extended structure for image elements */
28
- /*****************************************/
29
-
30
- :root {
31
- --svgicon-failure: url('/images/failure');
32
- --svgicon-information: url('/images/information');
33
- --svgicon-success: url('/images/success');
34
- --svgicon-warning: url('/images/warning'); }
35
-
36
-
37
-
38
26
  /*****************************************/
39
27
  /* Extended structure for image elements */
40
28
  /*****************************************/
@@ -192,7 +192,7 @@ def test_default_showhide(
192
192
  '$("body>div")[0]'
193
193
  '.style.display;')
194
194
 
195
- assert outcome == 'block'
195
+ assert outcome == SEMPTY
196
196
 
197
197
 
198
198
 
@@ -312,3 +312,29 @@ def test_default_attr(
312
312
  wrap=False)
313
313
 
314
314
  assert outcome == 'bar'
315
+
316
+
317
+
318
+ def test_default_prop(
319
+ prepare: tuple['Content', WebDriver],
320
+ ) -> None:
321
+ """
322
+ Perform various tests associated with relevant routines.
323
+
324
+ :param prepare: Driver and content loaded with scripts.
325
+ """
326
+
327
+ content, driver = prepare
328
+
329
+ _executejs(
330
+ driver,
331
+ '$("body")'
332
+ '.prop("foo", "bar")')
333
+
334
+ outcome = _executejs(
335
+ driver,
336
+ 'return $("body")'
337
+ ' .prop("foo");',
338
+ wrap=False)
339
+
340
+ assert outcome == 'bar'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: encommon
3
- Version: 0.22.1
3
+ Version: 0.22.3
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Project-URL: Source, https://github.com/enasisnetwork/encommon
@@ -1,7 +1,7 @@
1
1
  encommon/__init__.py,sha256=YDGzuhpk5Gd1hq54LI0hw1NrrDvrJDrvH20TEy_0l5E,443
2
2
  encommon/conftest.py,sha256=I7Zl2cMytnA-mwSPh0rRjsU0YSlES94jQq6mocRhVUE,1884
3
3
  encommon/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- encommon/version.txt,sha256=zAAcew9-PdrNwUX7bkEB5moR4byCOZ9Z2e0CDAzDAnM,7
4
+ encommon/version.txt,sha256=r3a6YGG-u69k-VBftOr9MFlKWNsYOQQoXGt-j4xqdwE,7
5
5
  encommon/colors/__init__.py,sha256=XRiGimMj8oo040NO5a5ZsbsIUxaGVW4tf4xWTPWgnZY,269
6
6
  encommon/colors/color.py,sha256=rDWWL5oMx2SVSBEuRYX43u71nzMhMTZipXAHmEXwAjQ,10919
7
7
  encommon/colors/test/__init__.py,sha256=PjrnBYT0efyvbaGeNx94dm3tP3EVHUHSVs-VGeLEv5g,218
@@ -27,7 +27,7 @@ encommon/crypts/test/__init__.py,sha256=PjrnBYT0efyvbaGeNx94dm3tP3EVHUHSVs-VGeLE
27
27
  encommon/crypts/test/test_crypts.py,sha256=YKB4Kra-5CRQ8gsLLCYj2s4mjlPuibszUWClPDvMYk0,3504
28
28
  encommon/crypts/test/test_hashes.py,sha256=HEvKHTkWy6Xehh5fRHmntovGbkjWEgMsrVQCmMCBLtA,1223
29
29
  encommon/parse/__init__.py,sha256=6uV4GCm_nOYC77x2jQvTDsa0F6vBGRbCgju_HCc96zM,422
30
- encommon/parse/jinja2.py,sha256=2ZKTWjEGVHp6Dh8fkeMvuFp_AcIzCim-pA3UUf2TXWw,7067
30
+ encommon/parse/jinja2.py,sha256=ZfQN79xLwdPevozRD2aF1OpWDf0_lIWfl2o-4QBW8gY,7055
31
31
  encommon/parse/network.py,sha256=PgQ6xV6Y9KmyH0iXqQ-b88Gtkrry75Fzc-tZd-BH0ng,8771
32
32
  encommon/parse/test/__init__.py,sha256=PjrnBYT0efyvbaGeNx94dm3tP3EVHUHSVs-VGeLEv5g,218
33
33
  encommon/parse/test/test_jinja2.py,sha256=vFi8mzWPDJvFO00aMYSbjLVxctdsSvv_L19r1dVxNr8,3782
@@ -94,7 +94,7 @@ encommon/webkit/images/warning.svg,sha256=IMpCPABJkm1jbR8zOc00Rl3WnHWsdreUCcAI7E
94
94
  encommon/webkit/scripts/color.js,sha256=ExLYQbuC505O643gVXls0tfLTvMRo6n5MVyAok0Irp8,916
95
95
  encommon/webkit/scripts/datagrid.js,sha256=kYXQuY1039qwauwtTzeG9T7Mh-iRayq4_23w08gA4XI,1615
96
96
  encommon/webkit/scripts/datetime.js,sha256=vtNznVMupvAdP4FWCDtHuXQVnRCA3TkPENO4hQdp5tM,2671
97
- encommon/webkit/scripts/default.js,sha256=Noo-yon568Takgrz2wC5-UTS-XxkozqPgrVINiIfaZk,5007
97
+ encommon/webkit/scripts/default.js,sha256=MiPAiI7flCEHfk0M7nF1Yyh0p2f7py62w41jbZKN88E,6092
98
98
  encommon/webkit/scripts/duration.js,sha256=adXtKTgKkLJz_1uuzdc7suc7wUEQzpw7DfqnwXGu7f0,2129
99
99
  encommon/webkit/scripts/helpers.js,sha256=ohpPeeITlE3xV65NZ-uU4sOZwa4DEY11iItzf4VXL8Q,3529
100
100
  encommon/webkit/scripts/image.js,sha256=Y_Vd4K22MzUM9oGcFKxpGsZRYdbYvLQ0flGApqh_GJQ,630
@@ -106,9 +106,9 @@ encommon/webkit/scripts/tagues.js,sha256=nS6-M5480M6xx8a4pQxLYNJEs-pkbUEaZ6Www4G
106
106
  encommon/webkit/styles/color.css,sha256=34LegW5fuS1HLWAN9vv8EKnrwiMkzuHFLY2QQbQiah8,1433
107
107
  encommon/webkit/styles/datagrid.css,sha256=wlVlW4aFpJKzFCRft1T9Dl43xv6Vwz7gZnlHzYFz24c,1518
108
108
  encommon/webkit/styles/datetime.css,sha256=3mTiM9-FhgR5EOMYk8sMvR44yh_h9nZxsgcLoawOR_U,1120
109
- encommon/webkit/styles/default.css,sha256=naG2scDuOL9l0r75u9LmsJRgYHjahgbAlCnvZRJtJ9s,4632
109
+ encommon/webkit/styles/default.css,sha256=NvJ7SIAuIDVhDDnkKe2J6LqWlrNAwjoZ2JMQE5rbNrY,4966
110
110
  encommon/webkit/styles/duration.css,sha256=iUTQJWIMf7xaAxXEsJ-_zRZzSPiebxO_mnHZGrymVTk,1012
111
- encommon/webkit/styles/image.css,sha256=VEFij-V8Gd_N-A91wtlGW_-D2hPggkZvECegG4CrjZg,1786
111
+ encommon/webkit/styles/image.css,sha256=Sh8Mg5CZAU43jN4jJJCFpZZV7UjOKaWp4sgff8S-VNU,1452
112
112
  encommon/webkit/styles/message.css,sha256=8IEEWkaUPjdd_h2jo8i0X-D9wYCo1SZ4UnmqYI4uZ5A,2560
113
113
  encommon/webkit/styles/moderate.css,sha256=XFTKc-IOe6wY7L76aZ6Q1i1R42ffSNagsY6_SDNs1Fk,1373
114
114
  encommon/webkit/styles/numeric.css,sha256=PT8bNMnfSRMg4ZPTLH7L3iT0ZQyz5hf8mYxWSIrvB8I,1176
@@ -120,7 +120,7 @@ encommon/webkit/test/test_color.py,sha256=N3CnNpHrEzseKa39G42NX4BLOqrqubMfgTT-FE
120
120
  encommon/webkit/test/test_content.py,sha256=bZp0vc5qEjcWaXGLfN0U3bNIwS36q-uRq-TEHkoNPNg,1571
121
121
  encommon/webkit/test/test_datagrid.py,sha256=Shr10cqiBaA2zMwO8rQVvELd_ndngh2ZxZNOncoKjso,1758
122
122
  encommon/webkit/test/test_datetime.py,sha256=cU6huMjuzdbK5SnZIEViY7KH-39fzvwkWC2NNblpoFY,1927
123
- encommon/webkit/test/test_default.py,sha256=XzRpCQ7w_mKSD3X_2v3YywlV4sGzzsZBOdQ6zDRzx_I,5985
123
+ encommon/webkit/test/test_default.py,sha256=bnpV2-DeZEOH89Z0RD7EtoQg0_IGb1R3Bc3nza8Rea8,6461
124
124
  encommon/webkit/test/test_duration.py,sha256=5NibaszwPFJYoTFF3GF6GaG7prQJrmANvCciSBJdk74,1763
125
125
  encommon/webkit/test/test_helpers.py,sha256=Ms4PsaUWLyllh05HqiVyBumbN_RJcBXxvfmstsKXvys,7165
126
126
  encommon/webkit/test/test_image.py,sha256=RiY2pFPeyb8ofsxOifHHKaLZ1QHxJH90ZE5qFts7joQ,1298
@@ -129,8 +129,8 @@ encommon/webkit/test/test_moderate.py,sha256=KitKGBtwHOQm0pXXZA5nl9MwAi2pbHOsKhM
129
129
  encommon/webkit/test/test_numeric.py,sha256=9Jqiyo-Bh572QJSyd3gqRwYTifnqqzE7_cNCmLn0CG0,3531
130
130
  encommon/webkit/test/test_statate.py,sha256=4VvmyJhsK3TSK-hq3TzkzwPkXY-GPTU_7uJf-zG_y_s,1760
131
131
  encommon/webkit/test/test_tagues.py,sha256=LQWk6rSBoBxAu-YmUOU8uWNki5RBzk5lp0dbFpySg68,1431
132
- encommon-0.22.1.dist-info/LICENSE,sha256=otnXKCtMjPlbHs0wgZ_BWULrp3g_2dWQJ6icRk9nkgg,1071
133
- encommon-0.22.1.dist-info/METADATA,sha256=lzCWu75xREB-fVJHCqZYFGXDrdIbxejGSAtJN8FScyo,4282
134
- encommon-0.22.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
135
- encommon-0.22.1.dist-info/top_level.txt,sha256=bP8q7-5tLDNm-3XPlqn_bDENfYNug5801H_xfz3BEAM,9
136
- encommon-0.22.1.dist-info/RECORD,,
132
+ encommon-0.22.3.dist-info/LICENSE,sha256=otnXKCtMjPlbHs0wgZ_BWULrp3g_2dWQJ6icRk9nkgg,1071
133
+ encommon-0.22.3.dist-info/METADATA,sha256=-_z1eC7mtGd0-t1ob5W25qrxpe0rJh5aCN4bIWPeNX4,4282
134
+ encommon-0.22.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
135
+ encommon-0.22.3.dist-info/top_level.txt,sha256=bP8q7-5tLDNm-3XPlqn_bDENfYNug5801H_xfz3BEAM,9
136
+ encommon-0.22.3.dist-info/RECORD,,