'Push one or more lines of input.
This stores the given lines and returns a status code indicating
whether the code forms a complete Python block or not.
Any exceptions generated in compilation are swallowed, but if an
exception was produced, the method returns True.
Parameters
lines : string
One or more lines of Python input.
Returns
is_complete : boolean
True if the current input source (the result of the current input
plus prior inputs) forms a complete Python execution block.  Note that
this value is also stored as a private attribute (``_is_complete``), so it
can be queried at any time.'

def push(self, lines):

    self._store(lines)
    source = self.source
    (self.code, self._is_complete) = (None, None)
    self._is_invalid = False
    if source.endswith('\\\n'):
        return False
    self._update_indent()
    try:
        with warnings.catch_warnings():
            warnings.simplefilter('error', SyntaxWarning)
            self.code = self._compile(source, symbol='exec')
    except (SyntaxError, OverflowError, ValueError, TypeError, MemoryError, SyntaxWarning):
        self._is_complete = True
        self._is_invalid = True
    else:
        self._is_complete = (self.code is not None)
    return self._is_complete
