Given an AST for the subgroup (a class), generate that subgroup. In this function, we will also need to generate all of the nodes internal to the group. :param tree ast: :param parent Group: :rtype: Group
(tree, parent)
| 233 | |
| 234 | @staticmethod |
| 235 | def make_class_group(tree, parent): |
| 236 | """ |
| 237 | Given an AST for the subgroup (a class), generate that subgroup. |
| 238 | In this function, we will also need to generate all of the nodes internal |
| 239 | to the group. |
| 240 | |
| 241 | :param tree ast: |
| 242 | :param parent Group: |
| 243 | :rtype: Group |
| 244 | """ |
| 245 | assert type(tree) == ast.ClassDef |
| 246 | subgroup_trees, node_trees, body_trees = Python.separate_namespaces(tree) |
| 247 | |
| 248 | group_type = GROUP_TYPE.CLASS |
| 249 | token = tree.name |
| 250 | display_name = 'Class' |
| 251 | line_number = tree.lineno |
| 252 | |
| 253 | import_tokens = [djoin(parent.token, token)] |
| 254 | inherits = get_inherits(tree) |
| 255 | |
| 256 | class_group = Group(token, group_type, display_name, import_tokens=import_tokens, |
| 257 | inherits=inherits, line_number=line_number, parent=parent) |
| 258 | |
| 259 | for node_tree in node_trees: |
| 260 | class_group.add_node(Python.make_nodes(node_tree, parent=class_group)[0]) |
| 261 | |
| 262 | for subgroup_tree in subgroup_trees: |
| 263 | logging.warning("Code2flow does not support nested classes. Skipping %r in %r.", |
| 264 | subgroup_tree.name, parent.token) |
| 265 | return class_group |
| 266 | |
| 267 | @staticmethod |
| 268 | def file_import_tokens(filename): |
nothing calls this directly
no test coverage detected