
    F-Ph                        d dl mZ d dlZd dlZddZdd
ZddZ G d dej                  ZddZ	dZ
e
dfddZdddZdS )     )annotationsNobjobjectreturnstrc                    	 t          |           S # t          t          f$ r  t          $ r t	          |           j         d|  dcY S w xY w)Nz("z"))reprKeyboardInterrupt
SystemExitBaseExceptiontype__name__)r   s    T/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/_pytest/_io/saferepr.py_try_repr_or_strr      sn    0Cyyz*    0 0 0s))$////////0s    5A	A	excr   c                    	 t          |           }n;# t          t          f$ r  t          $ r}dt          |           d}Y d }~nd }~ww xY wd| dt	          |          j         dt          |          ddS )Nzunpresentable exception ()z<[z raised in repr()] z object at 0xx>)r   r
   r   r   r   r   id)r   r   exc_info	inner_excs       r   _format_repr_exceptionr      s    N#C((z*    N N NM/?	/J/JMMMN 	XXWW$s))*<WW2c77WWWWs    A
AA
smaxsizeintc                    t          |           |k    rTt          d|dz
  dz            }t          d|dz
  |z
            }| d |         dz   | t          |           |z
  d          z   S | S )Nr         z...)lenmax)r   r   ijs       r   
_ellipsizer$      sp    
1vvGaKA%&&7Q;?##!uu}qQ!..H    c                  :     e Zd ZdZdd fd	Zd fdZddZ xZS )SafeReprz
    repr.Repr that limits the resulting size of repr() and includes
    information on exceptions raised during the call.
    Fr   
int | None	use_asciiboolr   Nonec                z    t                                                       ||nd| _        || _        || _        dS )a	  
        :param maxsize:
            If not None, will truncate the resulting repr to that specific size, using ellipsis
            somewhere in the middle to hide the extra text.
            If None, will not impose any size limits on the returning repr.
        Ni ʚ;)super__init__	maxstringr   r)   )selfr   r)   	__class__s      r   r.   zSafeRepr.__init__*   s?     	 %,$7]"r%   r   r   r   c                $   	 | j         rt          |          }n!t                                          |          }n8# t          t
          f$ r  t          $ r}t          ||          }Y d }~nd }~ww xY w| j        t          || j                  }|S N)
r)   asciir-   r	   r
   r   r   r   r   r$   )r0   r   r   r   r1   s       r   r	   zSafeRepr.repr9   s    	/~ $!HHGGLLOO!:. 	 	 	 	/ 	/ 	/&sA..AAAAAA	/<#1dl++As   8< A1A,,A1levelr   c                    	 t          |          }n8# t          t          f$ r  t          $ r}t	          ||          }Y d }~nd }~ww xY w| j        t          || j                  }|S r3   )r	   r
   r   r   r   r   r$   )r0   r   r5   r   r   s        r   repr_instancezSafeRepr.repr_instanceG   s    	/QAA!:. 	 	 	 	/ 	/ 	/&sA..AAAAAA	/<#1dl++As    AAA)F)r   r(   r)   r*   r   r+   )r   r   r   r   )r   r   r5   r   r   r   )r   
__module____qualname____doc__r.   r	   r7   __classcell__)r1   s   @r   r'   r'   $   s~         
# # # # # # #     	 	 	 	 	 	 	 	r%   r'   c                z    	 t          j        |           S # t          $ r}t          ||           cY d}~S d}~ww xY w)zReturn a pretty printed string for the given object.

    Failing __repr__ functions of user instances will be represented
    with a short exception info.
    N)pprintpformat	Exceptionr   )r   r   s     r   
safeformatr@   S   sU    0~c""" 0 0 0%c3////////0s    
:5::   Fr(   r)   r*   c                H    t          ||                              |           S )aJ  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
    stdlib.
    )r'   r	   )r   r   r)   s      r   safereprrC   c   s"     GY'',,S111r%   Tc                    	 |rt          |           S t          |           S # t          $ r}t          ||           cY d}~S d}~ww xY w)at  Return an unlimited-size safe repr-string for the given object.

    As with saferepr, failing __repr__ functions of user instances
    will be represented with a short exception info.

    This function is a wrapper around simple repr.

    Note: a cleaner solution would be to alter ``saferepr``this way
    when maxsize=None, but that might affect some other code.
    N)r4   r	   r?   r   )r   r)   r   s      r   saferepr_unlimitedrE   r   se    0 	::Cyy 0 0 0%c3////////0s   " " 
AAAA)r   r   r   r   )r   r   r   r   r   r   )r   r   r   r   r   r   )r   r   r   r(   r)   r*   r   r   )T)r   r   r)   r*   r   r   )
__future__r   r=   reprlibr   r   r$   Reprr'   r@   DEFAULT_REPR_MAX_SIZErC   rE    r%   r   <module>rK      s    " " " " " "  0 0 0 0	 	 	 	   , , , , ,w| , , ,^	0 	0 	0 	0   (=PU2 2 2 2 20 0 0 0 0 0 0r%   