
    ~@;j`                     >    d dl Z d dlZd dlmZ  G d de          ZdS )    N)Optionalc                   P    e Zd ZdZe	 	 d
dededee         dedef
d	            Z	dS )
TextReaderzBText reader for retrieve text or transfer text in different types.Nreplacebuffer	chars_lenencodingerrors_fallbackreturnc                    |4|dk    rt          | |d                   rd}n:t          j                    }n&t          j        |                                          }|                    d          r|dz  }n|                    d          r|dz  }n|}| d|         }t          |          sdS 	 |                    |d	
          }n'# t          $ r |                    ||
          }Y nw xY w|S )a  [summary]

        Args:
            buffer (bytes): bytes object to convert to str.
            chars_len (int): character length for handle bytes.
            encoding (Optional[str], optional): encoding format for buffer. Defaults to None.
            errors_fallback (str, optional): error handling scheme for handling of decoding errors. Default: "replace".

        Returns:
            str: decoded text from buffer.
        N   	utf_16_leutf_16   utf_32    surrogatepass)errors)	anylocalegetpreferredencoding	encodingsnormalize_encodinglower
startswithdecodeUnicodeDecodeError)r   r   r	   r
   num_of_bytesraw_texttexts          eC:\Users\Administrator\AppData\Local\Temp\2\pip-target-b0z114gj\lib\python\pyjab/common/textreader.pyget_text_from_raw_bytesz"TextReader.get_text_from_raw_bytes	   s   $ 1}}VIJJ%7!8!8}&!688 3H==CCEEHx(( 	%$q=LL  ** 	%$q=LL$L ,/8}} 	2	E??8O?DDDD! 	E 	E 	E??8O?DDDDD	Es   1C	 	!C-,C-)Nr   )
__name__
__module____qualname____doc__staticmethodbytesintr   strr#        r"   r   r      sw        LL '+#,	% %%% sm% !	%
 
% % % \% % %r-   r   )r   r   typingr   objectr   r,   r-   r"   <module>r0      s`              ) ) ) ) ) ) ) ) ) )r-   