| 1 | n/a | """Package for parsing and compiling Python source code |
|---|
| 2 | n/a | |
|---|
| 3 | n/a | There are several functions defined at the top level that are imported |
|---|
| 4 | n/a | from modules contained in the package. |
|---|
| 5 | n/a | |
|---|
| 6 | n/a | parse(buf, mode="exec") -> AST |
|---|
| 7 | n/a | Converts a string containing Python source code to an abstract |
|---|
| 8 | n/a | syntax tree (AST). The AST is defined in compiler.ast. |
|---|
| 9 | n/a | |
|---|
| 10 | n/a | parseFile(path) -> AST |
|---|
| 11 | n/a | The same as parse(open(path)) |
|---|
| 12 | n/a | |
|---|
| 13 | n/a | walk(ast, visitor, verbose=None) |
|---|
| 14 | n/a | Does a pre-order walk over the ast using the visitor instance. |
|---|
| 15 | n/a | See compiler.visitor for details. |
|---|
| 16 | n/a | |
|---|
| 17 | n/a | compile(source, filename, mode, flags=None, dont_inherit=None) |
|---|
| 18 | n/a | Returns a code object. A replacement for the builtin compile() function. |
|---|
| 19 | n/a | |
|---|
| 20 | n/a | compileFile(filename) |
|---|
| 21 | n/a | Generates a .pyc file by compiling filename. |
|---|
| 22 | 2 | """ |
|---|
| 23 | n/a | |
|---|
| 24 | 2 | import warnings |
|---|
| 25 | n/a | |
|---|
| 26 | 2 | warnings.warn("The compiler package is deprecated and removed in Python 3.x.", |
|---|
| 27 | 2 | DeprecationWarning, stacklevel=2) |
|---|
| 28 | n/a | |
|---|
| 29 | 2 | from compiler.transformer import parse, parseFile |
|---|
| 30 | 2 | from compiler.visitor import walk |
|---|
| 31 | 2 | from compiler.pycodegen import compile, compileFile |
|---|