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)
| 56 | |
| 57 | |
| 58 | def 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 | |
| 72 | if __name__ == "__main__": |
no test coverage detected