ó
šßÈ[c           @` s‘   d  Z  d d l m Z m Z m Z m Z d d l Z d d l Z d d l Z	 d d l
 m Z d d g Z d d	 d
 „ Z d e f d „  ƒ  YZ d S(   u7   
Table property for providing information about table.
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsNi   (   t   DataInfou
   table_infou	   TableInfou
   attributesu    c         C` ss  d d l  m } | d k r( t j } n  |  j j g } |  j rP | j d ƒ n  | j d j t	 |  ƒ ƒ ƒ d d j
 | ƒ d g } |  j j ƒ  } |  j rð g  } x* | D]" } | j | j | d	 d ƒƒ q« W| | d
 t | d ƒ ƒ}	 n	 | ƒ  }	 | d k r	|	 Sd |	 j k rct d „  | Dƒ ƒ }
 t	 |
 ƒ d k rct | d |  j ƒ rc|	 d =qcn  d |	 j k r•t j |	 d d k ƒ r•|	 d =n  d |	 j k rÍt j |	 d t	 |  ƒ k ƒ rÍ|	 d =n  xJ |	 j D]? } |	 | j j d k r×t j |	 | d k ƒ r×|	 | =q×q×W|  j rK| j |	 j d d d d d t ƒ ƒ n | j d ƒ | j d „  | Dƒ ƒ d S(   u  
    Write summary information about column to the ``out`` filehandle.
    By default this prints to standard output via sys.stdout.

    The ``option`` argument specifies what type of information
    to include.  This can be a string, a function, or a list of
    strings or functions.  Built-in options are:

    - ``attributes``: basic column meta data like ``dtype`` or ``format``
    - ``stats``: basic statistics: minimum, mean, and maximum

    If a function is specified then that function will be called with the
    column as its single argument.  The function must return an OrderedDict
    containing the information attributes.

    If a list is provided then the information attributes will be
    appended for each of the options, in order.

    Examples
    --------
    >>> from astropy.table.table_helpers import simple_table
    >>> t = simple_table(size=2, kinds='if')
    >>> t['a'].unit = 'm'
    >>> t.info()
    <Table length=2>
    name  dtype  unit
    ---- ------- ----
       a   int64    m
       b float64

    >>> t.info('stats')
    <Table length=2>
    name mean std min max
    ---- ---- --- --- ---
       a  1.5 0.5   1   2
       b  1.5 0.5 1.0 2.0

    Parameters
    ----------
    option : str, function, list of (str or function)
        Info option, defaults to 'attributes'.
    out : file-like object, None
        Output destination, default is sys.stdout.  If None then a
        Table with information attributes is returned

    Returns
    -------
    info : `~astropy.table.Table` if out==None else None
    i   (   t   Tableu    u   masked=Trueu
   length={0}u   <u    u   >t   outt   namesi    u   classc         s` s   |  ] } t  | ƒ Vq d  S(   N(   t   type(   t   .0t   col(    (    s1   lib/python2.7/site-packages/astropy/table/info.pys	   <genexpr>`   s    u   n_badu   lengthu   SUt	   max_widthiÿÿÿÿt	   max_linest	   show_unitu   <No columns>c         s` s   |  ] } | t  j Vq d  S(   N(   t   ost   linesep(   R	   t   outline(    (    s1   lib/python2.7/site-packages/astropy/table/info.pys	   <genexpr>t   s    N(   t   tableR   t   syst   stdoutt	   __class__t   __name__t   maskedt   appendt   formatt   lent   joint   columnst   valuest   colnamest   infot   Nonet   listt   sett
   isinstancet   ColumnClasst   npt   allt   dtypet   kindt   extendt   pformatt   Falset
   writelines(   t   tblt   optionR   R   t
   descr_valst   outlinest   colst   infosR
   R   t
   uniq_typest   name(    (    s1   lib/python2.7/site-packages/astropy/table/info.pyt
   table_info   s@    2		 	((
.
/	(t	   TableInfoc           B` s)   e  Z d Z d  d d „ Z e j e _ RS(   u
   attributesu    c         C` s   t  |  j | | ƒ S(   N(   R4   t   _parent(   t   selfR-   R   (    (    s1   lib/python2.7/site-packages/astropy/table/info.pyt   __call__z   s    N(   R   t
   __module__R   R6   R8   R4   t   __doc__(    (    (    s1   lib/python2.7/site-packages/astropy/table/info.pyR5   w   s   (   R:   t
   __future__R    R   R   R   R   R   t   numpyR$   t   utils.data_infoR   t   __all__R4   R5   (    (    (    s1   lib/python2.7/site-packages/astropy/table/info.pyt   <module>   s   "g