(self, data)
Push some new data into this object.
Push some new data into this object.
Push some new data into this object .
def push(self, data):
        """Push some new data into this object."""
        self._partial.write(data)
        if '\n' not in data and '\r' not in data:
            # No new complete lines, wait for more.
            return

        # Crack into lines, preserving the linesep characters.
        self._partial.seek(0)
        parts = self._partial.readlines()
        self._partial.seek(0)
        self._partial.truncate()

        # If the last element of the list does not end in a newline, then treat
        # it as a partial line.  We only check for '\n' here because a line
        # ending with '\r' might be a line that was split in the middle of a
        # '\r\n' sequence (see bugs 1555570 and 1721862).
        if not parts[-1].endswith('\n'):
            self._partial.write(parts.pop())
        self.pushlines(parts)
def push ( self , data ) : self . _partial . write ( data ) if '\n' not in data and '\r' not in data : # No new complete lines, wait for more. return # Crack into lines, preserving the linesep characters. self . _partial . seek ( 0 ) parts = self . _partial . readlines ( ) self . _partial . seek ( 0 ) self . _partial . truncate ( ) # If the last element of the list does not end in a newline, then treat # it as a partial line.  We only check for '\n' here because a line # ending with '\r' might be a line that was split in the middle of a # '\r\n' sequence (see bugs 1555570 and 1721862). if not parts [ - 1 ] . endswith ( '\n' ) : self . _partial . write ( parts . pop ( ) ) self . pushlines ( parts )