o
    Ö0 ie  ã                   @   s    d Z ddlZzeZW n ey   G dd„ deƒZY nw zeZW n ey+   eZY nw dd„ Ze 	d¡j
Zdd	d
dœZeefdd„Zdd„ Z		ddd„ZdS )aS  
Part of the astor library for Python AST manipulation.

License: 3-clause BSD

Copyright (c) 2015 Patrick Maupin

Pretty-print strings for the decompiler

We either return the repr() of the string,
or try to format it as a triple-quoted string.

This is a lot harder than you would think.

This has lots of Python 2 / Python 3 ugliness.

é    Nc                   @   s   e Zd ZdS )Úspecial_unicodeN)Ú__name__Ú
__module__Ú__qualname__© r   r   ú]/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/astor/string_repr.pyr      s    r   c                 C   sT   |   d¡dd … }dd„ |D ƒ}dd„ |D ƒ}| sdS dd„ |D ƒ}|o)t|ƒ|kS )NÚ
é   c                 S   s   g | ]}|  ¡ ‘qS r   )Úrstrip©Ú.0Úxr   r   r   Ú
<listcomp>$   ó    z&_properly_indented.<locals>.<listcomp>c                 S   s   g | ]}|r|‘qS r   r   r   r   r   r   r   %   r   Fc                 S   s    g | ]}t |ƒt | ¡ ƒ ‘qS r   )ÚlenÚlstripr   r   r   r   r   (   s     )ÚsplitÚmin)ÚsÚline_indentZmylistÚcountsr   r   r   Ú_properly_indented"   s   r   z(\\|\"\"\"|\"$)z\\z""\"z\")ú\z"""ú"c                    s8   || ƒ} ‡ fdd„| ddd… D ƒ| ddd…< d  | ¡S )ze Split the string up and force-feed some replacements
        to make sure it will round-trip OK
    c                 3   s    | ]}ˆ | V  qd S )Nr   r   ©Úreplacementsr   r   Ú	<genexpr>6   s   € z&_prep_triple_quotes.<locals>.<genexpr>r	   Né   Ú )Újoin)r   Úmysplitr   r   r   r   Ú_prep_triple_quotes0   s   &
r!   c                 C   s   dt | ƒ S )z<Return string's python representation in triple quotes.
    z"""%s""")r!   )r   r   r   r   Ústring_triplequote_repr:   s   r"   Fé   éd   c                 C   sö   t | ƒ}t| tƒst| tƒs|S |rt| tƒrd| S t|ƒ}| ¡ rYt|ƒ}|  d¡d }	|dkr6|	s6|S ||k r<|S |t| ¡ ƒ }
|rJ|	sJ|S || }||k rYt	| |
ƒsY|S t
| ƒ}zt|ƒ| krkd|vrn|W S W |S W |S  tyz   Y |S w )zªThere are a lot of reasons why we might not want to or
       be able to return a triple-quoted string.  We can always
       punt back to the default normal string.
    Úbr   r	   ú)ÚreprÚ
isinstancer   Ú
basestringÚbytesr   ÚstripÚfindr   r   r"   ÚevalÚ	Exception)r   ZembeddedÚcurrent_lineZuni_litZmin_trip_strZmax_lineÚdefaultZlen_sZlen_currentZsecond_line_startr   Z	total_lenÚfancyr   r   r   Úpretty_string@   s>   ÿüþþr2   )Fr#   r$   )Ú__doc__ÚreÚunicoder   Ú	NameErrorÚobjectr)   Ústrr   Úcompiler   r    r   r!   r"   r2   r   r   r   r   Ú<module>   s(   ÿÿ

ÿ