MCPcopy Index your code
hub / github.com/bpython/bpython / push

Method push

bpython/repl.py:992–1007  ·  view source on GitHub ↗

Push a line of code onto the buffer so it can process it all at once when a code block ends

(self, line, insert_into_history=True)

Source from the content-addressed store, hash-verified

990 return paste_url
991
992 def push(self, line, insert_into_history=True) -> bool:
993 """Push a line of code onto the buffer so it can process it all
994 at once when a code block ends"""
995 # This push method is used by cli and urwid, but not curtsies
996 s = line.rstrip("\n")
997 self.buffer.append(s)
998
999 if insert_into_history:
1000 self.insert_into_history(s)
1001
1002 more: bool = self.interp.runsource("\n".join(self.buffer))
1003
1004 if not more:
1005 self.buffer = []
1006
1007 return more
1008
1009 def insert_into_history(self, s: str):
1010 try:

Callers

nothing calls this directly

Calls 3

insert_into_historyMethod · 0.95
appendMethod · 0.80
runsourceMethod · 0.80

Tested by

no test coverage detected