(self)
Flush the printer buffer to a printer.
Flush the printer buffer to a printer.
Flush the printer buffer to a printer .
def flush(self):
        """Flush the printer buffer to a printer."""
        printbuf = self.getvalue()
        if not printbuf:
            return
        self.seek(0)
        self.truncate()
        # any naked lead bytes in DBCS will remain just that - avoid in-line flushes.
        utf8buf = self.codepage.bytes_to_unicode(
            printbuf, preserve=CONTROL,
        ).encode('utf-8', 'replace')
        line_print(utf8buf, self.printer_name)
def flush ( self ) : printbuf = self . getvalue ( ) if not printbuf : return self . seek ( 0 ) self . truncate ( ) # any naked lead bytes in DBCS will remain just that - avoid in-line flushes. utf8buf = self . codepage . bytes_to_unicode ( printbuf , preserve = CONTROL , ) . encode ( 'utf-8' , 'replace' ) line_print ( utf8buf , self . printer_name )