MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeText-parser / get_node_length

Function get_node_length

src/codetext/clean/noise_removal.py:72–86  ·  view source on GitHub ↗

Get node length Args: node (tree_sitter.Node): node Return: int

(node: Node)

Source from the content-addressed store, hash-verified

70
71
72def get_node_length(node: Node) -> int:
73 """
74 Get node length
75 Args:
76 node (tree_sitter.Node): node
77
78 Return:
79 int
80 """
81 if not isinstance(node, Node):
82 raise ValueError("Expect type tree_sitter.Node, get %i", type(node))
83
84 line_start = node.start_point[0]
85 line_end = node.end_point[0]
86 return int(line_end - line_start)
87
88
89def remove_comment_delimiters(docstring: str, remove_whitespace: bool=True) -> str:

Callers 1

check_is_empty_functionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected