Given an ast of all the lines in a function, create the node along with the calls and variables internal to it. :param tree ast: :param parent Group: :rtype: list[Node]
(tree, parent)
| 192 | |
| 193 | @staticmethod |
| 194 | def make_nodes(tree, parent): |
| 195 | """ |
| 196 | Given an ast of all the lines in a function, create the node along with the |
| 197 | calls and variables internal to it. |
| 198 | |
| 199 | :param tree ast: |
| 200 | :param parent Group: |
| 201 | :rtype: list[Node] |
| 202 | """ |
| 203 | token = tree.name |
| 204 | line_number = tree.lineno |
| 205 | calls = make_calls(tree.body) |
| 206 | variables = make_local_variables(tree.body, parent) |
| 207 | is_constructor = False |
| 208 | if parent.group_type == GROUP_TYPE.CLASS and token in ['__init__', '__new__']: |
| 209 | is_constructor = True |
| 210 | |
| 211 | import_tokens = [] |
| 212 | if parent.group_type == GROUP_TYPE.FILE: |
| 213 | import_tokens = [djoin(parent.token, token)] |
| 214 | |
| 215 | return [Node(token, calls, variables, parent, import_tokens=import_tokens, |
| 216 | line_number=line_number, is_constructor=is_constructor)] |
| 217 | |
| 218 | @staticmethod |
| 219 | def make_root_node(lines, parent): |
no test coverage detected