Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce LOC changes
Browse files Browse the repository at this point in the history
Archmonger committed Jan 26, 2025
1 parent c7122d5 commit a27a00f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/reactpy/utils.py
Original file line number Diff line number Diff line change
@@ -156,24 +156,24 @@ def _etree_to_vdom(
return el


def _add_vdom_to_etree(parent: etree._Element, node: VdomDict | dict[str, Any]) -> None:
def _add_vdom_to_etree(parent: etree._Element, vdom: VdomDict | dict[str, Any]) -> None:
try:
tag = node["tagName"]
tag = vdom["tagName"]
except KeyError as e:
msg = f"Expected a VDOM dict, not {type(node)}"
msg = f"Expected a VDOM dict, not {type(vdom)}"
raise TypeError(msg) from e
else:
node = cast(VdomDict, node)
vdom = cast(VdomDict, vdom)

if tag:
element = etree.SubElement(parent, tag)
element.attrib.update(
_vdom_attr_to_html_str(k, v) for k, v in node.get("attributes", {}).items()
_vdom_attr_to_html_str(k, v) for k, v in vdom.get("attributes", {}).items()
)
else:
element = parent

for c in node.get("children", []):
for c in vdom.get("children", []):
if hasattr(c, "render"):
c = _component_to_vdom(cast(ComponentType, c))
if isinstance(c, dict):

0 comments on commit a27a00f

Please sign in to comment.