Push a line to the interpreter. The line should not have a trailing newline; it may have internal newlines. The line is appended to a buffer and the interpreter's runsource() method is called with the concatenated contents of the buffer as source. If this
(self, line)
| 240 | self.write('%s\n' % exitmsg) |
| 241 | |
| 242 | def push(self, line): |
| 243 | """Push a line to the interpreter. |
| 244 | |
| 245 | The line should not have a trailing newline; it may have |
| 246 | internal newlines. The line is appended to a buffer and the |
| 247 | interpreter's runsource() method is called with the |
| 248 | concatenated contents of the buffer as source. If this |
| 249 | indicates that the command was executed or invalid, the buffer |
| 250 | is reset; otherwise, the command is incomplete, and the buffer |
| 251 | is left as it was after the line was appended. The return |
| 252 | value is 1 if more input is required, 0 if the line was dealt |
| 253 | with in some way (this is the same as runsource()). |
| 254 | |
| 255 | """ |
| 256 | self.buffer.append(line) |
| 257 | source = "\n".join(self.buffer) |
| 258 | more = self.runsource(source, self.filename) |
| 259 | if not more: |
| 260 | self.resetbuffer() |
| 261 | return more |
| 262 | |
| 263 | def raw_input(self, prompt=""): |
| 264 | """Write a prompt and read a line. |
no test coverage detected