
\c        .   @  s  d  Z  d d l m Z d d l Z d d l Z d d l Z d d l m Z d d l m	 Z	 d d l 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 Z d d l m Z m Z d d l m Z m Z d d l m Z d d l m Z m Z m Z d d l  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- d d l, m. Z. d d l, m/ Z/ d d l, m0 Z0 d d l1 m2 Z2 d d l3 m4 Z4 d d l5 m6 Z6 d d l7 m8 Z8 d d l9 m: Z: m; Z; m< Z< d d l= m> Z> e? rd d l@ mA ZA mB ZB mC ZC mD ZD mE ZE mF ZF mG ZG mH ZH mI ZI mJ ZJ d d l- mK ZK d d  lL mM ZM d d! lN mO ZO d d" lP mQ ZQ d d# lR mS ZS mT ZT d d$ lU mV ZV d d% lW mX ZX d d& lY mZ ZZ d d' l[ m\ Z\ d d( l] m^ Z^ m_ Z_ n  d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE dF dG dH dI dJ dK dL dM dN dO dP dQ dR dS dT dU dV f. Z` dW Za e/ jb ec  Zd dX ee f dY     YZf dZ ee f d[     YZg d S(\   s  
    sphinx.application
    ~~~~~~~~~~~~~~~~~~

    Sphinx application class and extensibility interface.

    Gracefully adapted from the TextPress system by Armin.

    :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
i(   t   print_functionN(   t   deque(   t   isclass(   t   path(   t	   Directivet
   directivest   roles(   t
   itervalues(   t   cPickle(   t	   cStringIO(   t   package_dirt   locale(   t   Configt   check_unicode(   t   CONFIG_FILENAME(   t   RemovedInSphinx20Warningt   RemovedInSphinx30Warningt   RemovedInSphinx40Warning(   t   BuildEnvironment(   t   ApplicationErrort   ConfigErrort   VersionRequirementError(   t   EventManager(   t   __(   t   SphinxComponentRegistry(   t   docutils(   t   import_object(   t   logging(   t   pycompat(   t
   BuildPhase(   t   bold(   t   directive_helper(   t   find_catalog_source_files(   t   abspatht	   ensuredirt   relpath(   t   Tags(
   t   Anyt   Callablet   Dictt   IOt   Iterablet   Iteratort   Listt   Tuplet   Typet   Union(   t   nodes(   t   Parser(   t	   Transform(   t   Builder(   t   Domaint   Index(   t   EnvironmentCollector(   t	   Extension(   t   XRefRole(   t   Theme(   t   RoleFunctiont   TitleGetters   sphinx.builders.applehelps   sphinx.builders.changess   sphinx.builders.epub3s   sphinx.builders.devhelps   sphinx.builders.dummys   sphinx.builders.gettexts   sphinx.builders.htmls   sphinx.builders.htmlhelps   sphinx.builders.latexs   sphinx.builders.linkchecks   sphinx.builders.manpages   sphinx.builders.qthelps   sphinx.builders.texinfos   sphinx.builders.texts   sphinx.builders.websupports   sphinx.builders.xmls   sphinx.configs   sphinx.domains.cs   sphinx.domains.changesets   sphinx.domains.cpps   sphinx.domains.javascripts   sphinx.domains.maths   sphinx.domains.pythons   sphinx.domains.rsts   sphinx.domains.stds   sphinx.directivess   sphinx.directives.codes   sphinx.directives.others   sphinx.directives.patchess   sphinx.extensions	   sphinx.ios   sphinx.parserss   sphinx.registrys   sphinx.roless!   sphinx.transforms.post_transformss&   sphinx.transforms.post_transforms.codes(   sphinx.transforms.post_transforms.imagess(   sphinx.transforms.post_transforms.compats   sphinx.util.compats*   sphinx.environment.collectors.dependenciess#   sphinx.environment.collectors.assets&   sphinx.environment.collectors.metadatas#   sphinx.environment.collectors.titles%   sphinx.environment.collectors.toctrees*   sphinx.environment.collectors.indexentriest	   alabasters   environment.picklet   Sphinxc        
   B  s  e  Z d  Z d: e j e j e e d: d d e d 	 Z d   Z	 d   Z
 d   Z d   Z d   Z e d: d  Z d: d: d: d	  Z d
 e d  Z d   Z d   Z d   Z d   Z d   Z d: d  Z d   Z d   Z d   Z d   Z e d  Z d; d  Z d   Z e d  Z e d  Z d: e d  Z  e! d    Z" d: d: e d  Z# e d  Z$ e d  Z% e d   Z& d!   Z' d: d: e d"  Z( e d#  Z) e d$  Z* d
 d: d: d
 g  e d%  Z+ d
 d: d: d
 g  d&  Z, d
 d: d
 e d'  Z- d(   Z. d)   Z/ d*   Z0 d+   Z1 d,   Z2 e d: d-  Z3 d: d.  Z4 d/   Z5 d0   Z6 d1   Z7 d2   Z8 e d3  Z9 d4   Z: d5   Z; d6   Z< d: d: d7  Z= d8   Z> d9   Z? RS(<   s  The main application class and extensibility interface.

    :ivar srcdir: Directory containing source.
    :ivar confdir: Directory containing ``conf.py``.
    :ivar doctreedir: Directory for storing pickled doctrees.
    :ivar outdir: Directory for storing build documents.
    i    c         C  sd  t  j |  _ | |  _ i  |  _ d g |  _ d  |  _ d  |  _ t	   |  _
 i  |  _ t |  |  _ t |  |  _ t |  |  _ | |  _ |  j r t |  j  |  _ t j t j |  j d   s t t d  |   q n  t j |  j  s
t t d  |  j   n  |  j |  j k r1t t d    n  | |  _ | d  k r^t   |  _ t |  _ n | |  _ t |  _ | d  k rt   |  _ n	 | |  _ d |  _ |
 o| |  _ |  j rt |  _  n	 |
 |  _  t! j" |  |  j |  j  t#   |  _$ t% d d  |  _& t' j( t) t d	  t* j+   d |  _, t- |  |  _. |  j d  k rct/ i  | pWi   |  _0 n1 t/ j1 |  j | pxi  |  j.  |  _0 t2 |  j0  |  j0 j3   |  j4   |  j0 j5 r|  j0 j5 t* j+ k rt6 t d
  |  j0 j5   n  |  j d  k r	|  j |  _ n  x t7 D] } |  j8 |  qWx! |  j0 j D] } |  j8 |  q4W|  j9 |  t j |  st' j( t d   t: |  n  |  j0 j" rd g |  _ t; |  j0 j"  r|  j0 j" |   qt< t d    n  |  j0 j=   |  j> d |  j0  |  j0 j? } | r7|  j
 j@ |  r7t' jA t d  |  n  |  jB |  |  _ |  jC |	  |  jD   d  S(   Nt   ?s   conf.pys4   config directory doesn't contain a conf.py file (%s)s!   Cannot find source directory (%s)s>   Source directory and destination directory cannot be identicali    t   maxleni
   s   Running Sphinx v%ssW   This project needs at least Sphinx v%s and therefore cannot be built with this version.s   making output directory...s   'setup' as currently defined in conf.py isn't a Python callable. Please modify its definition to make it a callable function. This is needed for conf.py to behave as a Sphinx extension.s   config-initeds%   primary_domain %r not found, ignored.(E   R   t   INITIALIZATIONt   phaset	   verbosityt
   extensionst   _setting_up_extensiont   Nonet   buildert   envR   t   registryt   html_themesR!   t   srcdirt   outdirt
   doctreedirt   confdirR   t   isfilet   joinR   R   t   isdirt   parallelR	   t   _statust   Truet   quiett   Falset   _warningt
   _warncountt
   keep_goingt   warningiserrorR   t   setupR   t   eventsR   t
   messagelogt   loggert   infoR   t   sphinxt   __display_version__t
   statuscodeR$   t   tagsR   t   configt   readR   t   pre_init_valuest
   _init_i18nt   needs_sphinxR   t   builtin_extensionst   setup_extensiont   preload_builderR"   t   callableR   t   init_valuest   emitt   primary_domaint
   has_domaint   warningt   create_buildert	   _init_envt   _init_builder(   t   selfRI   RL   RJ   RK   t   buildernamet   confoverridest   statusRo   t   freshenvRX   Ra   RA   RP   RW   t	   extensionRm   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   __init__   s    														 	$
!	c         C  sQ  |  j  j d
 k	 r t j t t d  |  j  j  d t g  |  j  j D] } t	 j
 |  j |  ^ qH } xE t | |  j  j d d g d |  j  j D] } | j |  j  j  q Wd
 t	 j
 t d  g | } n g  } t j | |  j  j  \ |  _ } |  j  j d
 k	 rM| s!|  j  j d k r7t j t d   qMt j t d	   n  d
 S(   sh   Load translated strings from the configured localedirs if enabled in
        the configuration.
        s   loading translations [%s]... t   nonlt   domainsR^   t   charsetR   t   ent   dones#   not available for built-in messagesN(   Rb   t   languageRD   R\   R]   R   R   RR   t   locale_dirsR   RN   RI   R    t   source_encodingt   write_moR
   R   t   initt
   translator(   Rs   t   xt   user_locale_dirst   catinfoR   t   has_translation(    (    s1   lib/python2.7/site-packages/sphinx/application.pyRe   	  s    ".!c         C  s  t  j |  j t  } | s. t j  j |  rf t   |  _ |  j j |   |  j j	 |  j
 |  j  n yp t j t t d   d t t | d  ) } t j |  |  _ |  j j |   Wd  QXt j t d   Wn9 t k
 r} t j t d  |  |  j d t  n Xd  S(   Ns   loading pickled environment... Rz   t   rbR~   s
   failed: %sRw   (   R   RN   RK   t   ENV_PICKLE_FILENAMEt   ost   existsR   RF   RY   t
   find_filesRb   RE   R\   R]   R   R   RR   t   opent   picklet   loadt	   ExceptionRq   (   Rs   Rw   t   filenamet   ft   err(    (    s1   lib/python2.7/site-packages/sphinx/application.pyRq   #  s    c         C  s   |  j  j |  |  d  S(   N(   RG   Ri   (   Rs   t   name(    (    s1   lib/python2.7/site-packages/sphinx/application.pyRi   5  s    c         C  s;   | d  k r( t j t d   d } n  |  j j |  |  S(   Ns(   No builder selected, using default: htmlt   html(   RD   R\   R]   R   RG   Rp   (   Rs   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyRp   9  s    	c         C  s1   |  j  j |  j  |  j  j   |  j d  d  S(   Ns   builder-inited(   RE   t   set_environmentRF   R   Rl   (   Rs   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyRr   A  s    c         C  s  t  j |  _ yf| r2 |  j j   |  j j   nC | r[ |  j j |  |  j j |  n |  j j   |  j j	   |  j
 r |  j r d |  _ n  |  j d k r t d  p t d  } |  j
 r t j t t d d |  j
  | |  j
 f   n t j t t d  |   |  j d k rq|  j j rqt j d  t j |  j j i t |  j  d	 6|  j j d
 6 n  WnZ t k
 r} t j |  j t  } t j |  rt j |  n  |  j d |    n X|  j d d   |  j j    d  S(   Ni   i    t	   succeededs   finished with problemss   build %s, %s warning.s   build %s, %s warnings.s	   build %s.t    RJ   t   projects   build-finished(!   R   t   READINGR@   RE   t   compile_all_catalogst	   build_allt   compile_specific_catalogst   build_specifict   compile_update_catalogst   build_updateRV   RW   R`   R   R\   R]   R   t   epilogR#   RJ   Rb   R   R   R   RN   RK   R   RM   R   t   unlinkRl   RD   t   cleanup(   Rs   t	   force_allt	   filenamesRv   R   t   envfile(    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   buildI  s@    	c         C  s9   t  j d t d d t j | d | d | d | d S(   s}  Emit a warning.

        If *location* is given, it should either be a tuple of (*docname*,
        *lineno*) or a string describing the location of the warning as well as
        possible.

        *type* and *subtype* are used to suppress warnings with
        :confval:`suppress_warnings`.

        .. deprecated:: 1.6
           Use :mod:`sphinx.util.logging` instead.
        sA   app.warning() is now deprecated. Use sphinx.util.logging instead.t
   stackleveli   t   typet   subtypet   locationN(   t   warningst   warnR   R\   Ro   (   Rs   t   messageR   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR   u  s    	R   c         C  s-   t  j d t d d t j | d | d S(   s   Emit an informational message.

        If *nonl* is true, don't emit a newline at the end (which implies that
        more info output will follow soon.)

        .. deprecated:: 1.6
           Use :mod:`sphinx.util.logging` instead.
        s>   app.info() is now deprecated. Use sphinx.util.logging instead.R   i   Rz   N(   R   R   R   R\   R]   (   Rs   R   Rz   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR]     s    
	c         O  s-   t  j d t d d t j | | |  d S(   s~   Emit a verbose informational message.

        .. deprecated:: 1.6
           Use :mod:`sphinx.util.logging` instead.
        sA   app.verbose() is now deprecated. Use sphinx.util.logging instead.R   i   N(   R   R   R   R\   t   verbose(   Rs   R   t   argst   kwargs(    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    	c         O  s-   t  j d t d d t j | | |  d S(   s   Emit a debug-level informational message.

        .. deprecated:: 1.6
           Use :mod:`sphinx.util.logging` instead.
        s?   app.debug() is now deprecated. Use sphinx.util.logging instead.R   i   N(   R   R   R   R\   t   debug(   Rs   R   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    	c         O  s-   t  j d t d d t j | | |  d S(   s   Emit a lowlevel debug-level informational message.

        .. deprecated:: 1.6
           Use :mod:`sphinx.util.logging` instead.
        s4   app.debug2() is now deprecated. Use debug() instead.R   i   N(   R   R   R   R\   R   (   Rs   R   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   debug2  s    	c         C  s'   t  j d |  |  j j |  |  d S(   s   Import and setup a Sphinx extension module.

        Load the extension given by the module *name*.  Use this if your
        extension needs the features provided by another extension.  No-op if
        called twice.
        s   [app] setting up extension: %rN(   R\   R   RG   t   load_extension(   Rs   t   extname(    (    s1   lib/python2.7/site-packages/sphinx/application.pyRh     s    c         C  s&   | t  j d  k r" t |   n  d S(   s
  Check the Sphinx version if requested.

        Compare *version* (which must be a ``major.minor`` version string, e.g.
        ``'1.1'``) with the version of the running Sphinx, and abort the build
        when it is too old.

        .. versionadded:: 1.0
        i   N(   R^   R_   R   (   Rs   t   version(    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   require_sphinx  s    
c         C  s&   t  j d t d d t | d d S(   s   Import an object from a ``module.name`` string.

        .. deprecated:: 1.8
           Use ``sphinx.util.import_object()`` instead.
        sM   app.import_object() is deprecated. Use sphinx.util.add_object_type() instead.R   i   t   sourceN(   R   R   R   R   RD   (   Rs   t   objnameR   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    	c         C  s/   |  j  j | |  } t j d | | |  | S(   s&  Register *callback* to be called when *event* is emitted.

        For details on available core events and the arguments of callback
        functions, please see :ref:`events`.

        The method returns a "listener ID" that can be used as an argument to
        :meth:`disconnect`.
        s%   [app] connecting event %r: %r [id=%s](   RZ   t   connectR\   R   (   Rs   t   eventt   callbackt   listener_id(    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    
c         C  s$   t  j d |  |  j j |  d S(   s%   Unregister callback by *listener_id*.s"   [app] disconnecting event: [id=%s]N(   R\   R   RZ   t
   disconnect(   Rs   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    c         G  sK   y! t  j d | t |  d   Wn t k
 r4 n X|  j j | |  |  S(   s   Emit *event* and pass *arguments* to the callback functions.

        Return the return values of all callbacks as a list.  Do not emit core
        Sphinx events in extensions!
        s   [app] emitting event: %r%sid   (   R\   R   t   reprR   RZ   Rl   (   Rs   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyRl     s
    !c         G  s   |  j  j | |  |  S(   s   Emit *event* and pass *arguments* to the callback functions.

        Return the result of the first callback that doesn't return ``None``.

        .. versionadded:: 0.5
        (   RZ   t   emit_firstresult(   Rs   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR      s    c         C  s   |  j  j | d | d S(   s   Register a new builder.

        *builder* must be a class that inherits from
        :class:`~sphinx.builders.Builder`.

        .. versionchanged:: 1.8
           Add *override* keyword.
        t   overrideN(   RG   t   add_builder(   Rs   RE   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    
c         C  sp   t  j d | | | f | r$ | f n d  | t t f k rS | rJ d pM d } n  |  j j | | | |  d S(   s  Register a configuration value.

        This is necessary for Sphinx to recognize new values and set default
        values accordingly.  The *name* should be prefixed with the extension
        name, to avoid clashes.  The *default* value can be any Python object.
        The string value *rebuild* must be one of those values:

        * ``'env'`` if a change in the setting only takes effect when a
          document is parsed -- this means that the whole environment must be
          rebuilt.
        * ``'html'`` if a change in the setting needs a full rebuild of HTML
          documents.
        * ``''`` if a change in the setting will not need any special rebuild.

        .. versionchanged:: 0.6
           Changed *rebuild* from a simple boolean (equivalent to ``''`` or
           ``'env'``) to a string.  However, booleans are still accepted and
           converted internally.

        .. versionchanged:: 0.4
           If the *default* value is a callable, it will be called with the
           config object as its argument in order to get the default value.
           This can be used to implement config values whose default depends on
           other values.
        s   [app] adding config value: %rRF   R   N(    (   R\   R   RT   RR   Rb   t   add(   Rs   R   t   defaultt   rebuildt   types(    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   add_config_value  s
    	#c         C  s$   t  j d |  |  j j |  d S(   sX   Register an event called *name*.

        This is needed to be able to emit it.
        s   [app] adding event: %rN(   R\   R   RZ   R   (   Rs   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt	   add_event:  s    c         C  s   |  j  j | | d | d S(   s  Register or override a Docutils translator class.

        This is used to register a custom output translator or to replace a
        builtin translator.  This allows extensions to use custom translator
        and define custom nodes for the translator (see :meth:`add_node`).

        .. versionadded:: 1.3
        .. versionchanged:: 1.8
           Add *override* keyword.
        R   N(   RG   t   add_translator(   Rs   R   t   translator_classR   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   set_translatorC  s    c         K  s   t  j d | | f  | r^ t j |  r^ t  j t d  |  j d | j d d d d n  t j |  |  j	 j
 | |  d S(	   s  Register a Docutils node class.

        This is necessary for Docutils internals.  It may also be used in the
        future to validate nodes in the parsed documents.

        Node visitor functions for the Sphinx HTML, LaTeX, text and manpage
        writers can be given as keyword arguments: the keyword should be one or
        more of ``'html'``, ``'latex'``, ``'text'``, ``'man'``, ``'texinfo'``
        or any other supported translators, the value a 2-tuple of ``(visit,
        depart)`` methods.  ``depart`` can be ``None`` if the ``visit``
        function raises :exc:`docutils.nodes.SkipNode`.  Example:

        .. code-block:: python

           class math(docutils.nodes.Element): pass

           def visit_math_html(self, node):
               self.body.append(self.starttag(node, 'math'))
           def depart_math_html(self, node):
               self.body.append('</math>')

           app.add_node(math, html=(visit_math_html, depart_math_html))

        Obviously, translators for which you don't specify visitor methods will
        choke on the node when encountered in a document to translate.

        .. versionchanged:: 0.5
           Added the support for keyword arguments giving visit functions.
        s   [app] adding node: %rsc   while setting up extension %s: node class %r is already registered, its visitors will be overriddeniR   t   appR   t   add_nodeN(   R\   R   R   t   is_node_registeredRo   R   RC   t   __name__t   register_nodeRG   t   add_translation_handlers(   Rs   t   nodeR   t   kwds(    (    s1   lib/python2.7/site-packages/sphinx/application.pyR   Q  s    c         K  s6   |  j  j | | | d | |  j | d | | d S(   s  Register a Docutils node class as a numfig target.

        Sphinx numbers the node automatically. And then the users can refer it
        using :rst:role:`numref`.

        *figtype* is a type of enumerable nodes.  Each figtypes have individual
        numbering sequences.  As a system figtypes, ``figure``, ``table`` and
        ``code-block`` are defined.  It is able to add custom nodes to these
        default figtypes.  It is also able to define new custom figtype if new
        figtype is given.

        *title_getter* is a getter function to obtain the title of node.  It
        takes an instance of the enumerable node, and it must return its title
        as string.  The title is used to the default title of references for
        :rst:role:`ref`.  By default, Sphinx searches
        ``docutils.nodes.caption`` or ``docutils.nodes.title`` from the node as
        a title.

        Other keyword arguments are used for node visitor functions. See the
        :meth:`.Sphinx.add_node` for details.

        .. versionadded:: 1.4
        R   N(   RG   t   add_enumerable_nodeR   (   Rs   R   t   figtypet   title_getterR   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR   y  s    c         C  s    t  j d t d d |  j j S(   NsY   app.enumerable_nodes() is deprecated. Use app.get_domain("std").enumerable_nodes instead.R   i   (   R   R   R   RG   t   enumerable_nodes(   Rs   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    	c         K  s   t  j d | | | | | f  | t j k rd | rd t  j t d  |  j d | d d d d n  t |  s t | t	  r t
 | | | |  } t j | |  n t j | |  d S(	   s  Register a Docutils directive.

        *name* must be the prospective directive name.  There are two possible
        ways to write a directive:

        - In the docutils 0.4 style, *obj* is the directive function.
          *content*, *arguments* and *options* are set as attributes on the
          function and determine whether the directive has content, arguments
          and options, respectively.  **This style is deprecated.**

        - In the docutils 0.5 style, *obj* is the directive class.
          It must already have attributes named *has_content*,
          *required_arguments*, *optional_arguments*,
          *final_argument_whitespace* and *option_spec* that correspond to the
          options for the function way.  See `the Docutils docs
          <http://docutils.sourceforge.net/docs/howto/rst-directives.html>`_
          for details.

        The directive class must inherit from the class
        ``docutils.parsers.rst.Directive``.

        For example, the (already existing) :rst:dir:`literalinclude` directive
        would be added like this:

        .. code-block:: python

           from docutils.parsers.rst import Directive, directives

           class LiteralIncludeDirective(Directive):
               has_content = True
               required_arguments = 1
               optional_arguments = 0
               final_argument_whitespace = True
               option_spec = {
                   'class': directives.class_option,
                   'name': directives.unchanged,
               }

               def run(self):
                   ...

           add_directive('literalinclude', LiteralIncludeDirective)

        .. versionchanged:: 0.6
           Docutils 0.5-style directive classes are now supported.
        .. deprecated:: 1.8
           Docutils 0.4-style (function based) directives support is deprecated.
        .. versionchanged:: 1.8
           Add *override* keyword.
        s   [app] adding directive: %rsX   while setting up extension %s: directive %r is already registered, it will be overriddeniR   R   R   t   add_directiveN(   R\   R   R   t   _directivesRo   R   RC   R   t
   issubclassR   R   t   register_directive(   Rs   R   t   objt   contentt	   argumentsR   t   optionst	   directive(    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    4	c         C  so   t  j d | | f  | t j k r[ | r[ t  j t d  |  j d | d d d d n  t j | |  d S(	   sR  Register a Docutils role.

        *name* must be the role name that occurs in the source, *role* the role
        function. Refer to the `Docutils documentation
        <http://docutils.sourceforge.net/docs/howto/rst-roles.html>`_ for
        more information.

        .. versionchanged:: 1.8
           Add *override* keyword.
        s   [app] adding role: %rsS   while setting up extension %s: role %r is already registered, it will be overriddeniR   R   R   t   add_roleN(   R\   R   R   t   _rolesRo   R   RC   t   register_local_role(   Rs   R   t   roleR   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    c         C  s   t  j d | | f  | t j k r[ | r[ t  j t d  |  j d | d d d d n  t j | |  } t j | |  d S(	   s   Register a generic Docutils role.

        Register a Docutils role that does nothing but wrap its contents in the
        node given by *nodeclass*.

        .. versionadded:: 0.6
        .. versionchanged:: 1.8
           Add *override* keyword.
        s   [app] adding generic role: %rsS   while setting up extension %s: role %r is already registered, it will be overriddeniR   R   R   t   add_generic_roleN(	   R\   R   R   R   Ro   R   RC   t   GenericRoleR   (   Rs   R   t	   nodeclassR   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    c         C  s   |  j  j | d | d S(   s  Register a domain.

        Make the given *domain* (which must be a class; more precisely, a
        subclass of :class:`~sphinx.domains.Domain`) known to Sphinx.

        .. versionadded:: 1.0
        .. versionchanged:: 1.8
           Add *override* keyword.
        R   N(   RG   t
   add_domain(   Rs   t   domainR   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR   	  s    c         C  s0   t  j d t d d |  j j | d t d S(   sJ  Override a registered domain.

        Make the given *domain* class known to Sphinx, assuming that there is
        already a domain with its ``.name``.  The new domain must be a subclass
        of the existing one.

        .. versionadded:: 1.0
        .. deprecated:: 1.8
           Integrated to :meth:`add_domain`.
        sW   app.override_domain() is deprecated. Use app.add_domain() with override option instead.R   i   R   N(   R   R   R   RG   R   RR   (   Rs   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   override_domain  s    	c      	   K  s)   |  j  j | | | | | d | | d S(   s   Register a Docutils directive in a domain.

        Like :meth:`add_directive`, but the directive is added to the domain
        named *domain*.

        .. versionadded:: 1.0
        .. versionchanged:: 1.8
           Add *override* keyword.
        R   N(   RG   t   add_directive_to_domain(   Rs   R   R   R   t   has_contentt   argument_specR   t   option_spec(    (    s1   lib/python2.7/site-packages/sphinx/application.pyR   '  s    c         C  s    |  j  j | | | d | d S(   s   Register a Docutils role in a domain.

        Like :meth:`add_role`, but the role is added to the domain named
        *domain*.

        .. versionadded:: 1.0
        .. versionchanged:: 1.8
           Add *override* keyword.
        R   N(   RG   t   add_role_to_domain(   Rs   R   R   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR   7  s    c         C  s   |  j  j | |  d S(   s  Register a custom index for a domain.

        Add a custom *index* class to the domain named *domain*.  *index* must
        be a subclass of :class:`~sphinx.domains.Index`.

        .. versionadded:: 1.0
        .. versionchanged:: 1.8
           Add *override* keyword.
        N(   RG   t   add_index_to_domain(   Rs   R   t   indexR   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR   D  s    c	   	   
   C  s,   |  j  j | | | | | | | d | d S(   s*
  Register a new object type.

        This method is a very convenient way to add a new :term:`object` type
        that can be cross-referenced.  It will do this:

        - Create a new directive (called *directivename*) for documenting an
          object.  It will automatically add index entries if *indextemplate*
          is nonempty; if given, it must contain exactly one instance of
          ``%s``.  See the example below for how the template will be
          interpreted.
        - Create a new role (called *rolename*) to cross-reference to these
          object descriptions.
        - If you provide *parse_node*, it must be a function that takes a
          string and a docutils node, and it must populate the node with
          children parsed from the string.  It must then return the name of the
          item to be used in cross-referencing and index entries.  See the
          :file:`conf.py` file in the source for this documentation for an
          example.
        - The *objname* (if not given, will default to *directivename*) names
          the type of object.  It is used when listing objects, e.g. in search
          results.

        For example, if you have this call in a custom Sphinx extension::

           app.add_object_type('directive', 'dir', 'pair: %s; directive')

        you can use this markup in your documents::

           .. rst:directive:: function

              Document a function.

           <...>

           See also the :rst:dir:`function` directive.

        For the directive, an index entry will be generated as if you had prepended ::

           .. index:: pair: function; directive

        The reference node will be of class ``literal`` (so it will be rendered
        in a proportional font, as appropriate for code) unless you give the
        *ref_nodeclass* argument, which must be a docutils node class.  Most
        useful are ``docutils.nodes.emphasis`` or ``docutils.nodes.strong`` --
        you can also use ``docutils.nodes.generated`` if you want no further
        text decoration.  If the text should be treated as literal (e.g. no
        smart quote replacement), but not have typewriter styling, use
        ``sphinx.addnodes.literal_emphasis`` or
        ``sphinx.addnodes.literal_strong``.

        For the role content, you have the same syntactical possibilities as
        for standard Sphinx roles (see :ref:`xref-syntax`).

        This method is also available under the deprecated alias
        :meth:`add_description_unit`.

        .. versionchanged:: 1.8
           Add *override* keyword.
        R   N(   RG   t   add_object_type(	   Rs   t   directivenamet   rolenamet   indextemplatet
   parse_nodet   ref_nodeclassR   t   doc_field_typesR   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR   Q  s    ?c         C  s9   t  j d t d d |  j | | | | | | |  d S(   s   Deprecated alias for :meth:`add_object_type`.

        .. deprecated:: 1.6
           Use :meth:`add_object_type` instead.
        sP   app.add_description_unit() is now deprecated. Use app.add_object_type() instead.R   i   N(   R   R   R   R   (   Rs   R   R   R   R   R   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   add_description_unit  s    		c         C  s&   |  j  j | | | | | d | d S(   s  Register a new crossref object type.

        This method is very similar to :meth:`add_object_type` except that the
        directive it generates must be empty, and will produce no output.

        That means that you can add semantic targets to your sources, and refer
        to them using custom roles instead of generic ones (like
        :rst:role:`ref`).  Example call::

           app.add_crossref_type('topic', 'topic', 'single: %s',
                                 docutils.nodes.emphasis)

        Example usage::

           .. topic:: application API

           The application API
           -------------------

           Some random text here.

           See also :topic:`this section <application API>`.

        (Of course, the element following the ``topic`` directive needn't be a
        section.)

        .. versionchanged:: 1.8
           Add *override* keyword.
        R   N(   RG   t   add_crossref_type(   Rs   R   R   R   R   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s     c         C  s   |  j  j |  d S(   s  Register a Docutils transform to be applied after parsing.

        Add the standard docutils :class:`Transform` subclass *transform* to
        the list of transforms that are applied after Sphinx parses a reST
        document.

        .. list-table:: priority range categories for Sphinx transforms
           :widths: 20,80

           * - Priority
             - Main purpose in Sphinx
           * - 0-99
             - Fix invalid nodes by docutils. Translate a doctree.
           * - 100-299
             - Preparation
           * - 300-399
             - early
           * - 400-699
             - main
           * - 700-799
             - Post processing. Deadline to modify text and referencing.
           * - 800-899
             - Collect referencing and referenced nodes. Domain processing.
           * - 900-999
             - Finalize and clean up.

        refs: `Transform Priority Range Categories`__

        __ http://docutils.sourceforge.net/docs/ref/transforms.html#transform-priority-range-categories
        N(   RG   t   add_transform(   Rs   t	   transform(    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s     c         C  s   |  j  j |  d S(   s   Register a Docutils transform to be applied before writing.

        Add the standard docutils :class:`Transform` subclass *transform* to
        the list of transforms that are applied before Sphinx writes a
        document.
        N(   RG   t   add_post_transform(   Rs   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    c         K  s*   t  j d t d d |  j | |  d S(   s    An alias of :meth:`add_js_file`.sM   The app.add_javascript() is deprecated. Please use app.add_js_file() instead.R   i   N(   R   R   R   t   add_js_file(   Rs   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   add_javascript  s    	c         K  s?   |  j  j | |  t |  j d  r; |  j j | |  n  d S(   s  Register a JavaScript file to include in the HTML output.

        Add *filename* to the list of JavaScript files that the default HTML
        template will include.  The filename must be relative to the HTML
        static path , or a full URI with scheme.  The keyword arguments are
        also accepted for attributes of ``<script>`` tag.

        Example::

            app.add_js_file('example.js')
            # => <script src="_static/example.js"></script>

            app.add_js_file('example.js', async="async")
            # => <script src="_static/example.js" async="async"></script>

        .. versionadded:: 0.5

        .. versionchanged:: 1.8
           Renamed from ``app.add_javascript()``.
           And it allows keyword arguments as attributes of script tag.
        R   N(   RG   R   t   hasattrRE   (   Rs   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    c         K  sO   t  j d |  |  j j | |  t |  j d  rK |  j j | |  n  d S(   s  Register a stylesheet to include in the HTML output.

        Add *filename* to the list of CSS files that the default HTML template
        will include.  The filename must be relative to the HTML static path,
        or a full URI with scheme.  The keyword arguments are also accepted for
        attributes of ``<link>`` tag.

        Example::

            app.add_css_file('custom.css')
            # => <link rel="stylesheet" href="_static/custom.css" type="text/css" />

            app.add_css_file('print.css', media='print')
            # => <link rel="stylesheet" href="_static/print.css"
            #          type="text/css" media="print" />

            app.add_css_file('fancy.css', rel='alternate stylesheet', title='fancy')
            # => <link rel="alternate stylesheet" href="_static/fancy.css"
            #          type="text/css" title="fancy" />

        .. versionadded:: 1.0

        .. versionchanged:: 1.6
           Optional ``alternate`` and/or ``title`` attributes can be supplied
           with the *alternate* (of boolean type) and *title* (a string)
           arguments. The default is no title and *alternate* = ``False``. For
           more information, refer to the `documentation
           <https://mdn.io/Web/CSS/Alternative_style_sheets>`__.

        .. versionchanged:: 1.8
           Renamed from ``app.add_stylesheet()``.
           And it allows keyword arguments as attributes of link tag.
        s   [app] adding stylesheet: %rt   add_css_fileN(   R\   R   RG   t   add_css_filesR  RE   R  (   Rs   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR    s    #c         C  s`   t  j d t d d i  } | r/ d | d <n
 d | d <| rL | | d <n  |  j | |  d S(	   s!   An alias of :meth:`add_css_file`.sN   The app.add_stylesheet() is deprecated. Please use app.add_css_file() instead.R   i   s   alternate stylesheett   relt
   stylesheett   titleN(   R   R   R   R  (   Rs   R   t	   alternateR  t
   attributes(    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   add_stylesheet>  s    	
c         C  s   |  j  j | |  d S(   s  Register a package to include in the LaTeX source code.

        Add *packagename* to the list of packages that LaTeX source code will
        include.  If you provide *options*, it will be taken to `\usepackage`
        declaration.

        .. code-block:: python

           app.add_latex_package('mypackage')
           # => \usepackage{mypackage}
           app.add_latex_package('mypackage', 'foo,bar')
           # => \usepackage[foo,bar]{mypackage}

        .. versionadded:: 1.3
        N(   RG   t   add_latex_package(   Rs   t   packagenameR   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR
  P  s    c         C  sD   t  j d | | f  d d l m } | d k r6 d S| | | <d S(   s   Register a new lexer for source code.

        Use *lexer*, which must be an instance of a Pygments lexer class, to
        highlight code blocks with the given language *alias*.

        .. versionadded:: 0.6
        s   [app] adding lexer: %ri(   t   lexersN(   R\   R   t   sphinx.highlightingR  RD   (   Rs   t   aliast   lexerR  (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt	   add_lexerc  s
    	c         C  sQ   t  j d |  d d l m } |  j j | j |  |  j d | j |  d S(   s  Register a new documenter class for the autodoc extension.

        Add *cls* as a new documenter class for the :mod:`sphinx.ext.autodoc`
        extension.  It must be a subclass of
        :class:`sphinx.ext.autodoc.Documenter`.  This allows to auto-document
        new types of objects.  See the source of the autodoc module for
        examples on how to subclass :class:`Documenter`.

        .. todo:: Add real docs for Documenter and subclassing

        .. versionadded:: 0.6
        s   [app] adding autodocumenter: %ri(   t   AutodocDirectivet   autoN(   R\   R   t   sphinx.ext.autodoc.directiveR  RG   t   add_documentert   objtypeR   (   Rs   t   clsR  (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   add_autodocumenterr  s    c         C  s-   t  j d | | f  |  j j | |  d S(   s  Register a new ``getattr``-like function for the autodoc extension.

        Add *getter*, which must be a function with an interface compatible to
        the :func:`getattr` builtin, as the autodoc attribute getter for
        objects that are instances of *typ*.  All cases where autodoc needs to
        get an attribute of a type are then handled by this function instead of
        :func:`getattr`.

        .. versionadded:: 0.6
        s#   [app] adding autodoc attrgetter: %rN(   R\   R   RG   t   add_autodoc_attrgetter(   Rs   t   typt   getter(    (    s1   lib/python2.7/site-packages/sphinx/application.pyR    s    c         C  sL   t  j d |  d d l m } m } t | |  s; t  | | | j <d S(   s  Register a new language for the HTML search index.

        Add *cls*, which must be a subclass of
        :class:`sphinx.search.SearchLanguage`, as a support language for
        building the HTML full-text search index.  The class must have a *lang*
        attribute that indicates the language it should be used for.  See
        :confval:`html_search_language`.

        .. versionadded:: 1.1
        s    [app] adding search language: %ri(   t	   languagest   SearchLanguageN(   R\   R   t   sphinx.searchR  R  R   t   AssertionErrort   lang(   Rs   R  R  R  (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   add_search_language  s    c         C  s   |  j  j | | d | d S(   s   Register a suffix of source files.

        Same as :confval:`source_suffix`.  The users can override this
        using the setting.

        .. versionadded:: 1.8
        R   N(   RG   t   add_source_suffix(   Rs   t   suffixt   filetypeR   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR!    s    	c         O  s   |  j  j | |   d S(   s<  Register a parser class.

        .. versionadded:: 1.4
        .. versionchanged:: 1.8
           *suffix* argument is deprecated.  It only accepts *parser* argument.
           Use :meth:`add_source_suffix` API to register suffix instead.
        .. versionchanged:: 1.8
           Add *override* keyword.
        N(   RG   t   add_source_parser(   Rs   R   R   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR$    s    c         C  s$   t  j d |  |   j |   d S(   sx   Register an environment collector class.

        Refer to :ref:`collector-api`.

        .. versionadded:: 1.6
        s&   [app] adding environment collector: %rN(   R\   R   t   enable(   Rs   t	   collector(    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   add_env_collector  s    c         C  s$   t  j d | |  | |  j | <d S(   s   Register a HTML Theme.

        The *name* is a name of theme, and *path* is a full path to the theme
        (refs: :ref:`distribute-your-theme`).

        .. versionadded:: 1.6
        s   [app] adding HTML theme: %r, %rN(   R\   R   RH   (   Rs   R   t
   theme_path(    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   add_html_theme  s    	c         C  s   |  j  j | | |  d S(   s  Register a math renderer for HTML.

        The *name* is a name of math renderer.  Both *inline_renderers* and
        *block_renderers* are used as visitor functions for the HTML writer:
        the former for inline math node (``nodes.math``), the latter for
        block math node (``nodes.math_block``).  Regarding visitor functions,
        see :meth:`add_node` for details.

        .. versionadded:: 1.8

        N(   RG   t   add_html_math_renderer(   Rs   R   t   inline_rendererst   block_renderers(    (    s1   lib/python2.7/site-packages/sphinx/application.pyR*    s    c         C  s0   t  j | g |  j j |  t  j | |  d S(   s   Register a message catalog.

        The *catalog* is a name of catalog, and *locale_dir* is a base path
        of message catalog.  For more details, see
        :func:`sphinx.locale.get_translation()`.

        .. versionadded:: 1.8
        N(   R   R   Rb   R   t   init_console(   Rs   t   catalogt
   locale_dir(    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   add_message_catalog  s    
c         C  s   | d k r! d } t  d  } n1 | d k rB d } t  d  } n t d |   xl t |  j  D][ } t | | d	  } | d	 k r t j | | j  t j t  d  |  t	 S| sb t	 Sqb Wt
 S(
   sz   Check parallel processing is allowed or not.

        ``typ`` is a type of processing; ``'read'`` or ``'write'``.
        Rc   t   parallel_read_safes   the %s extension does not declare if it is safe for parallel reading, assuming it isn't - please ask the extension author to check and make it explicitt   writet   parallel_write_safes   the %s extension does not declare if it is safe for parallel writing, assuming it isn't - please ask the extension author to check and make it explicits!   parallel type %s is not supporteds   doing serial %sN(   R   t
   ValueErrorR   RB   t   getattrRD   R\   Ro   R   RT   RR   (   Rs   R  t   attrnameR   t   extt   allowed(    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   is_parallel_allowed  s     N(    (@   R   t
   __module__t   __doc__RD   t   syst   stdoutt   stderrRT   Ry   Re   Rq   Ri   Rp   Rr   R   R   R]   R   R   R   Rh   R   R   R   R   Rl   R   R   R   R   R   R   R   t   propertyR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R	  R
  R  R  R  R   R!  R$  R'  R)  R*  R0  R9  (    (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR<   y   s   					,									!		(B		A	#	"	
			(								t   TemplateBridgec           B  s8   e  Z d  Z d d d  Z d   Z d   Z d   Z RS(   s   
    This class defines the interface for a "template bridge", that is, a class
    that renders templates given a template name and a context.
    c         C  s   t  d   d S(   sb  Called by the builder to initialize the template system.

        *builder* is the builder object; you'll probably want to look at the
        value of ``builder.config.templates_path``.

        *theme* is a :class:`sphinx.theming.Theme` object or None; in the latter
        case, *dirs* can be list of fixed directories to look for templates.
        s!   must be implemented in subclassesN(   t   NotImplementedError(   Rs   RE   t   themet   dirs(    (    s1   lib/python2.7/site-packages/sphinx/application.pyR     s    
c         C  s   d S(   s   Called by the builder to determine if output files are outdated
        because of template changes.  Return the mtime of the newest template
        file that was changed.  The default implementation returns ``0``.
        i    (    (   Rs   (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   newest_template_mtime$  s    c         C  s   t  d   d S(   s   Called by the builder to render a template given as a filename with
        a specified context (a Python dictionary).
        s!   must be implemented in subclassesN(   RA  (   Rs   t   templatet   context(    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   render,  s    c         C  s   t  d   d S(   s}   Called by the builder to render a template given as a string with a
        specified context (a Python dictionary).
        s!   must be implemented in subclassesN(   RA  (   Rs   RE  RF  (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   render_string3  s    N(   R   R:  R;  RD   R   RD  RG  RH  (    (    (    s1   lib/python2.7/site-packages/sphinx/application.pyR@    s
   		(h   R;  t
   __future__R    R   R<  R   t   collectionsR   t   inspectR   R   t   docutils.parsers.rstR   R   R   t   sixR   t	   six.movesR   R   R	   R^   R
   R   t   sphinx.configR   R   R   t   sphinx.deprecationR   R   R   t   sphinx.environmentR   t   sphinx.errorsR   R   R   t   sphinx.eventsR   t   sphinx.localeR   t   sphinx.registryR   t   sphinx.utilR   R   R   R   t   sphinx.util.build_phaseR   t   sphinx.util.consoleR   t   sphinx.util.docutilsR   t   sphinx.util.i18nR    t   sphinx.util.osutilR!   R"   R#   t   sphinx.util.tagsR$   RT   t   typingR%   R&   R'   R(   R)   R*   R+   R,   R-   R.   R/   t   docutils.parsersR0   t   docutils.transformsR1   t   sphinx.buildersR2   t   sphinx.domainsR3   R4   t   sphinx.environment.collectorsR5   t   sphinx.extensionR6   t   sphinx.rolesR7   t   sphinx.themingR8   t   sphinx.util.typingR9   R:   Rg   R   t	   getLoggerR   R\   t   objectR<   R@  (    (    (    s1   lib/python2.7/site-packages/sphinx/application.pyt   <module>   s   F	    