
Ee]c           @` s  d  Z  d d l m Z m Z m Z d d d d d d d	 d
 d g	 Z d Z d d l Z d d l Z d d l	 Z	 e j
 d d k r y d d l m Z Wq e k
 r d d l m Z q Xn8 y d d l m Z Wn! e k
 r d d l m Z n Xd d l Z d d l m Z d d l m Z m Z m Z m Z m Z m Z d d l m Z d d l m Z m Z m  Z  m! Z! m" Z" m# Z# m$ Z$ d d l% m& Z& m' Z' d d l( m) Z) m* Z* m+ Z+ d d l m, Z, m- Z- m. Z. m/ Z/ m0 Z0 m1 Z1 m2 Z2 d d l3 m4 Z4 m5 Z5 d d l6 Z6 d d l7 Z7 i d d 6d d 6d d 6d d 6e8 d  6d! d" 6d# d$ 6d% d& 6d' d( 6d d) 6e8 d* 6Z: d d d d d d d d d d d d+  Z; e5 d,  d d d d d d d d d d d- 
  Z< e5 d,  d.    Z= e5 d,  e7 j> d/     Z? dk d0  Z@ d1   ZA d2   ZB d3   ZC d4   ZD d5   ZE d6 d7  ZF eF   d8 d9 d:   ZG d d d d d d d d d d d d d;  ZH e4 eH d< d, d d d d8 d9 e jI d d d d d d9 d=   ZJ d>   ZK d?   ZL d@   ZM dA eN f dB     YZO dC eO f dD     YZP dE eO f dF     YZQ e5 d,  d eR dG e8 d d dH   ZS e5 d,  d eR eR dG e8 d d dI   ZT dJ eN f dK     YZU dL eN f dM     YZV dN eN f dO     YZW dP eW f dQ     YZX dR eW f dS     YZY dT eN f dU     YZZ dV eZ f dW     YZ[ dX eZ f dY     YZ\ dZ eN f d[     YZ] d\ eN f d]     YZ^ d^ e^ f d_     YZ_ d`   Z` e. e/ e0 e1 g Za eb e- ec  rea jd e-  n  eb e, ec  rea jd e,  n  da   Ze db   Zf d d d eJ dc  Zg d d d dd  Zh e4 eh d< d, d d d de   Zi eF   ej  Zk d d d eJ df  Zl d d d dg  Zm e4 em d< d, d d d dh   Zn eo eJ di eJ  Zp e jq el d ep Zr e jq eg d ep Zs eR dj  Zt et er d  et es d  d S(l   sX   Array printing function

$Id: arrayprint.py,v 1.9 2005/09/13 13:58:44 teoliphant Exp $

i    (   t   divisiont   absolute_importt   print_functiont   array2stringt	   array_strt
   array_reprt   set_string_functiont   set_printoptionst   get_printoptionst   printoptionst   format_float_positionalt   format_float_scientifict   restructuredtextNi   (   t	   get_identi   (   t   numerictypes(   t   absolutet	   not_equalt   isnant   isinft   isfinitet   isnat(   t
   multiarray(   t   arrayt   dragon4_positionalt   dragon4_scientifict   datetime_as_stringt   datetime_datat   ndarrayt   set_legacy_print_mode(   t   ravelt   any(   t   concatenatet   asarrayt   errstate(   t   longlongt   intct   int_t   float_t   complex_t   bool_t   flexible(   t   array_function_dispatcht
   set_modulet	   edgeitemsi  t	   thresholdt   maxprect	   floatmodei   t	   precisiont   suppressiK   t	   linewidtht   nant   nanstrt   inft   infstrt   -t   signt	   formattert   legacyc         C` s  d   t    j   D } | d k	 r8 t |  | d <n  d d d d g } |	 | d g k r t d d j d	   | D    n  | d k r t d   n  |
 d t d g k r t j d d d n  | d k	 r	t	 | t
 j  s t j |  r	t d   q	n  | S(   sE    make a dictionary out of the non-None arguments, plus sanity checks c         S` s+   i  |  ]! \ } } | d  k	 r | |  q S(   N(   t   None(   t   .0t   kt   v(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys
   <dictcomp>J   s   	 R0   t   fixedt   uniqueR-   t   maxprec_equals    floatmode option must be one of s   , c         s` s   |  ] } d  j  |  Vq d S(   s   "{}"N(   t   format(   R;   t   m(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>R   s    R6   t   +t    s+   sign option must be one of ' ', '+', or '-'s   1.13s>   legacy printing option can currently only be '1.13' or `False`t
   stackleveli   sU   threshold must be numeric and non-NAN, try sys.maxsize for untruncated representationN(   NR6   RC   RD   (   t   localst   itemsR:   t   boolt
   ValueErrort   joint   Falset   warningst   warnt
   isinstancet   numberst   Numbert   npR   (   R/   R,   R+   R1   R0   R3   R5   R7   R8   R.   R9   t   optionst   modes(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _make_options_dictE   s      
"t   numpyc
         K` s   |
 j  d d	  } |
 r@ d } t | j |
 j   d    n  t |  | | | | | | | | |	 |  } | | d <t j |  t d d k r t d  d t d <n t d t	 k r t d  n  d	 S(
   s&  
    Set printing options.

    These options determine the way floating point numbers, arrays and
    other NumPy objects are displayed.

    Parameters
    ----------
    precision : int or None, optional
        Number of digits of precision for floating point output (default 8).
        May be `None` if `floatmode` is not `fixed`, to print as many digits as
        necessary to uniquely specify the value.
    threshold : int, optional
        Total number of array elements which trigger summarization
        rather than full repr (default 1000).
    edgeitems : int, optional
        Number of array items in summary at beginning and end of
        each dimension (default 3).
    linewidth : int, optional
        The number of characters per line for the purpose of inserting
        line breaks (default 75).
    suppress : bool, optional
        If True, always print floating point numbers using fixed point
        notation, in which case numbers equal to zero in the current precision
        will print as zero.  If False, then scientific notation is used when
        absolute value of the smallest number is < 1e-4 or the ratio of the
        maximum absolute value to the minimum is > 1e3. The default is False.
    nanstr : str, optional
        String representation of floating point not-a-number (default nan).
    infstr : str, optional
        String representation of floating point infinity (default inf).
    sign : string, either '-', '+', or ' ', optional
        Controls printing of the sign of floating-point types. If '+', always
        print the sign of positive values. If ' ', always prints a space
        (whitespace character) in the sign position of positive values.  If
        '-', omit the sign character of positive values. (default '-')
    formatter : dict of callables, optional
        If not None, the keys should indicate the type(s) that the respective
        formatting function applies to.  Callables should return a string.
        Types that are not specified (by their corresponding keys) are handled
        by the default formatters.  Individual types for which a formatter
        can be set are:

        - 'bool'
        - 'int'
        - 'timedelta' : a `numpy.timedelta64`
        - 'datetime' : a `numpy.datetime64`
        - 'float'
        - 'longfloat' : 128-bit floats
        - 'complexfloat'
        - 'longcomplexfloat' : composed of two 128-bit floats
        - 'numpystr' : types `numpy.string_` and `numpy.unicode_`
        - 'object' : `np.object_` arrays
        - 'str' : all other strings

        Other keys that can be used to set a group of types at once are:

        - 'all' : sets all types
        - 'int_kind' : sets 'int'
        - 'float_kind' : sets 'float' and 'longfloat'
        - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat'
        - 'str_kind' : sets 'str' and 'numpystr'
    floatmode : str, optional
        Controls the interpretation of the `precision` option for
        floating-point types. Can take the following values:

        * 'fixed': Always print exactly `precision` fractional digits,
                even if this would print more or fewer digits than
                necessary to specify the value uniquely.
        * 'unique': Print the minimum number of fractional digits necessary
                to represent each value uniquely. Different elements may
                have a different number of digits. The value of the
                `precision` option is ignored.
        * 'maxprec': Print at most `precision` fractional digits, but if
                an element can be uniquely represented with fewer digits
                only print it with that many.
        * 'maxprec_equal': Print at most `precision` fractional digits,
                but if every element in the array can be uniquely
                represented with an equal number of fewer digits, use that
                many digits for all elements.
    legacy : string or `False`, optional
        If set to the string `'1.13'` enables 1.13 legacy printing mode. This
        approximates numpy 1.13 print output by including a space in the sign
        position of floats and different behavior for 0d arrays. If set to
        `False`, disables legacy mode. Unrecognized strings will be ignored
        with a warning for forward compatibility.

        .. versionadded:: 1.14.0

    See Also
    --------
    get_printoptions, set_string_function, array2string

    Notes
    -----
    `formatter` is always reset with a call to `set_printoptions`.

    Examples
    --------
    Floating point precision can be set:

    >>> np.set_printoptions(precision=4)
    >>> print(np.array([1.123456789]))
    [ 1.1235]

    Long arrays can be summarised:

    >>> np.set_printoptions(threshold=5)
    >>> print(np.arange(10))
    [0 1 2 ..., 7 8 9]

    Small results can be suppressed:

    >>> eps = np.finfo(float).eps
    >>> x = np.arange(4.)
    >>> x**2 - (x + eps)**2
    array([ -4.9304e-32,  -4.4409e-16,   0.0000e+00,   0.0000e+00])
    >>> np.set_printoptions(suppress=True)
    >>> x**2 - (x + eps)**2
    array([-0., -0.,  0.,  0.])

    A custom formatter can be used to display array elements as desired:

    >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)})
    >>> x = np.arange(3)
    >>> x
    array([int: 0, int: -1, int: -2])
    >>> np.set_printoptions()  # formatter gets reset
    >>> x
    array([0, 1, 2])

    To put back the default options, you can use:

    >>> np.set_printoptions(edgeitems=3,infstr='inf',
    ... linewidth=75, nanstr='nan', precision=8,
    ... suppress=False, threshold=1000, formatter=None)
    R9   s7   set_printoptions() got unexpected keyword argument '{}'i    R8   s   1.13iq   R6   R7   N(
   t   popR:   t	   TypeErrorRA   t   popitemRT   t   _format_optionst   updateR   RK   (   R/   R,   R+   R1   R0   R3   R5   R8   R7   R.   t   kwargR9   t   msgt   opt(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR   b   s    "

c           C` s
   t  j   S(   s   
    Return the current print options.

    Returns
    -------
    print_opts : dict
        Dictionary of current print options with keys

          - precision : int
          - threshold : int
          - edgeitems : int
          - linewidth : int
          - suppress : bool
          - nanstr : str
          - infstr : str
          - formatter : dict of callables
          - sign : str

        For a full description of these options, see `set_printoptions`.

    See Also
    --------
    set_printoptions, set_string_function

    (   RY   t   copy(    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    c          o` s@   t  j   } z t  j |  |   t  j   VWd t  j |   Xd S(   sT  Context manager for setting print options.

    Set print options for the scope of the `with` block, and restore the old
    options at the end. See `set_printoptions` for the full description of
    available options.

    Examples
    --------

    >>> with np.printoptions(precision=2):
    ...     print(np.array([2.0])) / 3
    [0.67]

    The `as`-clause of the `with`-statement gives the current print options:

    >>> with np.printoptions(precision=2) as opts:
    ...      assert_equal(opts, np.get_printoptions())

    See Also
    --------
    set_printoptions, get_printoptions

    N(   RQ   R   R   (   t   argst   kwargst   opts(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR	   "  s
    c         C` s   t  |  } | |  j k r# |  | S|  j | d | k r t t |  | | t j |   t |  | | t j |  f d | St |  | | t j  Sd S(   s   
    Keep only the N-D corners (leading and trailing edges) of an array.

    Should be passed a base-class ndarray, since it makes no guarantees about
    preserving subclasses.
    i   t   axisN(   t   lent   ndimt   shapeR   t   _leading_trailingRQ   t	   index_exp(   t   aR+   t   indexRb   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRf   D  s    !c         C` s.   t  |   t k r d } n d } | j |   S(   s@    Object arrays containing lists should be printed unambiguously s
   list({!r})s   {!r}(   t   typet   listRA   (   t   ot   fmt(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _object_formatX  s    	c         C` s
   t  |   S(   N(   t   repr(   t   x(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   repr_format`  s    c         C` s
   t  |   S(   N(   t   str(   Rp   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt
   str_formatc  s    c         ` s  | d | d   | d | d   | d  i   f d   d 6  f d   d	 6       f d
   d 6       f d   d 6       f d   d 6       f d   d 6   f d   d 6  f d   d 6d   d 6d   d 6d   d 6d   d 6} d   } | d } | d  k	 rg  | j   D] } | | d  k	 rM| ^ qM} d  | k rx+ | j   D] } | | d   | | <qWn  d! | k rx( d	 g D] } | | d!  | | <qWn  d" | k rx+ d d g D] } | | d"  | | <qWn  d# | k rTx+ d d g D] } | | d#  | | <q3Wn  d$ | k rx+ d d g D] } | | d$  | | <qmWn  x: | j   D]) } | | k r| | |  | | <qqWn  | S(%   NR/   R.   R0   R7   R9   c           ` s
   t     S(   N(   t
   BoolFormat(    (   t   data(    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   <lambda>m  t    RH   c           ` s
   t     S(   N(   t   IntegerFormat(    (   Ru   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   n  Rw   t   intc           ` s   t        d  S(   NR9   (   t   FloatingFormat(    (   Ru   t   fmodeR9   t   precR7   t   supp(    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   o  s    t   floatc           ` s   t        d  S(   NR9   (   Rz   (    (   Ru   R{   R9   R|   R7   R}   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   q  s    t	   longfloatc           ` s   t        d  S(   NR9   (   t   ComplexFloatingFormat(    (   Ru   R{   R9   R|   R7   R}   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   s  s    t   complexfloatc           ` s   t        d  S(   NR9   (   R   (    (   Ru   R{   R9   R|   R7   R}   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   u  s    t   longcomplexfloatc           ` s   t    d  S(   NR9   (   t   DatetimeFormat(    (   Ru   R9   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   w  Rw   t   datetimec           ` s
   t     S(   N(   t   TimedeltaFormat(    (   Ru   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   x  Rw   t	   timedeltac           S` s   t  S(   N(   Rn   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   y  Rw   t   objectc           S` s   t  S(   N(   Rs   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   z  Rw   t   voidc           S` s   t  S(   N(   Rq   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   {  Rw   t   numpystrc           S` s   t  S(   N(   Rr   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv   |  Rw   Rr   c         ` s     f d   S(   Nc           ` s     S(   N(    (    (   Rp   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRv     Rw   (    (   Rp   (    (   Rp   s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   indirect  s    R8   t   allt   int_kindt
   float_kindt   complex_kindt   str_kind(   R:   t   keys(   Ru   R]   t
   formatdictR   R8   R<   t   fkeyst   key(    (   Ru   R{   R9   R|   R7   R}   s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _get_formatdictf  sN    



	
/c         K` s  |  j  } | j } t |  |  } t | t j  r> | d   St | t j  r{ t | t j  rm | d   S| d   Sn$t | t j  r t | t j	  r | d   S| d   Sn t | t j
  r t | t j  r | d   S| d   Sn t | t j t j f  r| d   St | t j  r8| d	   St | t j  rU| d
   St | t j  r| j d k	 rt j |  |  S| d   Sn | d   Sd S(   s;   
    find the right formatting function for the dtype_
    RH   R   Ry   R   R~   R   R   R   R   R   R   N(   t   dtypeRj   R   t
   issubclasst   _ntR'   t   integert   timedelta64t   floatingR   t   complexfloatingt
   clongfloatt   unicode_t   string_t
   datetime64t   object_R   t   namesR:   t   StructuredVoidFormatt	   from_data(   Ru   RR   t   dtype_t   dtypeobjR   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _get_format_function  s8    		s   ...c         ` s     f d   } | S(   s  
    Like the python 3.2 reprlib.recursive_repr, but forwards *args and **kwargs

    Decorates a function such that if it calls itself with the same first
    argument, it returns `fillvalue` instead of recursing.

    Largely copied from reprlib.recursive_repr
    c         ` s1   t     t j        f d    } | S(   Nc         ` s[   t  |   t   f } |  k r%  S j |  z   |  | |  SWd   j |  Xd  S(   N(   t   idR   t   addt   discard(   t   selfR_   R`   R   (   t   ft	   fillvaluet   repr_running(    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   wrapper  s    (   t   sett	   functoolst   wraps(   R   R   (   R   (   R   R   s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   decorating_function  s    	$(    (   R   R   (    (   R   s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _recursive_guard  s    
RD   Rw   c   	   
   C` s   t  |   } |  j d k r$ | }  n  |  j | d k rS d } t | | d  } n d } t | |  } d } | d t |  7} t |  | | d | | | d | | d  } | S(	   NR,   s   ...R+   Rw   RD   R1   R9   (    (   R    Re   t   sizeRf   R   Rc   t   _formatArray(	   Rh   RR   t	   separatort   prefixRu   t   summary_insertt   format_functiont   next_line_prefixt   lst(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _array2string  s    	c         K` s   |  f S(   N(    (   Rh   t   max_line_widthR/   t   suppress_smallR   R   t   styleR8   R,   R+   R7   R.   t   suffixR[   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _array2string_dispatcher  s    t   modulec         K` sQ  | j  d d
  } | r@ d } t | j | j   d    n  t | | |	 | | d
 d
 |
 | | |  } t j   } | j |  | d d k r | t	 j
 k r t } n  |  j d k r|  j j r| |  j    Sn( | t	 j
 k	 rt j d t d d n  | d d k r+| d c t |  8<n  |  j d k r>d	 St |  | | |  S(   sg  
    Return a string representation of an array.

    Parameters
    ----------
    a : array_like
        Input array.
    max_line_width : int, optional
        The maximum number of columns the string should span. Newline
        characters splits the string appropriately after array elements.
    precision : int or None, optional
        Floating point precision. Default is the current printing
        precision (usually 8), which can be altered using `set_printoptions`.
    suppress_small : bool, optional
        Represent very small numbers as zero. A number is "very small" if it
        is smaller than the current printing precision.
    separator : str, optional
        Inserted between elements.
    prefix : str, optional
    suffix: str, optional
        The length of the prefix and suffix strings are used to respectively
        align and wrap the output. An array is typically printed as::

          prefix + array2string(a) + suffix

        The output is left-padded by the length of the prefix string, and
        wrapping is forced at the column ``max_line_width - len(suffix)``.
        It should be noted that the content of prefix and suffix strings are
        not included in the output.
    style : _NoValue, optional
        Has no effect, do not use.

        .. deprecated:: 1.14.0
    formatter : dict of callables, optional
        If not None, the keys should indicate the type(s) that the respective
        formatting function applies to.  Callables should return a string.
        Types that are not specified (by their corresponding keys) are handled
        by the default formatters.  Individual types for which a formatter
        can be set are:

        - 'bool'
        - 'int'
        - 'timedelta' : a `numpy.timedelta64`
        - 'datetime' : a `numpy.datetime64`
        - 'float'
        - 'longfloat' : 128-bit floats
        - 'complexfloat'
        - 'longcomplexfloat' : composed of two 128-bit floats
        - 'void' : type `numpy.void`
        - 'numpystr' : types `numpy.string_` and `numpy.unicode_`
        - 'str' : all other strings

        Other keys that can be used to set a group of types at once are:

        - 'all' : sets all types
        - 'int_kind' : sets 'int'
        - 'float_kind' : sets 'float' and 'longfloat'
        - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat'
        - 'str_kind' : sets 'str' and 'numpystr'
    threshold : int, optional
        Total number of array elements which trigger summarization
        rather than full repr.
    edgeitems : int, optional
        Number of array items in summary at beginning and end of
        each dimension.
    sign : string, either '-', '+', or ' ', optional
        Controls printing of the sign of floating-point types. If '+', always
        print the sign of positive values. If ' ', always prints a space
        (whitespace character) in the sign position of positive values.  If
        '-', omit the sign character of positive values.
    floatmode : str, optional
        Controls the interpretation of the `precision` option for
        floating-point types. Can take the following values:

        - 'fixed': Always print exactly `precision` fractional digits,
          even if this would print more or fewer digits than
          necessary to specify the value uniquely.
        - 'unique': Print the minimum number of fractional digits necessary
          to represent each value uniquely. Different elements may
          have a different number of digits.  The value of the
          `precision` option is ignored.
        - 'maxprec': Print at most `precision` fractional digits, but if
          an element can be uniquely represented with fewer digits
          only print it with that many.
        - 'maxprec_equal': Print at most `precision` fractional digits,
          but if every element in the array can be uniquely
          represented with an equal number of fewer digits, use that
          many digits for all elements.
    legacy : string or `False`, optional
        If set to the string `'1.13'` enables 1.13 legacy printing mode. This
        approximates numpy 1.13 print output by including a space in the sign
        position of floats and different behavior for 0d arrays. If set to
        `False`, disables legacy mode. Unrecognized strings will be ignored
        with a warning for forward compatibility.

        .. versionadded:: 1.14.0

    Returns
    -------
    array_str : str
        String representation of the array.

    Raises
    ------
    TypeError
        if a callable in `formatter` does not return a string.

    See Also
    --------
    array_str, array_repr, set_printoptions, get_printoptions

    Notes
    -----
    If a formatter is specified for a certain type, the `precision` keyword is
    ignored for that type.

    This is a very flexible function; `array_repr` and `array_str` are using
    `array2string` internally so keywords with the same name should work
    identically in all three functions.

    Examples
    --------
    >>> x = np.array([1e-16,1,2,3])
    >>> print(np.array2string(x, precision=2, separator=',',
    ...                       suppress_small=True))
    [ 0., 1., 2., 3.]

    >>> x  = np.arange(3.)
    >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x})
    '[0.00 1.00 2.00]'

    >>> x  = np.arange(3)
    >>> np.array2string(x, formatter={'int':lambda x: hex(x)})
    '[0x0L 0x1L 0x2L]'

    R9   s3   array2string() got unexpected keyword argument '{}'i    s   1.13sT   'style' argument is deprecated and no longer functional except in 1.13 'legacy' modeRE   i   R1   s   []N(    (   RV   R:   RW   RA   RX   RT   RY   R^   RZ   RQ   t   _NoValueRo   Re   R   R   t   itemRL   RM   t   DeprecationWarningRc   R   R   (   Rh   R   R/   R   R   R   R   R8   R,   R+   R7   R.   R   R[   R9   R\   t	   overridesRR   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s,    "		c         C` s   t  |  t  |  | k } | d k rP |  t  |  t  |  k rP t } qP n  | rs |  | j   d 7}  | } n  | | 7} |  | f S(   Ns   1.13s   
(   Rc   RK   t   rstrip(   t   st   linet   wordt
   line_widthR   R9   t
   needs_wrap(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _extendLine  s    	
c         ` sL           f d    z  d d d | d |  SWd d  Xd S(   sg   formatArray is designed for two modes of operation:

    1. Full output

    2. Summarized output

    c         ` s  t  |   }   j | } | d k r3    |   S| d }  d k rR | } n | t  d  }   j | }  o d  | k  } | r  }	  }
 n d }	 | }
 d } | d k rk d k r | t   j    } n% | t t   j    t  d   } | } xX t |	  D]J }  |  | f | |  } t | | | | |   \ } } |  7} qW| rt | |  | |   \ } }  d k r| d 7} q|  7} n  x_ t |
 d d	  D]K }  |  | f | |  } t | | | | |   \ } } |  7} qW d k r'| } n   |  d | |  } t | | | | |   \ } } | | 7} n	d }  j   d
 | d } x? t |	  D]1 }  |  | f | |  } | | | | 7} qW| r d k r| |  d 7} q| |  | 7} n  xF t |
 d d	  D]2 }  |  | f | |  } | | | | 7} qW |  d | |  } | | | 7} d | t  |  d } | S(   s   
        By using this local function, we don't need to recurse with all the
        arguments. Since this function is not created recursively, the cost is
        not significant
        i    RD   s   1.13t   ]i   Rw   i   s   , is   
s   , 
t   [(   i(   i(   Rc   Rd   Re   R   t   maxt   rangeR   (   Ri   t   hanging_indentt
   curr_widthRb   t	   axes_leftt   next_hanging_indentt
   next_widtht   a_lent   show_summaryt   leading_itemst   trailing_itemsR   t
   elem_widthR   t   iR   t   line_sept   nested(   Rh   t
   edge_itemsR   R9   t   recurserR   R   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     sx    
		%		Ri   R   R   N(    (   R:   (   Rh   R   R   R   R   R   R   R9   (    (   Rh   R   R   R9   R   R   R   s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    	!bc         C` s8   |  d  k r d S|  d k  r4 t d j |    n  |  S(   Nii    s   {} must be >= 0(   R:   RI   RA   (   Rp   t   name(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _none_or_positive_arg9  s
    Rz   c           B` s,   e  Z d  Z e d  Z d   Z d   Z RS(   s'    Formatter for subtypes of np.floating c         K` s   t  | t  r$ | r d n d } n  | j d t  |  _ |  j d k ro | j d k ro | d k ro d } qo n  | |  _ | d k r d  |  _ n	 | |  _ t	 |  j d  |  _ | |  _
 | |  _ t |  _ t |  _ |  j |  d  S(	   NRC   R6   R9   s   1.13RD   R?   R/   (    (   RN   RH   t   getRK   t   _legacyRe   R.   R:   R/   R   R   R7   t
   exp_formatt   large_exponentt
   fillFormat(   R   Ru   R/   R.   R   R7   R[   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   __init__B  s     						c         ` s  | t  |  } t | | d k  } t |  d k r t j |  } t j |  } t d d  C | d k s   j r | d k  s | | d k r t   _	 n  Wd  QXn  t |  d k r d   _
 d   _ d   _ d   _ t   _ nA  j	 r d t     j d	 k s#  j d
 k r3d t   n      f d   | D } t d   | D   \ } } }	 t d   | D   \ }
 } t d   |	 D  d   _ d   _ t d   | D    _   j d
 k rd   _
 n t d   |
 D    _
   j d   j   _ t   _ nd t     j d	 k rLd t   n      f d   | D } t d   | D   \ }
 }   j d
 k rd t d   |
 D    _
 n t d   |
 D    _
 t d   | D    _ d   _   j d k r  j   _ t   _ d   _ n t   _ d   _   j d
 k ry  j d k ryt t j |   ry  j
 d 7_
 qyn  | j | j k r
  j d k pt | t |  d k   } t t d  } t t d  | }   j d } t   j
 | | | |    _
 n  d  S(    Ni    t   overt   ignoreg    חAg-C6?g     @@t   .iR>   s   1.13R<   c         3` s?   |  ]5 } t  | d    j d  d  d   j d k Vq d S(   R/   R?   t   trimR7   RC   N(   R   R/   R7   (   R;   Rp   (   R   R   R?   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>v  s   c         s` s   |  ] } | j  d   Vq d S(   t   eN(   t	   partition(   R;   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>y  s    c         s` s   |  ] } | j  d   Vq d S(   R   N(   t   split(   R;   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>z  s    c         s` s   |  ] } t  |  Vq d  S(   N(   Rc   (   R;   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>{  s    i   c         s` s   |  ] } t  |  Vq d  S(   N(   Rc   (   R;   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>~  s    i   c         s` s   |  ] } t  |  Vq d  S(   N(   Rc   (   R;   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>  s    i   c         3` sE   |  ]; } t  | d    j d t d  d  d   j d k Vq d S(   R/   t
   fractionalR?   R   R7   RC   N(   R   R/   t   TrueR7   (   R;   Rp   (   R   R   R?   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>  s   c         s` s   |  ] } | j  d   Vq d S(   R   N(   R   (   R;   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>  s    c         s` s$   |  ] } t  | j d    Vq d S(   s   -+N(   Rc   t   lstrip(   R;   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>  s    c         s` s   |  ] } t  |  Vq d  S(   N(   Rc   (   R;   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>  s    c         s` s   |  ] } t  |  Vq d  S(   N(   Rc   (   R;   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>  s    R@   RD   R6   R3   R5   (   R>   R@   (   R   R   Rc   RQ   R   t   minR!   R   R   R   t   pad_leftt	   pad_rightR   t   exp_sizeR?   R.   R   RK   t   zipR/   R7   R   t   signbitR   R   RY   (   R   Ru   t   finite_valst   abs_non_zerot   max_valt   min_valt   strst	   frac_strst   _t   exp_strst   int_partt	   frac_partt   neginft   nanlent   inflent   offset(    (   R   R   R?   s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR   ]  sr    					
	
 				%+c         C` sa  t  j |  s t d d   t  j |  rZ |  j d k rC d n d } | t d } n; | d k  rl d n |  j d k r d n d } | t d } d	 |  j |  j d
 t |  | SWd  QXn  |  j	 rt
 | d |  j d |  j d |  j d |  j d k d |  j d |  j St | d |  j d |  j d t d |  j d |  j d k d |  j d |  j Sd  S(   Nt   invalidR   RC   Rw   R3   i    R6   R5   RD   i   R/   R?   R   R7   R   t
   exp_digitsR   R   (   RQ   R   R!   R   R7   RY   R   R   Rc   R   R   R/   R?   R   R   R   R   (   R   Rp   R7   t   ret(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   __call__  s0    --						
					(   t   __name__t
   __module__t   __doc__RK   R   R   R
  (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRz   @  s   	Tt   FloatFormatc           B` s   e  Z d    Z RS(   c         O` s3   t  j d t d d t t |   j | |   d  S(   Ns/   FloatFormat has been replaced by FloatingFormatRE   i   (   RL   RM   R   t   superR  R   (   R   R_   R`   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    	(   R  R  R   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR    s   t   LongFloatFormatc           B` s   e  Z d    Z RS(   c         O` s3   t  j d t d d t t |   j | |   d  S(   Ns3   LongFloatFormat has been replaced by FloatingFormatRE   i   (   RL   RM   R   R  R  R   (   R   R_   R`   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    	(   R  R  R   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR    s   R<   c         C` s[   t  | d  } t  | d  } t  | d  } t |  d | d | d | d | d | d | S(   s	  
    Format a floating-point scalar as a decimal string in scientific notation.

    Provides control over rounding, trimming and padding. Uses and assumes
    IEEE unbiased rounding. Uses the "Dragon4" algorithm.

    Parameters
    ----------
    x : python float or numpy floating scalar
        Value to format.
    precision : non-negative integer or None, optional
        Maximum number of digits to print. May be None if `unique` is
        `True`, but must be an integer if unique is `False`.
    unique : boolean, optional
        If `True`, use a digit-generation strategy which gives the shortest
        representation which uniquely identifies the floating-point number from
        other values of the same type, by judicious rounding. If `precision`
        was omitted, print all necessary digits, otherwise digit generation is
        cut off after `precision` digits and the remaining value is rounded.
        If `False`, digits are generated as if printing an infinite-precision
        value and stopping after `precision` digits, rounding the remaining
        value.
    trim : one of 'k', '.', '0', '-', optional
        Controls post-processing trimming of trailing digits, as follows:

        * 'k' : keep trailing zeros, keep decimal point (no trimming)
        * '.' : trim all trailing zeros, leave decimal point
        * '0' : trim all but the zero before the decimal point. Insert the
          zero if it is missing.
        * '-' : trim trailing zeros and any trailing decimal point
    sign : boolean, optional
        Whether to show the sign for positive values.
    pad_left : non-negative integer, optional
        Pad the left side of the string with whitespace until at least that
        many characters are to the left of the decimal point.
    exp_digits : non-negative integer, optional
        Pad the exponent with zeros until it contains at least this many digits.
        If omitted, the exponent will be at least 2 digits.

    Returns
    -------
    rep : string
        The string representation of the floating point value

    See Also
    --------
    format_float_positional

    Examples
    --------
    >>> np.format_float_scientific(np.float32(np.pi))
    '3.1415927e+00'
    >>> s = np.float32(1.23e24)
    >>> np.format_float_scientific(s, unique=False, precision=15)
    '1.230000071797338e+24'
    >>> np.format_float_scientific(s, exp_digits=4)
    '1.23e+0024'
    R/   R   R  R?   R   R7   (   R   R   (   Rp   R/   R?   R   R7   R   R  (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    =c         C` sa   t  | d  } t  | d  } t  | d  } t |  d | d | d | d | d | d | d | S(   s
  
    Format a floating-point scalar as a decimal string in positional notation.

    Provides control over rounding, trimming and padding. Uses and assumes
    IEEE unbiased rounding. Uses the "Dragon4" algorithm.

    Parameters
    ----------
    x : python float or numpy floating scalar
        Value to format.
    precision : non-negative integer or None, optional
        Maximum number of digits to print. May be None if `unique` is
        `True`, but must be an integer if unique is `False`.
    unique : boolean, optional
        If `True`, use a digit-generation strategy which gives the shortest
        representation which uniquely identifies the floating-point number from
        other values of the same type, by judicious rounding. If `precision`
        was omitted, print out all necessary digits, otherwise digit generation
        is cut off after `precision` digits and the remaining value is rounded.
        If `False`, digits are generated as if printing an infinite-precision
        value and stopping after `precision` digits, rounding the remaining
        value.
    fractional : boolean, optional
        If `True`, the cutoff of `precision` digits refers to the total number
        of digits after the decimal point, including leading zeros.
        If `False`, `precision` refers to the total number of significant
        digits, before or after the decimal point, ignoring leading zeros.
    trim : one of 'k', '.', '0', '-', optional
        Controls post-processing trimming of trailing digits, as follows:

        * 'k' : keep trailing zeros, keep decimal point (no trimming)
        * '.' : trim all trailing zeros, leave decimal point
        * '0' : trim all but the zero before the decimal point. Insert the
          zero if it is missing.
        * '-' : trim trailing zeros and any trailing decimal point
    sign : boolean, optional
        Whether to show the sign for positive values.
    pad_left : non-negative integer, optional
        Pad the left side of the string with whitespace until at least that
        many characters are to the left of the decimal point.
    pad_right : non-negative integer, optional
        Pad the right side of the string with whitespace until at least that
        many characters are to the right of the decimal point.

    Returns
    -------
    rep : string
        The string representation of the floating point value

    See Also
    --------
    format_float_scientific

    Examples
    --------
    >>> np.format_float_positional(np.float32(np.pi))
    '3.1415927'
    >>> np.format_float_positional(np.float16(np.pi))
    '3.14'
    >>> np.format_float_positional(np.float16(0.3))
    '0.3'
    >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10)
    '0.3000488281'
    R/   R   R   R?   R   R   R7   (   R   R   (   Rp   R/   R?   R   R   R7   R   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR
   "  s    DRx   c           B` s   e  Z d    Z d   Z RS(   c         C` sg   | j  d k rK t t t t j |    t t t j |     } n d } d j |  |  _ d  S(   Ni    s   %{}d(   R   R   Rc   Rr   RQ   R   RA   (   R   Ru   t   max_str_len(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR   p  s
    !c         C` s   |  j  | S(   N(   RA   (   R   Rp   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR
  x  s    (   R  R  R   R
  (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRx   o  s   	Rt   c           B` s   e  Z d    Z d   Z RS(   c         K` s"   | j  d k r d n d |  _ d  S(   Ns    TrueR   (    (   Re   t   truestr(   R   Ru   R`   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR   }  s    c         C` s   | r |  j  Sd S(   NRK   (   R  (   R   Rp   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR
    s    (   R  R  R   R
  (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyRt   |  s   	R   c           B` s#   e  Z d  Z e d  Z d   Z RS(   s.    Formatter for subtypes of np.complexfloating c   	      K` s   t  | t  r$ | r d n d } n  | } } | j d t  d k rU d } d } n  t | j | | | d | | |  _ t | j | | | d d | |  _ d  S(   NRC   R6   R9   s   1.13R@   R-   R7   (	   RN   RH   R   RK   Rz   t   realt   real_formatt   imagt   imag_format(	   R   Rp   R/   R.   R   R7   R[   t   floatmode_realt   floatmode_imag(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    
	c         C` sT   |  j  | j  } |  j | j  } t | j    } | |  d | | } | | S(   Nt   j(   R  R  R  R  Rc   R   (   R   Rp   t   rR   t   sp(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR
    s
    (   R  R  R  RK   R   R
  (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s   t   ComplexFormatc           B` s   e  Z d    Z RS(   c         O` s3   t  j d t d d t t |   j | |   d  S(   Ns8   ComplexFormat has been replaced by ComplexFloatingFormatRE   i   (   RL   RM   R   R  R  R   (   R   R_   R`   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    (   R  R  R   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR    s   t   LongComplexFormatc           B` s   e  Z d    Z RS(   c         O` s3   t  j d t d d t t |   j | |   d  S(   Ns<   LongComplexFormat has been replaced by ComplexFloatingFormatRE   i   (   RL   RM   R   R  R  R   (   R   R_   R`   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    (   R  R  R   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR    s   t   _TimelikeFormatc           B` s#   e  Z d    Z d   Z d   Z RS(   c         C` s   | t  |  } t |  d k re t t |  j t j |    t |  j t j |     } n d } t |  | j k  r t | d  } n  d j |  |  _ d j	 |  |  _
 d  S(   Ni    i   s   %{}ss   'NaT'(   R   Rc   R   t   _format_non_natRQ   R   R   RA   t   _formatt   rjustt   _nat(   R   Ru   t   non_natR  (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    $c         C` s
   t   d  S(   N(   t   NotImplementedError(   R   Rp   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR    s    c         C` s+   t  |  r |  j S|  j |  j |  Sd  S(   N(   R   R"  R   R  (   R   Rp   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR
    s    (   R  R  R   R  R
  (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR    s   		R   c           B` s/   e  Z d d d  e d  Z d   Z d   Z RS(   t	   same_kindc         C` s   | d  k r= | j j d k r4 t | j  d } q= d } n  | d  k rR d } n  | |  _ | |  _ | |  _ | |  _ t t	 |   j
 |  d  S(   Nt   Mi    R   t   naive(   R:   R   t   kindR   t   timezonet   unitt   castingR9   R  R   R   (   R   Rp   R*  R)  R+  R9   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    						c         C` s2   |  j  d k r |  j |  St t |   j |  S(   Ns   1.13(   R9   R  R  R   R
  (   R   Rp   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR
    s    c      	   C` s)   d t  | d |  j d |  j d |  j S(   Ns   '%s'R*  R)  R+  (   R   R*  R)  R+  (   R   Rp   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR    s    		N(   R  R  R:   RK   R   R
  R  (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s   		R   c           B` s   e  Z d    Z RS(   c         C` s   t  | j d   S(   Nt   i8(   Rr   t   astype(   R   Rp   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR    s    (   R  R  R  (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s   t   SubArrayFormatc           B` s   e  Z d    Z d   Z RS(   c         C` s   | |  _  d  S(   N(   R   (   R   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    c         ` sY   | j  d k r4 d d j   f d   | D  d Sd d j   f d   | D  d S(   Ni   R   s   , c         3` s   |  ] }   j  |  Vq d  S(   N(   R   (   R;   Rh   (   R   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>  s    R   c         3` s   |  ] }   j  |  Vq d  S(   N(   R
  (   R;   Rh   (   R   (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pys	   <genexpr>  s    (   Rd   RJ   (   R   t   arr(    (   R   s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR
    s    %(   R  R  R   R
  (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR.    s   	R   c           B` s/   e  Z d  Z d   Z e d    Z d   Z RS(   s   
    Formatter for structured np.void objects.

    This does not work on structured alias types like np.dtype(('i4', 'i2,i2')),
    as alias scalars lose their field information, and the implementation
    relies upon np.void.__getitem__.
    c         C` s   | |  _  d  S(   N(   t   format_functions(   R   R0  (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    c         K` sl   g  } xY | j  j D]K } t | | |  } | j  | j d k rQ t |  } n  | j |  q W|  |  S(   s   
        This is a second way to initialize StructuredVoidFormat, using the raw data
        as input. Added to avoid changing the signature of __init__.
        (    (   R   R   R   Re   R.  t   append(   t   clsRu   RR   R0  t
   field_nameR   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    c         C` sn   g  t  | |  j  D] \ } } | |  ^ q } t |  d k rT d j | d  Sd j d j |   Sd  S(   Ni   s   ({},)i    s   ({})s   , (   R   R0  Rc   RA   RJ   (   R   Rp   t   fieldR   t
   str_fields(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR
    s
    .(   R  R  R  R   t   classmethodR   R
  (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s   	t   StructureFormatc           B` s   e  Z d    Z RS(   c         O` s3   t  j d t d d t t |   j | |   d  S(   Ns9   StructureFormat has been replaced by StructuredVoidFormatRE   i   (   RL   RM   R   R  R7  R   (   R   R_   R`   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR   !  s    (   R  R  R   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR7     s   c         C` s   t  j t |   t  |   S(   s   
    Implements the repr for structured-void scalars. It is called from the
    scalartypes.c.src code, and is placed here because it uses the elementwise
    formatters defined above.
    (   R   R   R   RY   (   Rp   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _void_scalar_repr)  s    c         C` sR   t  j |   }  t d d k r2 |  j t k r2 t S|  j d k	 rE t S|  j t k S(   s"  
    Determine if the given dtype is implied by the representation of its values.

    Parameters
    ----------
    dtype : dtype
        Data type

    Returns
    -------
    implied : bool
        True if the dtype is implied by the representation of its values.

    Examples
    --------
    >>> np.core.arrayprint.dtype_is_implied(int)
    True
    >>> np.array([1, 2, 3], int)
    array([1, 2, 3])
    >>> np.core.arrayprint.dtype_is_implied(np.int8)
    False
    >>> np.array([1, 2, 3], np.int8)
    array([1, 2, 3], dtype=np.int8)
    R9   s   1.13N(	   RQ   R   RY   Rj   R'   RK   R   R:   t   _typelessdata(   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   dtype_is_implied9  s    c         C` sx   |  j  d k	 r t |   St |  j t  r9 d t |   S|  j } | rt | d j   oa | j   rt t	 |  } n  | S(   s   
    Convert a dtype to a short form which evaluates to the same dtype.

    The intent is roughly that the following holds

    >>> from numpy import *
    >>> assert eval(dtype_short_repr(dt)) == dt
    s   '%s'i    N(
   R   R:   Rr   R   Rj   R(   R   t   isalphat   isalnumRo   (   R   t   typename(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   dtype_short_repr]  s    	
	#c      	   C` s  | d k r t d } n  t |   t k	 r= t |   j } n d } t |  j  o^ |  j d k } | d } | rw d n d } t d d k r |  j d k r |  j j	 r t
 |  j    }	 nX |  j d k s |  j d k r | |  | | | d	 | d
 | }	 n d t
 |  j  f }	 | |	 | }
 | r.|
 Sd j t |  j   } t |
  |
 j d  d } d } t d d k rt |  j j t  rd d t | d  } qn5 | t |  d | k rd d t | d  } n  |
 | | S(   sE   Internal version of array_repr() that allows overriding array2string.R1   R   i    t   (t   )t   ,R9   s   1.13s   , R   s   [], shape=%ss	   dtype={})s   
i   RD   N(    (   i    (   R:   RY   Rj   R   R  R:  R   R   Re   R   Ro   R   RA   R>  Rc   t   rfindR   R(   (   R/  R   R/   R   R   t
   class_namet	   skipdtypeR   R   R   t   arr_strt	   dtype_strt   last_line_lent   spacer(    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _array_repr_implementationu  s6    
c         C` s   |  f S(   N(    (   R/  R   R/   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _array_repr_dispatcher  s    c         C` s   t  |  | | |  S(   s  
    Return the string representation of an array.

    Parameters
    ----------
    arr : ndarray
        Input array.
    max_line_width : int, optional
        The maximum number of columns the string should span. Newline
        characters split the string appropriately after array elements.
    precision : int, optional
        Floating point precision. Default is the current printing precision
        (usually 8), which can be altered using `set_printoptions`.
    suppress_small : bool, optional
        Represent very small numbers as zero, default is False. Very small
        is defined by `precision`, if the precision is 8 then
        numbers smaller than 5e-9 are represented as zero.

    Returns
    -------
    string : str
      The string representation of an array.

    See Also
    --------
    array_str, array2string, set_printoptions

    Examples
    --------
    >>> np.array_repr(np.array([1,2]))
    'array([1, 2])'
    >>> np.array_repr(np.ma.array([0.]))
    'MaskedArray([ 0.])'
    >>> np.array_repr(np.array([], np.int32))
    'array([], dtype=int32)'

    >>> x = np.array([1e-6, 4e-7, 2, 3])
    >>> np.array_repr(x, precision=6, suppress_small=True)
    'array([ 0.000001,  0.      ,  2.      ,  3.      ])'

    (   RI  (   R/  R   R/   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    +c         C` s}   t  d d k r< |  j d k r< |  j j r< t |  j    S|  j d k rd t t j j	 |  d   S| |  | | | d d  S(   sD   Internal version of array_str() that allows overriding array2string.R9   s   1.13RD   Rw   (    (    (    (
   RY   Re   R   R   Rr   R   t   _guarded_strRQ   R   t   __getitem__(   Rh   R   R/   R   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _array_str_implementation  s    c         C` s   |  f S(   N(    (   Rh   R   R/   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   _array_str_dispatcher  s    c         C` s   t  |  | | |  S(   s=  
    Return a string representation of the data in an array.

    The data in the array is returned as a single string.  This function is
    similar to `array_repr`, the difference being that `array_repr` also
    returns information on the kind of array and its data type.

    Parameters
    ----------
    a : ndarray
        Input array.
    max_line_width : int, optional
        Inserts newlines if text is longer than `max_line_width`.  The
        default is, indirectly, 75.
    precision : int, optional
        Floating point precision.  Default is the current printing precision
        (usually 8), which can be altered using `set_printoptions`.
    suppress_small : bool, optional
        Represent numbers "very close" to zero as zero; default is False.
        Very close is defined by precision: if the precision is 8, e.g.,
        numbers smaller (in absolute value) than 5e-9 are represented as
        zero.

    See Also
    --------
    array2string, array_repr, set_printoptions

    Examples
    --------
    >>> np.array_str(np.arange(3))
    '[0 1 2]'

    (   RM  (   Rh   R   R/   R   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR     s    #t   __wrapped__c         C` sI   |  d k r5 | r" t j t d  St j t d  Sn t j |  |  Sd S(   s
  
    Set a Python function to be used when pretty printing arrays.

    Parameters
    ----------
    f : function or None
        Function to be used to pretty print arrays. The function should expect
        a single array argument and return a string of the representation of
        the array. If None, the function is reset to the default NumPy function
        to print arrays.
    repr : bool, optional
        If True (default), the function for pretty printing (``__repr__``)
        is set, if False the function that returns the default string
        representation (``__str__``) is set.

    See Also
    --------
    set_printoptions, get_printoptions

    Examples
    --------
    >>> def pprint(arr):
    ...     return 'HA! - What are you going to do now?'
    ...
    >>> np.set_string_function(pprint)
    >>> a = np.arange(10)
    >>> a
    HA! - What are you going to do now?
    >>> print(a)
    [0 1 2 3 4 5 6 7 8 9]

    We can reset the function to the default:

    >>> np.set_string_function(None)
    >>> a
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    `repr` affects either pretty printing or normal string representation.
    Note that ``__repr__`` is still affected by setting ``__str__``
    because the width of each array element in the returned string becomes
    equal to the length of the result of ``__str__()``.

    >>> x = np.arange(4)
    >>> np.set_string_function(lambda x:'random', repr=False)
    >>> x.__str__()
    'random'
    >>> x.__repr__()
    'array([     0,      1,      2,      3])'

    i   i    N(   R:   R   R   t   _default_array_reprt   _default_array_str(   R   Ro   (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyR   #  s
    3(    (u   R  t
   __future__R    R   R   t   __all__t   __docformat__t   sysR   RO   t   version_infot   _threadR   t   ImportErrort   _dummy_threadt   threadt   dummy_threadRU   RQ   Rw   R   R   t   umathR   R   R   R   R   R   R   R   R   R   R   R   R   R   t   fromnumericR   R   t   numericR   R    R!   R"   R#   R$   R%   R&   R'   R(   R   R)   R*   RL   t
   contextlibRK   R:   RY   RT   R   R   t   contextmanagerR	   Rf   Rn   Rq   Rs   R   R   R   R   R   R   R   R   R   R   R   Rz   R  R  R   R   R
   Rx   Rt   R   R  R  R  R   R   R.  R   R7  R8  R9  R   Ry   R1  R:  R>  RI  RJ  R   Rr   RK  RM  RN  R   t   getattrt   _array2string_implt   partialRQ  RP  R   (    (    (    s4   lib/python2.7/site-packages/numpy/core/arrayprint.pyt   <module>   s   	.44
				!				5	'					v			C		J
 
%				$		..	'		;