(self, c)
return out
Process a single char, returning unicode char sequences when ready
Process a single char, returning unicode char sequences when ready
Process a single char returning unicode char sequences when ready
def _process(self, c):
        """Process a single char, returning unicode char sequences when ready """
        if not self._box_protect:
            return self._process_nobox(c)
        out = []
        if c in self._preserve:
            # control char; flush buffer as SBCS and add control char unchanged
            out += self._flush() + [c]
            self._bset = -1
            self._last = b''
        elif self._bset == -1:
            if not self._buf:
                out += self._process_case0(c)
            elif len(self._buf) == 1:
                out += self._process_case1(c)
            elif len(self._buf) == 2:
                out += self._process_case2(c)
            else: # pragma: no cover
                # not allowed
                logging.debug(b'DBCS buffer corrupted: %d %s', self._bset, repr(self._buf))
        elif len(self._buf) == 2:
            out += self._process_case3(c)
        elif not self._buf:
            out += self._process_case4(c)
        else: # pragma: no cover
            # not allowed
            logging.debug(b'DBCS buffer corrupted: %d %s', self._bset, repr(self._buf))
        return out
def _process ( self , c ) : if not self . _box_protect : return self . _process_nobox ( c ) out = [ ] if c in self . _preserve : # control char; flush buffer as SBCS and add control char unchanged out += self . _flush ( ) + [ c ] self . _bset = - 1 self . _last = b'' elif self . _bset == - 1 : if not self . _buf : out += self . _process_case0 ( c ) elif len ( self . _buf ) == 1 : out += self . _process_case1 ( c ) elif len ( self . _buf ) == 2 : out += self . _process_case2 ( c ) else : # pragma: no cover # not allowed logging . debug ( b'DBCS buffer corrupted: %d %s' , self . _bset , repr ( self . _buf ) ) elif len ( self . _buf ) == 2 : out += self . _process_case3 ( c ) elif not self . _buf : out += self . _process_case4 ( c ) else : # pragma: no cover # not allowed logging . debug ( b'DBCS buffer corrupted: %d %s' , self . _bset , repr ( self . _buf ) ) return out