r"""Compile a command and determine whether it is incomplete. Arguments: source -- the source string; may contain \n characters filename -- optional filename from which source was read; default " " symbol -- optional grammar start symbol; "single" (default) or
(source, filename="<input>", symbol="single")
| 125 | |
| 126 | |
| 127 | def compile_command(source, filename="<input>", symbol="single"): |
| 128 | r"""Compile a command and determine whether it is incomplete. |
| 129 | |
| 130 | Arguments: |
| 131 | |
| 132 | source -- the source string; may contain \n characters |
| 133 | filename -- optional filename from which source was read; default |
| 134 | "<input>" |
| 135 | symbol -- optional grammar start symbol; "single" (default) or "eval" |
| 136 | |
| 137 | Return value / exceptions raised: |
| 138 | |
| 139 | - Return a code object if the command is complete and valid |
| 140 | - Return None if the command is incomplete |
| 141 | - Raise SyntaxError, ValueError or OverflowError if the command is a |
| 142 | syntax error (OverflowError and ValueError can be produced by |
| 143 | malformed literals). |
| 144 | """ |
| 145 | return _maybe_compile(_compile, source, filename, symbol) |
| 146 | |
| 147 | |
| 148 | class Compile: |
no test coverage detected