
    fA                         d Z ddlZddlZddlmZ ddZddZddZd Z	dd	Z
dd
Z ej                         dk(  ZddZexZZy)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                 :    |xs t         }| j                  |d      S Nreplace)r   decodesencodings     R/var/www/cvtools/html/venv/lib/python3.12/site-packages/IPython/utils/py3compat.pyr   r          ++H88Hi((    c                 :    |xs t         }| j                  |d      S r   )r   encode)ur   s     r   r   r      r   r   c                 >    t        | t              rt        | |      S | S N)
isinstancebytesr   r	   s     r   cast_unicoder      s    !Ua""Hr   c                 n    	 t        |       S # t        $ r Y nw xY w	 t        |       S # t        $ r Y yw xY 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)es    r   safe_unicoder      sE    1v Aw )s   
 	
( 	44c                 ,    t        j                  |       S r   )builtin_modinput)prompts    r   r   r   /   s    V$$r   c                     ||n|}t        | d      5 }|xs t        }t         ||j                         | d      ||       d d d        y # 1 sw Y   y xY w)Nrbexec)opencompiler#   read)fnameglobloccompilerfs        r   execfiler,   3   sS    /#C	eT	 ;a&wXaffhv.c:; ; ;s   .A

APyPyc                     | S r    )xr   s     r   no_coder1   ?   s    Hr   r   ) )NN)__doc__platformbuiltinsr   r   r   r   r   r   r   r   r,   python_implementationPYPYr1   unicode_to_strcast_bytes_py2r/   r   r   <module>r:      s[      &)
)
*&%; &x%%'61
 #* )r   