ó
šxŠ\c           @   sn   d  Z  d d l Z d d l Z d d l m Z d a d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z d S(
   s+   
Internal module for console introspection
iÿÿÿÿN(   t   get_terminal_sizec          C   s½   d }  y t j j p t j j }  Wn t t f k
 r; n X|  sU d |  j ƒ  k r| y t j	 ƒ  }  Wq| t
 k
 rx q| Xn  |  s• d |  j ƒ  k r¤ t j ƒ  }  n  t s¹ t j ƒ  a n  |  S(   sŒ   
    Try to find the most capable encoding supported by the console.
    slightly modified from the way IPython handles the same issue.
    t   asciiN(   t   Nonet   syst   stdoutt   encodingt   stdint   AttributeErrort   IOErrort   lowert   localet   getpreferredencodingt	   Exceptiont   getdefaultencodingt   _initial_defencoding(   R   (    (    s8   lib/python2.7/site-packages/pandas/io/formats/console.pyt   detect_console_encoding   s    c          C   s™   d d l  m }  |  d ƒ } |  d ƒ } t ƒ  rw t ƒ  re d d l m } | d ƒ } | d ƒ } qƒ t ƒ  \ } } n d \ } } | pŒ | | p• | f S(   si   Return console size as tuple = (width, height).

    Returns (None,None) in non-interactive session.
    iÿÿÿÿ(   t
   get_options   display.widths   display.max_rows(   t   get_default_valN(   NN(   t   pandasR   t   in_interactive_sessiont   in_ipython_frontendt   pandas.core.configR   R    R   (   R   t   display_widtht   display_heightR   t   terminal_widtht   terminal_height(    (    s8   lib/python2.7/site-packages/pandas/io/formats/console.pyt   get_console_size/   s    		c             sL   d d l  m ‰  ‡  f d †  }  y t p. |  ƒ  SWn t k
 rG |  ƒ  SXd S(   sx    check if we're running in an interactive shell

    returns True if running under python/ipython interactive shell
    iÿÿÿÿ(   R   c             sE   y d d  l  }  Wn t k
 r* ˆ  d ƒ SXt |  d ƒ pD ˆ  d ƒ S(   Niÿÿÿÿs   mode.sim_interactivet   __file__(   t   __main__t   ModuleNotFoundErrort   hasattr(   t   main(   R   (    s8   lib/python2.7/site-packages/pandas/io/formats/console.pyt
   check_maina   s    N(   R   R   t   __IPYTHON__t	   NameError(   R    (    (   R   s8   lib/python2.7/site-packages/pandas/io/formats/console.pyR   Z   s    c          C   s~   ye t  ƒ  }  |  j j d i  ƒ j d d ƒ pK |  j j d i  ƒ j d d ƒ } d | j ƒ  k rd t SWn t k
 ry t SXt S(   s•   
    check if we're inside an IPython qtconsole

    .. deprecated:: 0.14.1
       This is no longer needed, or working, in IPython 3 and above.
    t	   KernelAppt   parent_appnamet    t   IPKernelAppt	   qtconsole(   t   get_ipythont   configt   getR	   t   TrueR"   t   False(   t   ipt	   front_end(    (    s8   lib/python2.7/site-packages/pandas/io/formats/console.pyt   in_qtconsoleo   s    	!!c          C   s~   ye t  ƒ  }  |  j j d i  ƒ j d d ƒ pK |  j j d i  ƒ j d d ƒ } d | j ƒ  k rd t SWn t k
 ry t SXt S(   s”   
    check if we're inside an IPython Notebook

    .. deprecated:: 0.14.1
       This is no longer needed, or working, in IPython 3 and above.
    R#   R$   R%   R&   t   notebook(   R(   R)   R*   R	   R+   R"   R,   (   R-   R.   (    (    s8   lib/python2.7/site-packages/pandas/io/formats/console.pyt   in_ipnb‚   s    	!!c          C   sA   y) t  ƒ  }  d t t |  ƒ ƒ j ƒ  k SWn t k
 r< n Xt S(   s:   
    check if we're inside an an IPython zmq frontend
    t   zmq(   R(   t   strt   typeR	   R"   R,   (   R-   (    (    s8   lib/python2.7/site-packages/pandas/io/formats/console.pyR   •   s    	 (   t   __doc__R
   R   t   pandas.io.formats.terminalR    R   R   R   R   R   R/   R1   R   (    (    (    s8   lib/python2.7/site-packages/pandas/io/formats/console.pyt   <module>   s   	 	+			