U
    -eA                     @   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   s   |pt }| |dS Nreplace)r   decodesencoding r
   X/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/IPython/utils/py3compat.pyr      s    r   c                 C   s   |pt }| |dS r   )r   encode)ur	   r
   r
   r   r      s    r   c                 C   s   t | trt| |S | S N)
isinstancebytesr   r   r
   r
   r   cast_unicode   s    

r   c                 C   sD   z
t | W S  tk
r   Y nX z
t| W S  tk
r>   Y nX dS )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   sJ   |d k	r|n|}t | d&}|p"t}t|| | d|| W 5 Q R X 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(   )N)N)N)r   )NN)N)__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   





