ó
öÀ„\c           @   s”  d  Z  d d l m Z d d l m Z d d l m Z d d l m Z m	 Z	 d d l
 m Z d d l m Z m Z d d l m Z e rd d	 l m Z m Z m Z m Z m Z d d
 l m Z m Z m Z d d l m Z d d l m Z d d l m Z d d l m  Z  n  e j! e" ƒ Z# d d d d d d d d g Z$ d e% f d „  ƒ  YZ& d e% f d „  ƒ  YZ' d „  Z( d „  Z) d e f d „  ƒ  YZ* d S(    sµ   
    sphinx.ext.autodoc.directive
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
iÿÿÿÿ(   t   nodes(   t   ViewList(   t   assemble_option_dict(   t   Optionst   get_documenters(   t   logging(   t   SphinxDirectivet   switch_source_input(   t   nested_parse_with_titles(   t   Anyt   Dictt   Listt   Sett   Type(   t   Statet   StateMachinet
   StringList(   t   Reporter(   t   Config(   t   BuildEnvironment(   t
   Documentert   memberss   undoc-memberss   inherited-memberss   show-inheritances   private-memberss   special-memberss   ignore-module-alls   exclude-memberst   DummyOptionSpecc           B   s   e  Z d  Z d „  Z RS(   s"   An option_spec allows any options.c         C   s   d „  S(   Nc         S   s   |  S(   N(    (   t   x(    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyt   <lambda>*   s    (    (   t   selft   key(    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyt   __getitem__(   s    (   t   __name__t
   __module__t   __doc__R   (    (    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyR   %   s   t   DocumenterBridgec           B   s    e  Z d  Z d „  Z d „  Z RS(   s'   A parameters container for Documenters.c         C   s@   | |  _  | |  _ | |  _ | |  _ t ƒ  |  _ t ƒ  |  _ d  S(   N(   t   envt   reportert   genoptt   linenot   sett   filename_setR   t   result(   R   R    R!   t   optionsR#   (    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyt   __init__0   s    				c         C   s&   t  j | d |  j j |  j f ƒd  S(   Nt   location(   t   loggert   warningR    t   docnameR#   (   R   t   msg(    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyt   warn9   s    (   R   R   R   R(   R.   (    (    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyR   -   s   		c         C   sˆ   xi t  D]a } | |  j k r" q q | j d | t ƒ d k } | | j k r | r | j | | | <q q Wt t | j ƒ  |  j ƒ ƒ S(   s0   Recognize options of Documenter from user input.s   no-N(	   t   AUTODOC_DEFAULT_OPTIONSt   option_spect   popt   Truet   Nonet   autodoc_default_optionsR   R   t   items(   t
   documentert   configR'   t   namet   negated(    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyt   process_documenter_options>   s    c         C   s€   t  |  | ƒ k | j rD t j ƒ  } |  j | _ t |  | | ƒ n+ t j ƒ  } |  j | _ |  j | d | ƒ | j SWd QXd S(   s(   Parse a generated content by Documenter.i    N(	   R   t   titles_allowedR    t   sectiont   documentR   t	   paragrapht   nested_parset   children(   t   statet   contentR6   t   node(    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyt   parse_generated_contentL   s    	t   AutodocDirectivec           B   s8   e  Z d  Z e ƒ  Z e Z d Z d Z e Z	 d „  Z
 RS(   sÙ   A directive class for all autodoc directives. It works as a dispatcher of Documenters.

    It invokes a Documenter on running. After the processing, it parses and returns
    the generated content by Documenter.
    i   i    c         C   sœ  |  j  j j } y | j |  j ƒ \ } } Wn t k
 rJ d	 \ } } n Xt j d | | |  j	 ƒ |  j
 d } t |  j j ƒ | } y t | |  j |  j ƒ } WnC t t t f k
 rè } t j d |  j
 | f d | | f ƒg  SXt |  j | | | ƒ } | | |  j d ƒ }	 |	 j d |  j ƒ | j s7g  St j d d j | j ƒ ƒ x* | j D] }
 |  j  j j j j |
 ƒ q]Wt |  j  | j |	 ƒ } | S(
   Ns   [autodoc] %s:%s: input:
%si   s=   An option to %s is either unknown or has an invalid value: %sR)   i    t   more_contents   [autodoc] output:
%ss   
(   NN(    RA   R=   R!   t   get_source_and_lineR#   t   AttributeErrorR3   R*   t   debugt
   block_textR8   R   R    t   appR:   R7   R'   t   KeyErrort
   ValueErrort	   TypeErrort   errorR   t	   argumentst   generateRB   R&   t   joinR%   t   settingst   record_dependenciest   addRD   (   R   R!   t   sourceR#   t   objtypet   docclst   documenter_optionst   exct   paramsR6   t   fnR&   (    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyt   runi   s0    		(   R   R   R   R   R0   R2   t   has_contentt   required_argumentst   optional_argumentst   final_argument_whitespaceR]   (    (    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyRE   ]   s   	N(+   R   t   docutilsR    t   docutils.statemachineR   t   docutils.utilsR   t   sphinx.ext.autodocR   R   t   sphinx.utilR   t   sphinx.util.docutilsR   R   t   sphinx.util.nodesR   t   Falset   typingR	   R
   R   R   R   R   R   R   R   t   sphinx.configR   t   sphinx.environmentR   R   t	   getLoggerR   R*   R/   t   objectR   R   R:   RD   RE   (    (    (    s;   lib/python2.7/site-packages/sphinx/ext/autodoc/directive.pyt   <module>   s.   (				