pyview-web 0.0.22__py3-none-any.whl → 0.0.24__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.

Potentially problematic release.


This version of pyview-web might be problematic. Click here for more details.

@@ -11,10 +11,14 @@ class PartsComprehension:
11
11
  def __init__(self, parts: list[Part]):
12
12
  self.parts = parts
13
13
 
14
- def render_parts(self) -> dict[str, Any]:
14
+ def render_parts(self) -> Union[dict[str, Any], str]:
15
15
  if len(self.parts) == 0:
16
16
  return ""
17
17
 
18
+ if len(self.parts) == 1:
19
+ if isinstance(self.parts[0], PartsTree) and self.parts[0].is_empty():
20
+ return ""
21
+
18
22
  def render(p: Part) -> Any:
19
23
  if isinstance(p, str):
20
24
  return p
@@ -38,17 +42,13 @@ class PartsTree:
38
42
  self.statics.append(s)
39
43
 
40
44
  def add_dynamic(self, d: Union[Part, list[Part]]):
41
-
42
45
  if len(self.statics) < len(self.dynamics) + 1:
43
46
  self.statics.append("")
44
47
 
45
48
  if isinstance(d, str):
46
49
  self.dynamics.append(d)
47
50
  elif isinstance(d, list):
48
- if len(d) > 1:
49
- self.dynamics.append(PartsComprehension(d))
50
- elif len(d) == 1:
51
- self.dynamics.append(d[0].flatten())
51
+ self.dynamics.append(PartsComprehension(d))
52
52
  else:
53
53
  self.dynamics.append(d.flatten())
54
54
 
@@ -85,3 +85,8 @@ class PartsTree:
85
85
  resp[f"{i}"] = dynamic.render_parts()
86
86
 
87
87
  return resp
88
+
89
+ def is_empty(self) -> bool:
90
+ return len(self.dynamics) == 0 and (
91
+ len(self.statics) == 0 or (len(self.statics) == 1 and self.statics[0] == "")
92
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyview-web
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Summary: LiveView in Python
5
5
  Home-page: https://pyview.rocks
6
6
  License: MIT
@@ -37,10 +37,10 @@ pyview/vendor/ibis/filters.py,sha256=M36KS6dlzfsb2NmHkbVuo8gJbiQ6aQjcHzXxHwZ3Afw
37
37
  pyview/vendor/ibis/loaders.py,sha256=NYW7_hlC7TRPDau37bgiOCsvsBgIPpUEpb1NbroUVUA,3457
38
38
  pyview/vendor/ibis/nodes.py,sha256=TgFt4q5MrVW3gC3PVitrs2LyXKllRveooM7XKydNATk,25617
39
39
  pyview/vendor/ibis/template.py,sha256=IX9z-Ig13yJyRnMqtB52eiRLe002qdIxnfa7fYEXLqM,2314
40
- pyview/vendor/ibis/tree.py,sha256=5LAjl3q9iPMZBb6QbKurWj9-QGKLVf11K2_bQotWlUc,2293
40
+ pyview/vendor/ibis/tree.py,sha256=hg8f-fKHeo6DE8R-QgAhdvEaZ8rKyz7p0nGwPy0CBTs,2509
41
41
  pyview/vendor/ibis/utils.py,sha256=nLSaxPR9vMphzV9qinlz_Iurv9c49Ps6Knv8vyNlewU,2768
42
42
  pyview/ws_handler.py,sha256=Vi5aIoxz_Z9qOEcA5fgxsSoJtLz7n_ytbJ8vZiWDvGc,8473
43
- pyview_web-0.0.22.dist-info/LICENSE,sha256=M_bADaBm9_MV9llX3lCicksLhwk3eZUjA2srE0uUWr0,1071
44
- pyview_web-0.0.22.dist-info/METADATA,sha256=Du3wF_Qe8pG3FAk8F7tRD80eahCG3pTuqpzzVlP0Kqo,5276
45
- pyview_web-0.0.22.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
46
- pyview_web-0.0.22.dist-info/RECORD,,
43
+ pyview_web-0.0.24.dist-info/LICENSE,sha256=M_bADaBm9_MV9llX3lCicksLhwk3eZUjA2srE0uUWr0,1071
44
+ pyview_web-0.0.24.dist-info/METADATA,sha256=KVSbBZVtJ6Ft3W2ZQh1NFBYM_i3xamA3B9AM-2O-TAw,5276
45
+ pyview_web-0.0.24.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
46
+ pyview_web-0.0.24.dist-info/RECORD,,