ó
çiõ\c           @   sW   d  d l  Z  d  d l m Z d „  Z d e j f d „  ƒ  YZ d „  Z d d „ Z d S(	   iÿÿÿÿN(   t   reprlibc         G   s   y |  | | Œ SWni t  k
 r| } t | ƒ j } y t | ƒ } Wn t  k
 r[ d } n Xd | | | j j t | ƒ f SXd  S(   Nt   unknowns/   <[%s("%s") raised in repr()] %s object at 0x%x>(   t	   Exceptiont   typet   __name__t   strt	   __class__t   id(   t   callt   xt   argst   exct   exc_namet   exc_info(    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyt   _call_and_format_exception   s    
	t   SafeReprc           B   s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s†   subclass of repr.Repr that limits the resulting size of repr()
    and includes information on exceptions raised during the call.
    c         C   s   |  j  t j j |  | ƒ S(   N(   t   _callhelperR    t   Reprt   repr(   t   selfR	   (    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyR      s    c         C   s®   d „  } | | |  j   ƒ } t | ƒ |  j  k rª t d |  j  d d ƒ } t d |  j  d | ƒ } | | |  | t | ƒ | ƒ } | |  d | t | ƒ | } n  | S(   Nc         S   s@   d |  k r d |  Sd |  k r( d |  Sd |  j  d d ƒ Sd  S(   Nt   'u   '%s't   "u   "%s"s   \'(   t   replace(   t   u(    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyR   #   s
    i    i   i   s   ...(   t	   maxstringt   lent   max(   R   R	   t   levelR   t   st   it   j(    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyt   repr_unicode!   s    	"#c         C   s   |  j  t | ƒ S(   N(   R   R   (   R   R	   R   (    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyt   repr_instance3   s    c         G   s‚   t  | | | Œ } t | ƒ |  j k r~ t d |  j d d ƒ } t d |  j d | ƒ } | |  d | t | ƒ | } n  | S(   Ni    i   i   s   ...(   R   R   t   maxsizeR   (   R   R   R	   R
   R   R   R   (    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyR   6   s    #(   R   t
   __module__t   __doc__R   R   R    R   (    (    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyR      s
   			c         C   s   t  t j |  ƒ S(   sŸ   return a pretty printed string for the given object.
    Failing __repr__ functions of user instances will be represented
    with a short exception info.
    (   R   t   pprintt   pformat(   t   obj(    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyt
   safeformat?   s    iğ   c         C   s1   t  ƒ  } | | _ | | _ d | _ | j |  ƒ S(   sO  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.
    i    (   R   R   R!   t   maxotherR   (   R&   R!   t   srepr(    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyt   safereprG   s
    				(   R$   t	   six.movesR    R   R   R   R'   R*   (    (    (    s3   lib/python2.7/site-packages/_pytest/_io/saferepr.pyt   <module>   s
   	&	