MCPcopy
hub / github.com/donnemartin/gitsome / _push

Method _push

xonsh/ptk2/shell.py:158–175  ·  view source on GitHub ↗

Pushes a line onto the buffer and compiles the code in a way that enables multiline input.

(self, line)

Source from the content-addressed store, hash-verified

156 return line
157
158 def _push(self, line):
159 """Pushes a line onto the buffer and compiles the code in a way that
160 enables multiline input.
161 """
162 code = None
163 self.buffer.append(line)
164 if self.need_more_lines:
165 return None, code
166 src = "".join(self.buffer)
167 src = transform_command(src)
168 try:
169 code = self.execer.compile(src, mode="single", glbs=self.ctx, locs=None)
170 self.reset_buffer()
171 except Exception: # pylint: disable=broad-except
172 self.reset_buffer()
173 print_exception()
174 return src, None
175 return src, code
176
177 def cmdloop(self, intro=None):
178 """Enters a loop that reads and execute input from user."""

Callers

nothing calls this directly

Calls 5

transform_commandFunction · 0.90
print_exceptionFunction · 0.90
reset_bufferMethod · 0.80
appendMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected