o
    ZhB                     @   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 )zCompatibility 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   N/var/www/html/lang_env/lib/python3.10/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_implementationPYPYr*   Zunicode_to_strZcast_bytes_py2r   r   r   r   <module>   s   





