MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / provide_symbols

Function provide_symbols

pythonFiles/symbolProvider.py:58–69  ·  view source on GitHub ↗

Provides a list of all symbols in provided code. The list comprises of 3-item tuples that contain the starting line number, ending line number and whether the statement is a single line.

(source)

Source from the content-addressed store, hash-verified

56
57
58def provide_symbols(source):
59 """Provides a list of all symbols in provided code.
60
61 The list comprises of 3-item tuples that contain the starting line number,
62 ending line number and whether the statement is a single line.
63
64 """
65 tree = ast.parse(source)
66 visitor = Visitor()
67 visitor.visit(tree)
68 sys.stdout.write(json.dumps(visitor.symbols))
69 sys.stdout.flush()
70
71
72if __name__ == "__main__":

Callers 1

symbolProvider.pyFile · 0.85

Calls 4

VisitorClass · 0.85
parseMethod · 0.65
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected