MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / push

Method push

tools/python-3.11.9-amd64/Lib/code.py:242–261  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 1

interactMethod · 0.95

Calls 4

resetbufferMethod · 0.95
appendMethod · 0.45
joinMethod · 0.45
runsourceMethod · 0.45

Tested by

no test coverage detected