ó
è¾bc           @   s`   d  Z  d d g Z d d l Z d d l m Z d d d „  ƒ  YZ d „  Z e ƒ  Z e j Z d S(	   sG   Redo the builtin repr() (representation) but with limits on most sizes.t   Reprt   repriÿÿÿÿN(   t   islicec           B   s‰   e  Z d  „  Z d „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z d „  Z	 d	 „  Z
 d
 „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sg   d |  _  d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _	 d |  _
 d  S(   Ni   i   i   i   i(   i   (   t   maxlevelt   maxtuplet   maxlistt   maxarrayt   maxdictt   maxsett   maxfrozensett   maxdequet	   maxstringt   maxlongt   maxother(   t   self(    (    s   /usr/lib/python2.7/repr.pyt   __init__
   s    										c         C   s   |  j  | |  j ƒ S(   N(   t   repr1R   (   R   t   x(    (    s   /usr/lib/python2.7/repr.pyR      s    c         C   sé   t  | ƒ j } d | k r9 | j ƒ  } d j | ƒ } n  t |  d | ƒ rf t |  d | ƒ | | ƒ St j | ƒ } t | ƒ |  j	 k rá t
 d |  j	 d d ƒ } t
 d |  j	 d | ƒ } | |  d | t | ƒ | } n  | Sd  S(   Nt    t   _t   repr_i    i   i   s   ...(   t   typet   __name__t   splitt   joint   hasattrt   getattrt   __builtin__R   t   lenR   t   max(   R   R   t   levelt   typenamet   partst   st   it   j(    (    s   /usr/lib/python2.7/repr.pyR      s    #t    c         C   sÀ   t  | ƒ } | d k r' | r' d } nˆ | d }	 |  j }
 g  t | | ƒ D] } |
 | |	 ƒ ^ qJ } | | k r | j d ƒ n  d j | ƒ } | d k r¯ | r¯ | | } n  d | | | f S(   Ni    s   ...i   s   , s   %s%s%s(   R   R   R   t   appendR   (   R   R   R   t   leftt   rightt   maxitert   trailt   nR!   t   newlevelR   t   elemt   pieces(    (    s   /usr/lib/python2.7/repr.pyt   _repr_iterable)   s    	
	+  c         C   s   |  j  | | d d |  j d ƒ S(   Nt   (t   )t   ,(   R.   R   (   R   R   R   (    (    s   /usr/lib/python2.7/repr.pyt
   repr_tuple6   s    c         C   s   |  j  | | d d |  j ƒ S(   Nt   [t   ](   R.   R   (   R   R   R   (    (    s   /usr/lib/python2.7/repr.pyt	   repr_list9   s    c         C   s)   d | j  } |  j | | | d |  j ƒ S(   Ns   array('%s', [s   ])(   t   typecodeR.   R   (   R   R   R   t   header(    (    s   /usr/lib/python2.7/repr.pyt
   repr_array<   s    c         C   s(   t  | ƒ } |  j | | d d |  j ƒ S(   Ns   set([s   ])(   t   _possibly_sortedR.   R   (   R   R   R   (    (    s   /usr/lib/python2.7/repr.pyt   repr_set@   s    c         C   s(   t  | ƒ } |  j | | d d |  j ƒ S(   Ns   frozenset([s   ])(   R9   R.   R	   (   R   R   R   (    (    s   /usr/lib/python2.7/repr.pyt   repr_frozensetD   s    c         C   s   |  j  | | d d |  j ƒ S(   Ns   deque([s   ])(   R.   R
   (   R   R   R   (    (    s   /usr/lib/python2.7/repr.pyt
   repr_dequeI   s    c         C   sÚ   t  | ƒ } | d k r d S| d k r, d S| d } |  j } g  } xY t t | ƒ |  j ƒ D]? } | | | ƒ } | | | | ƒ }	 | j d | |	 f ƒ q^ W| |  j k rÀ | j d ƒ n  d j | ƒ }
 d |
 f S(	   Ni    s   {}s   {...}i   s   %s: %ss   ...s   , s   {%s}(   R   R   R   R9   R   R%   R   (   R   R   R   R*   R+   R   R-   t   keyt   keyreprt   valreprR!   (    (    s   /usr/lib/python2.7/repr.pyt	   repr_dictL   s       
	 c         C   s«   t  j | |  j  ƒ } t | ƒ |  j k r§ t d |  j d d ƒ } t d |  j d | ƒ } t  j | |  | t | ƒ | ƒ } | |  d | t | ƒ | } n  | S(   Ni    i   i   s   ...(   R   R   R   R   R   (   R   R   R   R!   R"   R#   (    (    s   /usr/lib/python2.7/repr.pyt   repr_str[   s    %#c         C   s   t  j | ƒ } t | ƒ |  j k r{ t d |  j d d ƒ } t d |  j d | ƒ } | |  d | t | ƒ | } n  | S(   Ni    i   i   s   ...(   R   R   R   R   R   (   R   R   R   R!   R"   R#   (    (    s   /usr/lib/python2.7/repr.pyt	   repr_longd   s    #c         C   s®   y t  j | ƒ } Wn( t k
 r= d | j j t | ƒ f SXt | ƒ |  j k rª t d |  j d d ƒ } t d |  j d | ƒ } | |  d | t | ƒ | } n  | S(   Ns   <%s instance at %x>i    i   i   s   ...(	   R   R   t	   Exceptiont	   __class__R   t   idR   R   R   (   R   R   R   R!   R"   R#   (    (    s   /usr/lib/python2.7/repr.pyt   repr_instancel   s    #(   R   t
   __module__R   R   R   R.   R2   R5   R8   R:   R;   R<   R@   RA   RB   RF   (    (    (    s   /usr/lib/python2.7/repr.pyR       s   													c         C   s-   y t  |  ƒ SWn t k
 r( t |  ƒ SXd  S(   N(   t   sortedRC   t   list(   R   (    (    s   /usr/lib/python2.7/repr.pyR9   z   s    (    (	   t   __doc__t   __all__R   t	   itertoolsR   R    R9   t   aReprR   (    (    (    s   /usr/lib/python2.7/repr.pyt   <module>   s   r			