Exemplo n.º 1
0
    def _set_node_attr_value(node: Node, attr_name: str, value: Any) -> None:
        """Set the node attribute value.

        @param      node:       The node we change attribute value for.
        @param      attr_name:  The attribute name.
        @param      value:      The new attribute value.
        """
        node._set_attribute(attr_name, value)
        node._attr_cache[attr_name] = value
Exemplo n.º 2
0
    def _get_node_attr_value(node: Node, attr_name: str) -> Any:
        """Get provided node attribute value.

        @param      node:       The node we retrieve attribute value from.
        @param      attr_name:  The attribute name.

        @return   The node attribute value.
        """
        if not node._attr_cache_valid:
            node._attr_cache = node._get_attributes()
            node._attr_cache_valid = True
        return node._attr_cache[attr_name]
Exemplo n.º 3
0
def _set_node_friendly_name(node: Node, **kwargs: Any) -> Node:
    if "name" in kwargs:
        node.friendly_name = kwargs["name"]
    return node