'L iddlmZddlZddlZd dZddZddZGddejZd dZ d Z e d f dd Z ddd Z y)) annotationsNc t|S#ttf$rt$rt |j d|dcYSwxYw)Nz("z"))reprKeyboardInterrupt SystemExit BaseExceptiontype__name__)objs Z/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/_pytest/_io/saferepr.py_try_repr_or_strr sN0Cy z * 0s)$$%RuB//0s 3AAc t|}d|dt |j dt |ddS#ttf$rt$r}dt|d}Yd}~Ud}~wwxYw)Nzunpresentable exception ()z<[z raised in repr()] z object at 0xx>)r rrrr r id)excr exc_info inner_excs r _format_repr_exceptionrs~N#C( XJ)$s)*<*<)=]2c7ST+UVW z * N./? /J.K1MNs 6A'A""A'ct||kDr>td|dz dz}td|dz |z }|d|dz|t||z dzS|S)Nrz...)lenmax)smaxsizeijs r _ellipsizer s_ 1v GaKA% & 7Q;? #!uu}qQ!.. Hc:eZdZdZddfd Zdfd ZddZxZS) SafeReprz repr.Repr that limits the resulting size of repr() and includes information on exceptions raised during the call. cTt|||nd|_||_||_y)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 use_ascii)selfrr( __class__s r r&zSafeRepr.__init__*s. %,$7] "r!c |jr t|}nt| |}|jt||j}|S#tt f$rt $r}t||}Yd}~Md}~wwxYwN) r(asciir%rrrrrrr )r)rrrr*s r rz SafeRepr.repr9st /~~!HGLO << #1dll+A ":.   /&sA.A /s'AA<& A77A<c t|}|j t ||j }|S#ttf$rt$r}t ||}Yd}~Md}~wwxYwr,)rrrrrrr )r)rlevelrrs r repr_instancezSafeRepr.repr_instanceGs_ /QA << #1dll+A ":.   /&sA.A /s 1A AA)F)r int | Noner(boolreturnNone)robjectr3str)rr5r/intr3r6)r __module__ __qualname____doc__r&rr0 __classcell__)r*s@r r#r#$s #  r!r#cr tj|S#t$r}t||cYd}~Sd}~wwxYw)zReturn a pretty printed string for the given object. Failing __repr__ functions of user instances will be represented with a short exception info. N)pprintpformat Exceptionr)r rs r safeformatr@Ss3 0~~c"" 0%c3//0s 6 166Fc8t||j|S)aJReturn 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 rr(s r safereprrCcs GY ' , ,S 11r!cx |r t|St|S#t$r}t||cYd}~Sd}~wwxYw)atReturn 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)r-rr?r)r r(rs r saferepr_unlimitedrErs;0 : Cy 0%c3//0s   9 499)r r5r3r6)rrr r5r3r6)rr6rr7r3r6)r r5rr1r(r2r3r6)T)r r5r(r2r3r6) __future__rr=reprlibr rr Reprr#r@DEFAULT_REPR_MAX_SIZErCrEr!r rKsm" 0  ,w||,^ 0(=PU 2  2$ 2IM 2 20r!