:mod:`lookout.style.format.virtual_node` ======================================== .. py:module:: lookout.style.format.virtual_node .. autoapi-nested-parse:: Defines VirtualNode - a class which backs any source code token. Module Contents --------------- .. py:class:: Position Bases::class:`typing.NamedTuple()` Data class to hold position information of virtual nodes. `line` and `col` are 1-based to match UAST, `offset` is 0-based. .. staticmethod:: from_bblfsh_position(position:bblfsh.Position) Create a lookout.style.format.virtual_node.Position from a bblfsh.Position. .. py:class:: VirtualNode(value:str, start:Position, end:Position, *, node:bblfsh.Node=None, y:Optional[Tuple[int, ...]]=None, is_accumulated_indentation:bool=False, path:str=None) Represent either a real UAST node or an imaginary token. The class instance should be considered as read-only. .. method:: __str__(self) .. method:: __repr__(self) .. method:: __eq__(self, other:'VirtualNode') .. method:: copy(self) Produce a full clone of the node. .. method:: is_labeled_on_lines(self, lines:Optional[Set[int]]) Return true for labeled VirtualNode instance that located on specified lines. :param lines: list of lines or None. None is considered as all possible lines. :return: Condition value .. staticmethod:: from_node(node:bblfsh.Node, file:str, token_unwrappers:Mapping[str, Callable[[str], Tuple[str, str]]]) Initialize the VirtualNode from a UAST node. Takes into account prefixes and suffixes. :param node: UAST node. :param file: File contents. :param token_unwrappers: Mapping from bblfsh internal types to functions to unwrap tokens. :return: New VirtualNode-s. .. data:: AnyNode