
    Dg	                     ~    d dl Z d dlZeZe j                            dd          Z G d dej                  ZddZ	dS )	    Nreprreprlibc                   *    e Zd ZdZd Zd Zd Zd ZdS )SafeReprz subclass of repr.Repr that limits the resulting size of repr()
        and includes information on exceptions raised during the call.
    c                 N    |                      t          j        j        | |          S N)_callhelperr   Reprr   )selfxs     D/var/www/sysmax/venv/lib/python3.11/site-packages/py/_io/saferepr.pyr   zSafeRepr.repr   s     14;;;    c                    d } ||d | j                            }t          |          | j         k    rt          d| j         dz
  dz            }t          d| j         dz
  |z
            } ||d |         |t          |          |z
  d          z             }|d |         dz   |t          |          |z
  d          z   }|S )Nc                    d| vr"t           j                            d          | z  S d| vr"t           j                            d          | z  S t           j                            d          |                     dd          z  S )N'z'%s'"z"%s"z\')pybuiltin_totextreplace)us    r   r   z#SafeRepr.repr_unicode.<locals>.repr   ss    !||z))&11A55Az))&11A55z))&11AIIc54I4IIIr   r         ...)	maxstringlenmax)r   r   levelr   sijs          r   repr_unicodezSafeRepr.repr_unicode   s    	J 	J 	J D?DN?#$$q66DN""Aq(1,--AAt~a')**AQrrUQs1vvaxyy\)**A"1"#a&&()),Ar   c                 8    |                      t          |          S r   )r	   builtin_repr)r   r   r   s      r   repr_instancezSafeRepr.repr_instance    s    a000r   c                 (   	  ||g|R  }t          |          | j        k    r^t          d| j        dz
  dz            }t          d| j        dz
  |z
            }|d |         dz   |t          |          |z
  d          z   }|S # t          j        j        $ r   t          j                    \  }}}	t          |dd          }
	 t          |          }n# t          j        j        $ r   d}Y nxY wd|
||j
        j        t          |          fz  cY S xY w)Nr   r   r   r   __name__unknownz/<[%s("%s") raised in repr()] %s object at 0x%x>)r   maxsizer   r   r   _sysexsysexc_infogetattrstr	__class__r'   id)r   callr   argsr   r    r!   clsetbexc_namer,   s               r   r	   zSafeRepr._callhelper#   sL   	QA 1vv$$DLNQ.//4<>!+,,bqbEEMAc!ffQhiiL0H% z  	 	 	
	AJCBsJ	::H%q66:$   %$D(AK$8"Q%%HA A A A As#   	B >DCDC,*%DN)r'   
__module____qualname____doc__r   r"   r%   r	    r   r   r   r      sZ         < < <  "1 1 1    r   r      c                 r    t                      }||_        ||_        d|_        |                    |           S )aP   return a size-limited safe repr-string for the given object.
    Failing __repr__ functions of user instances will be represented
    with a short exception info and 'saferepr' generally takes
    care to never raise exceptions itself.  This function is a wrapper
    around the Repr/reprlib functionality of the standard 2.6 lib.
       )r   r   r)   maxotherr   )objr)   sreprs      r   safereprrA   ;   s2     JJEEOEMEN::c??r   )r;   )
r   r+   r   r$   r   
_tryimportr   r
   r   rA   r:   r   r   <module>rC      s~    				 




*

	
2
21 1 1 1 1w| 1 1 1f     r   