freeplay 0.3.6__py3-none-any.whl → 0.3.7__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.
freeplay/utils.py CHANGED
@@ -1,3 +1,4 @@
1
+ import json
1
2
  from typing import Dict, Union, Optional, Any
2
3
  import importlib.metadata
3
4
  import platform
@@ -20,6 +21,18 @@ def all_valid(obj: Any) -> bool:
20
21
  return False
21
22
 
22
23
 
24
+ class StandardPystache(pystache.Renderer): # type: ignore
25
+
26
+ def __init__(self) -> None:
27
+ super().__init__(escape=lambda s: s)
28
+
29
+ def str_coerce(self, val: Any) -> str:
30
+ if isinstance(val, dict) or isinstance(val, list):
31
+ # We hide spacing after punctuation so that the templating is the same across all SDKs.
32
+ return json.dumps(val, separators=(',', ':'))
33
+ return str(val)
34
+
35
+
23
36
  def bind_template_variables(template: str, variables: InputVariables) -> str:
24
37
  if not all_valid(variables):
25
38
  raise FreeplayError(
@@ -28,7 +41,7 @@ def bind_template_variables(template: str, variables: InputVariables) -> str:
28
41
  )
29
42
 
30
43
  # When rendering mustache, do not escape HTML special characters.
31
- rendered: str = pystache.Renderer(escape=lambda s: s).render(template, variables)
44
+ rendered: str = StandardPystache().render(template, variables)
32
45
  return rendered
33
46
 
34
47
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: freeplay
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: FreePlay Engineering
@@ -13,9 +13,9 @@ freeplay/resources/recordings.py,sha256=kUElo6Yvc6lyo221ghbElx75uxftw7HpgBV_R9gY
13
13
  freeplay/resources/sessions.py,sha256=Qz5v7VOf1DmQTd1wCOFXnrizlW5WFJT5V8-pq22Ifvg,2793
14
14
  freeplay/resources/test_runs.py,sha256=qF4CE4XiX_6epcs5bFKJg73C94YgrJQTxnCJLBERkos,2549
15
15
  freeplay/support.py,sha256=nuly_GCWEAEz0CmjlviadKK2_r4X6RdxxiQ6yo78wdk,8449
16
- freeplay/utils.py,sha256=rMyYav5gu-evMSaShtXVlKT-Eaegg8cUE63X1OCu5S4,2071
17
- freeplay-0.3.6.dist-info/LICENSE,sha256=_jzIw45hB1XHGxiQ8leZ0GH_X7bR_a8qgxaqnHbCUOo,1064
18
- freeplay-0.3.6.dist-info/METADATA,sha256=cuptHHkbxcQOAQ2vm7gjDRUlET5BP7J9mDsXIab40pU,1602
19
- freeplay-0.3.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
20
- freeplay-0.3.6.dist-info/entry_points.txt,sha256=32s3rf2UUCqiJT4jnClEXZhdXlvl30uwpcxz-Gsy4UU,54
21
- freeplay-0.3.6.dist-info/RECORD,,
16
+ freeplay/utils.py,sha256=roDF_4QYKt93XO_hRdQC_mFAORVuqUWgCVAPXTj_vsU,2488
17
+ freeplay-0.3.7.dist-info/LICENSE,sha256=_jzIw45hB1XHGxiQ8leZ0GH_X7bR_a8qgxaqnHbCUOo,1064
18
+ freeplay-0.3.7.dist-info/METADATA,sha256=Br__sIy9olEIWT4tFGfZVXGgDYKMJMpM4NgHXoxhSGw,1602
19
+ freeplay-0.3.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
20
+ freeplay-0.3.7.dist-info/entry_points.txt,sha256=32s3rf2UUCqiJT4jnClEXZhdXlvl30uwpcxz-Gsy4UU,54
21
+ freeplay-0.3.7.dist-info/RECORD,,