σ
ίΘ[c        
   @@  s  d  Z  d d l m Z d d l Z d d l Z d d l m Z e j d  d- k  r^ e d  n  d d  Z	 d	   Z
 y e WnX e k
 rΥ d d
 l m Z e d d k rΊ d d l Z n d d l Z e
   e _ n Xy d d l m a Wn e k
 rd a n Xy d d l m a Wn e k
 r1d a n Xd Z d t k rMd Z n d j t  Z d   Z e sue   n  d d l m Z d e j f d     YZ e   Z d d l m Z e j  e! d  Z" d   Z# d   Z$ d   Z% e%   Z& Z' d d l( Z( e( j)   Z* e sId d l+ m, Z, m- Z- e,   Z* e#   d d l. m/ Z/ n  d   Z0 d d  d! d" d# d$ d% d& d' d( g
 Z1 d d) l2 m3 Z4 x e5   D] Z6 e6 j7 d*  r΄e6 j8 d*  p e6 e1 k p e6 d d+ k o e9 e:   e6 e4  o e:   e6 j; j7 e; d,  se:   e6 =qqW[6 [4 d S(.   sξ   
Astropy is a package intended to contain core functionality and some
common tools needed for performing astronomy and astrophysics research with
Python. It also provides an index for other astronomy packages and tools for
managing them.
i    (   t   absolute_importN(   t   warni   i   s7   Astropy does not support Python 2.6 (in v1.2 and later)c         C@  s   |  d k r3 t j j t j j t  t j  }  n' t j j |   rZ t j j |   }  n  t j j |   } t j j	 t j j | d   S(   ss   
    Returns whether the source for this module is directly in an astropy
    source distribution or checkout.
    s   .astropy-rootN(
   t   Nonet   ost   patht   joint   dirnamet   __file__t   pardirt   isfilet   abspatht   exists(   R   t
   source_dir(    (    s/   lib/python2.7/site-packages/astropy/__init__.pyt   _is_astropy_source   s    	'c          C@  s_   t  j j d  }  |  s t St |  d t  o^ t j j |  j  j	 d  d k o^ t
 |  j  S(   sk   
    Returns whether we are currently being imported in the context of running
    Astropy's setup.py.
    t   __main__R   t   cos   setup.py(   t   syst   modulest   gett   Falset   getattrR   R   t   basenameR   t   rstripR   (   t   main_mod(    (    s/   lib/python2.7/site-packages/astropy/__init__.pyt   _is_astropy_setup%   s    $(   t   version_infoi   i   (   t   versiont    (   t   githashs   1.9.0t   devs"   http://docs.astropy.org/en/latest/s   http://docs.astropy.org/en/{0}/c          C@  sq   t  }  y d d l } Wn t k
 r) n  Xd d l m } | | t  }  |  sm d j t  } t |   n  | S(   sX   
    Check that Numpy is installed and it is of the minimum version we
    require.
    i    Ni   (   t
   minversions;   Numpy version {0} or later must be installed to use Astropy(   R   t   numpyt   ImportErrort   utilsR   t   __minimum_numpy_version__t   format(   t   requirement_metR   R   t   msg(    (    s/   lib/python2.7/site-packages/astropy/__init__.pyt   _check_numpyZ   s    	(   t   configt   Confc           B@  s   e  Z d  Z e j e d  Z e j e j d k d d d d g Z	 e j d d d d	 d
 d d g Z e j d d d d	 d
 d d g Z RS(   s1   
    Configuration parameters for `astropy`.
    s`   When True, use Unicode characters when outputting values, and displaying widgets at the console.t   win32sG   When True, use ANSI color escape sequences when writing to the console.t   aliasess   astropy.utils.console.USE_COLORs   astropy.logger.USE_COLORt   descriptionsͺ   Maximum number of lines in the display of pretty-printed objects. If not provided, try to determine automatically from the terminal size.  Negative numbers mean no limit.t   cfgtypes   integer(default=None)s   astropy.table.pprint.max_linessΈ   Maximum number of characters per line in the display of pretty-printed objects.  If not provided, try to determine automatically from the terminal size. Negative numbers mean no limit.s   astropy.table.pprint.max_widthN(   t   __name__t
   __module__t   __doc__t   _configt
   ConfigItemR   t   unicode_outputR   t   platformt	   use_colorR   t	   max_linest	   max_width(    (    (    s/   lib/python2.7/site-packages/astropy/__init__.pyR(   z   s$   	(   t
   TestRunnerc          C@  s  d d l  m }  d   } y d d l m } Wnm t k
 r t   r t j d  y t   Wq t	 k
 r } | d  t
 | t  s   q q Xq   n Xt j j t  } y |  j j t |  Wn@ |  j j k
 r} | j d d } t |  j j |   n Xd  S(	   Ni   (   R'   c         S@  sZ   t  j |   t   x3 t t j  D]" } | j d  r$ t j | =q$ q$ Wt d   d  S(   Ns   astropy.t   astropy(   t   logt   errort   _teardown_logt   listR   R   t
   startswithR    (   t   messaget   key(    (    s/   lib/python2.7/site-packages/astropy/__init__.pyt   _rollback_import€   s    (   t	   _compilers‘   You appear to be trying to import astropy from within a source checkout without building the extension modules first.  Attempting to (re)build extension modules:s  An error occurred while attempting to rebuild the extension modules.  Please try manually running `./setup.py develop` or `./setup.py build_ext --inplace` to see what the issue was.  Extension modules must be successfully compiled and importable in order to import astropy.i    sT    Cannot install default profile. If you are importing from source, this is expected.(   R   R'   R!   RA   R    R   R9   t   warningt   _rebuild_extensionst   BaseExceptiont
   isinstancet	   ExceptionR   R   R   R   t   configurationt   update_default_configt   __package__t    ConfigurationDefaultMissingErrort   argsR   t"   ConfigurationDefaultMissingWarning(   R'   R@   RA   t   exct
   config_dirt   et   wmsg(    (    s/   lib/python2.7/site-packages/astropy/__init__.pyt   _initialize_astropy‘   s*    			c          C@  s  d d  l  }  d d  l } d d l m } d d l m } t t j d  } t j	   } t j
 t j j t j j t  t j   zs |  j t j d d d g d	 | d
 | } | d  7 } x- | j   d  k rμ | |  | j d  qΐ WWd  QXWd  t j
 |  | j   X| j d k r9t d j | j    n  y d d l m a Wn t k
 r`n Xy d d l m a Wn t k
 rn Xd  S(   Ni    i   (   t   Spinner(   t   nextt   ws   setup.pyt	   build_exts	   --inplacet   stdoutt   stderrs   Rebuilding extension modulesg©?s   Running setup.py build_ext --inplace failed with error code {0}: try rerunning this command manually to check what the error was.(   R   (   R   (   t
   subprocesst   timet   utils.consoleRR   t
   extern.sixRS   t   openR   t   devnullt   getcwdt   chdirR   R   R   R   R   t   PopenR   t
   executablet   pollR   t   sleept   closet
   returncodet   OSErrorR#   R   t   __version__R    R   t   __githash__(   RX   RY   RR   RS   R]   t   old_cwdt   spt   spinner(    (    s/   lib/python2.7/site-packages/astropy/__init__.pyRC   Ϊ   s8    +	
	c          C@  s   d d  l  }  t j j t j j t  d  } t | d  H } |  j d | j    } t	 |  d k rm d Sd j
 | d  } Wd  QX| S(   Ni    t   CITATIONt   rs
   \{[^()]*\}R   s   @ARTICLE{0}(   t   reR   R   R   R   R   R\   t   findallt   readt   lenR#   (   Rn   t   citation_filet   citationt   refst   bibtexreference(    (    s/   lib/python2.7/site-packages/astropy/__init__.pyt   _get_bibtex  s    ! (   t	   _init_logR;   (   t   find_api_pagec         C@  sq   d d l  m } d d l } t } d | k r7 d } n
 d | } d j | | i |  d	 6  } | j |  d S(
   sξ   
    Search the online Astropy documentation for the given query.
    Opens the results in the default web browser.  Requires an active
    Internet connection.

    Parameters
    ----------
    query : str
        The search query.
    i   (   t	   urlencodei    NR   t   latestt   vs.   http://docs.astropy.org/en/{0}/search.html?{1}t   q(   t   extern.six.moves.urllib.parseRy   t
   webbrowserRg   R#   R\   (   t   queryRy   R~   R   t   url(    (    s/   lib/python2.7/site-packages/astropy/__init__.pyt   online_help%  s    	
Rg   Rh   R"   t
   __bibtex__t   testR9   Rx   R   t   online_docs_roott   conf(   t
   ModuleTypet   __t   _t   .(   i   i   (<   R/   t
   __future__R    R   R   t   warningsR   R   R   R   R   t   _ASTROPY_SETUP_t	   NameErrort   builtinst   __builtin__R   Rg   R    R   Rh   R"   R   R#   R&   R   R'   R0   t   ConfigNamespaceR(   R   t   tests.runnerR7   t   make_test_runner_int   __path__R   RQ   RC   Rv   t   __citation__R   t   loggingt	   getLoggerR9   t   loggerRw   R;   t
   utils.miscRx   R   t   __dir_inc__t   typesR   t   __module_type__t   dirt   varnameR=   t   endswithRE   t   localsR-   (    (    (    s/   lib/python2.7/site-packages/astropy/__init__.pyt   <module>   sx   	

		
		9	-				