o
    û›hB  ã                   @   s|   d Z ddlZddlZddlmZ ddd„Zddd„Zdd	d
„Zdd„ Z	ddd„Z
ddd„Ze ¡ dkZddd„Ze ZZdS )z€Compatibility tricks for Python 3. Mainly to do with unicode.

This file is deprecated and will be removed in a future version.
é    Né   )ÚDEFAULT_ENCODINGc                 C   ó   |pt }|  |d¡S ©NÚreplace)r   Údecode©ÚsÚencoding© r   úMc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/utils/py3compat.pyr      ó   r   c                 C   r   r   )r   Úencode)Úur
   r   r   r   r      r   r   c                 C   s   t | tƒr
t| |ƒS | S ©N)Ú
isinstanceÚbytesr   r   r   r   r   Úcast_unicode   s   

r   c                 C   s>   zt | ƒW S  ty   Y nw zt| ƒW S  ty   Y dS w )zlunicode(e) with various fallbacks. Used for exceptions, which may not be
    safe to call unicode() on.
    zUnrecoverably corrupt evalue)ÚstrÚUnicodeErrorÚrepr)Úer   r   r   Úsafe_unicode   s   
ÿ
ýr   Ú c                 C   s
   t  | ¡S r   )Úbuiltin_modÚinput)Úpromptr   r   r   r   /   s   
r   c                 C   s`   |d ur|n|}t | dƒ�}|pt}t|| ¡ | dƒ||ƒ W d   ƒ d S 1 s)w   Y  d S )NÚrbÚexec)ÚopenÚcompiler   Úread)ÚfnameÚglobÚlocÚcompilerÚfr   r   r   Úexecfile3   s
   "þr'   ÚPyPyc                 C   s   | S r   r   )Úxr
   r   r   r   Úno_code@   s   r*   r   )r   )NN)Ú__doc__ÚplatformÚbuiltinsr   r
   r   r   r   r   r   r   r'   Úpython_implementationZPYPYr*   Zunicode_to_strZcast_bytes_py2r   r   r   r   Ú<module>   s   





