ó
P'—^c           @@  sÃ   d  Z  d d l m Z y d d l m Z m Z Wn' e k
 rY d d l m Z m Z n Xd d l m	 Z	 d d l
 m Z d d l m Z d e f d	 „  ƒ  YZ d
 e	 f d „  ƒ  YZ d „  Z d S(   sä  
celery.contrib.sphinx
=====================

Sphinx documentation plugin

**Usage**

Add the extension to your :file:`docs/conf.py` configuration module:

.. code-block:: python

    extensions = (...,
                  'celery.contrib.sphinx')

If you would like to change the prefix for tasks in reference documentation
then you can change the ``celery_task_prefix`` configuration value:

.. code-block:: python

    celery_task_prefix = '(task)'  # < default


With the extension installed `autodoc` will automatically find
task decorated objects and generate the correct (as well as
add a ``(task)`` prefix), and you can also refer to the tasks
using `:task:proj.tasks.add` syntax.

Use ``.. autotask::`` to manually document a task.

i    (   t   absolute_import(   t   formatargspect   getfullargspec(   R   t
   getargspec(   t   PyModulelevel(   t   FunctionDocumenter(   t   BaseTaskt   TaskDocumenterc           B@  s8   e  Z d  Z d Z e d „  ƒ Z d „  Z e d „ Z RS(   t   taski   c         C@  s   t  | t ƒ o t | d ƒ S(   Nt   __wrapped__(   t
   isinstanceR   t   getattr(   t   clst   membert
   membernamet   isattrt   parent(    (    s7   /tmp/pip-unpacked-wheel-gV1wwp/celery/contrib/sphinx.pyt   can_document_member2   s    c         C@  sP   t  |  j d ƒ } | d  k	 rL t | ƒ } t | Œ  } | j d d ƒ } | Sd S(   NR	   s   \s   \\t    (   R   t   objectt   NoneR   R   t   replace(   t   selft   wrappedt   argspect   fmt(    (    s7   /tmp/pip-unpacked-wheel-gV1wwp/celery/contrib/sphinx.pyt   format_args6   s    c         C@  s   d  S(   N(    (   R   t   all_members(    (    s7   /tmp/pip-unpacked-wheel-gV1wwp/celery/contrib/sphinx.pyt   document_members?   s    (	   t   __name__t
   __module__t   objtypet   member_ordert   classmethodR   R   t   FalseR   (    (    (    s7   /tmp/pip-unpacked-wheel-gV1wwp/celery/contrib/sphinx.pyR   .   s
   		t   TaskDirectivec           B@  s   e  Z d  „  Z RS(   c         C@  s   |  j  j j S(   N(   t   envt   configt   celery_task_prefix(   R   t   sig(    (    s7   /tmp/pip-unpacked-wheel-gV1wwp/celery/contrib/sphinx.pyt   get_signature_prefixE   s    (   R   R   R(   (    (    (    s7   /tmp/pip-unpacked-wheel-gV1wwp/celery/contrib/sphinx.pyR#   C   s   c         C@  s8   |  j  t ƒ t |  j d j d <|  j d d t ƒ d  S(   Nt   pyR   R&   s   (task)(   t   add_autodocumenterR   R#   t   domainst
   directivest   add_config_valuet   True(   t   app(    (    s7   /tmp/pip-unpacked-wheel-gV1wwp/celery/contrib/sphinx.pyt   setupI   s    N(   t   __doc__t
   __future__R    t   inspectR   R   R   t   ImportErrort   sphinx.domains.pythonR   t   sphinx.ext.autodocR   t   celery.app.taskR   R   R#   R0   (    (    (    s7   /tmp/pip-unpacked-wheel-gV1wwp/celery/contrib/sphinx.pyt   <module>    s   