MCPcopy Create free account
hub / github.com/FonaTech/Clouds-Coder / _node_stub_names

Method _node_stub_names

split_coder.py:1054–1072  ·  view source on GitHub ↗
(self, node: NodeInfo)

Source from the content-addressed store, hash-verified

1052 return names
1053
1054 def _node_stub_names(self, node: NodeInfo) -> List[str]:
1055 if node.kind in {"class", "function"}:
1056 return [node.name] if node.name.isidentifier() else []
1057 if node.kind not in {"constant", "assignment"}:
1058 return []
1059 src = self.analyzer.get_source_lines(node.lineno, node.end_lineno)
1060 try:
1061 tree = ast.parse(src)
1062 except SyntaxError:
1063 return []
1064 for child in tree.body:
1065 if isinstance(child, ast.Assign):
1066 for target in child.targets:
1067 if isinstance(target, ast.Name) and target.id == node.name:
1068 return [node.name]
1069 elif isinstance(child, ast.AnnAssign):
1070 if isinstance(child.target, ast.Name) and child.target.id == node.name:
1071 return [node.name]
1072 return []
1073
1074 def _generate_init(self, module_path: str) -> str:
1075 """Generate a minimal __init__.py."""

Callers 1

_module_stub_namesMethod · 0.95

Calls 1

get_source_linesMethod · 0.45

Tested by

no test coverage detected