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)
| 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: |
nothing calls this directly
no test coverage detected