a
    ñ»j  ã                   @   s”   d dl Z d dlmZmZ dZze jjZW n ey>   eZY n0 edu rLeZee	e
f e	dœdd„Zee	e
f e
dœdd„Ze
ee
 dœd	d
„ZdS )é    N)ÚIterableÚUnionzutf-8)ÚtextÚreturnc              	   C   s@   t | tƒr<z|  td¡W S  ttfy:   | jdd� Y S 0 | S )z=helper to ensure that text passed to WriteConsoleW is unicodeÚreplace©Úerrors)Ú
isinstanceÚbytesÚdecodeÚpyreadline_codepageÚLookupErrorÚ	TypeError©r   © r   ú@E:\soccer\ml_env\Lib\site-packages\pyreadline3/unicode_helper.pyÚensure_unicode   s    
r   c              	   C   s@   t | tƒr<z|  td¡W S  ttfy:   | jdd� Y S 0 | S )z0Convert unicode to str using pyreadline_codepager   r   )r	   ÚstrÚencoder   r   r   r   r   r   r   Ú
ensure_str%   s    
r   c                 C   s    t | tƒrdd„ | D ƒS t| ƒS )Nc                 s   s   | ]}|  d d¡V  qdS )é   ÚbigN)Úto_bytes)Ú.0Úsr   r   r   Ú	<genexpr>3   ó    zbiter.<locals>.<genexpr>)r	   r
   Úiterr   r   r   r   Úbiter1   s    
r   )ÚsysÚtypingr   r   Z_pyreadline_fallback_codepageÚstdoutÚencodingr   ÚAttributeErrorr   r
   r   r   r   r   r   r   r   Ú<module>	   s   
