
    `ie                         d Z ddlZ	 eZn# e$ r  G d de          ZY nw xY w	 eZn# e$ r eZY nw xY wd Z ej	        d          j
        Zddd	d
ZeefdZd Z	 	 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                       e Zd ZdS )special_unicodeN)__name__
__module____qualname__     e/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/astor/string_repr.pyr   r      s        r	   r   c                     |                      d          dd          }d |D             }d |D             }| sdS d |D             }|ot          |          |k    S )N
   c                 6    g | ]}|                                 S r   )rstrip.0xs     r
   
<listcomp>z&_properly_indented.<locals>.<listcomp>$   s     )))Qahhjj)))r	   c                     g | ]}||S r   r   r   s     r
   r   z&_properly_indented.<locals>.<listcomp>%   s    %%%A1%a%%%r	   Fc                 p    g | ]3}t          |          t          |                                          z
  4S r   )lenlstripr   s     r
   r   z&_properly_indented.<locals>.<listcomp>(   s1    999Qs1vvAHHJJ'999r	   )splitmin)sline_indentmylistcountss       r
   _properly_indentedr   "   sv    WWT]]122F))&)))F%%%%%F u99&999F0c&kk[00r	   z(\\|\"\"\"|\"$)z\\z""\"z\")\z""""c                 ~     ||           } f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   (   K   | ]}|         V  d S )Nr   )r   r   replacementss     r
   	<genexpr>z&_prep_triple_quotes.<locals>.<genexpr>6   s'      001|A000000r	   r   N    )join)r   mysplitr#   s     `r
   _prep_triple_quotesr)   0   sO    
 	

A0000!$Q$000AaddG771::r	   c                 &    dt          |           z  S )z<Return string's python representation in triple quotes.
    z"""%s""")r)   )r   s    r
   string_triplequote_reprr+   :   s     +A....r	   F   d   c                 n   t          |           }t          | t                    st          | t                    s|S |rt          | t                    rd|z   S t          |          }|                                rt          |          }|                     d          dz   }	|dk    r|	s|S ||k     r|S |t          |                                          z
  }
|r|	s|S ||z   }||k     rt          | |
          s|S t          |           }	 t          |          | k    rd|vr|S n# t          $ r Y nw xY w|S )zThere 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   embeddedcurrent_lineuni_litmin_trip_strmax_linedefaultlen_slen_currentsecond_line_startr   	total_lenfancys                r
   pretty_stringrD   @   sw    1ggG 	1o&& jJ.G.G  :a'' W}LLE ,''FF4LL1,a<< 1<N<N!C(;(;(=(=$>$>>  	- 	N%'	x(:1k(J(JN#A&&E;;!E 1 1L   Ns   D% %
D21D2)Fr,   r-   )__doc__reunicoder   	NameErrorobjectr3   strr   compiler   r(   r#   r)   r+   rD   r   r	   r
   <module>rL      s*   $ 
			OO       &     JJ   JJJ1 1 1 "*'
(
(
.W599 $+    / / / 6;,/0 0 0 0 0 0s    !!( 22