
    ^j                         d Z ddlZddlZddlmZ ddlmZ ddede	dz  de	fd	Z
dd
e	dee	   defdZdde	ez  dee	   de	fdZd ZddZddZ ej                          dk(  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_ENCODING)Optionalsencodingreturnc                 :    |xs t         }| j                  |d      S Nreplace)r   decoder   r   s     P/opt/ringagent/.cad-venv/lib/python3.12/site-packages/IPython/utils/py3compat.pyr   r          ++H88Hi((    uc                 :    |xs t         }| j                  |d      S r
   )r   encode)r   r   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!   1   s    V$$r   c                     d}||n|}t        | d      5 }|xs t        }t         ||j                         | d      ||       d d d        y # 1 sw Y   y xY w)N__ipython_bottom__rbexec)opencompiler&   read)fnameglobloccompiler__tracebackhide__fs         r   execfiler0   5   sY    ,/#C	eT	 ;a&wXaffhv.c:; ; ;s   .AAPyPyr   ) )NN)__doc__platformbuiltinsr    r   r   typingr   r   r   r   r   r   r   r!   r0   python_implementationPYPY r   r   <module>r:      s   
   & )e )sTz )S )
)c )Xc] )E )
C%K 8C= # *&%; &x%%'61r   