
    `f?                         d 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
  G d de          Z G d	 d
e          Zd Zd ZdS )a]  Sphinx documentation plugin used to document tasks.

Introduction
============

Usage
-----

The Celery extension for Sphinx requires Sphinx 2.0 or later.

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

.. code-block:: python

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

If you'd 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 (e.g. when using the automodule directive)
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 alternatively manually document a task.
    )	signature)nodes)
PyFunction)FunctionDocumenter)BaseTaskc                   N     e Zd ZdZdZdZed             Zd Zd	dZ	 fdZ
 xZS )
TaskDocumenterzDocument task definitions.task   c                 L    t          |t                    ot          |d          S )N__wrapped__
isinstancer   getattr)clsmember
membernameisattrparents        G/var/www/html/env/lib/python3.11/site-packages/celery/contrib/sphinx.pycan_document_memberz"TaskDocumenter.can_document_member0   s!    &(++N0N0NN    c                    t          | j        dd           }|rt          |          }d|j        v s	d|j        v rB|                    t          |j                                                  dd                    }t          |          S dS )Nr   selfr      )
parameters )r   objectr   r   replacelistvaluesstr)r   wrappedsigs      r   format_argszTaskDocumenter.format_args4   s    $+}d;;G$$C''5CN+B+BkkT#.2G2G2I2I-J-J122-NkOOs88Orr   Fc                     d S N )r   all_memberss     r   document_memberszTaskDocumenter.document_members=   s    r   c                     t          | j        dd           }|rt          |d          | j        k    rdS t                                                      S )Nr   
__module__T)r   r   modnamesupercheck_module)r   r#   	__class__s     r   r/   zTaskDocumenter.check_module@   sQ    
 $+}d;; 	ww55EE4ww##%%%r   )F)__name__r,   __qualname____doc__objtypemember_orderclassmethodr   r%   r*   r/   __classcell__)r0   s   @r   r	   r	   *   s        $$GLO O [O     & & & & & & & & &r   r	   c                       e Zd ZdZd ZdS )TaskDirectivezSphinx task directive.c                 J    t          j        | j        j        j                  gS r'   )r   Textenvconfigcelery_task_prefix)r   r$   s     r   get_signature_prefixz"TaskDirective.get_signature_prefixN   s    
48?=>>??r   N)r1   r,   r2   r3   r?   r(   r   r   r9   r9   K   s.          @ @ @ @ @r   r9   c                 X    t          |t                    rt          |d          r|rdS dS )z&Handler for autodoc-skip-member event.r   FNr   )appwhatnameobjskipoptionss         r   autodoc_skip_member_handlerrG   R   s9     #x   WS-%@%@  	54r   c                    |                      d           |                     t                     |                     ddt                     |                     ddd           |                     dt                     ddiS )	zSetup Sphinx extension.zsphinx.ext.autodocpyr
   r>   z(task)Tzautodoc-skip-memberparallel_read_safe)setup_extensionadd_autodocumenterr	   add_directive_to_domainr9   add_config_valueconnectrG   )rA   s    r   setuprP   _   s    ,--->***fm<<<-x>>>KK%'BCCC 	d r   N)r3   inspectr   docutilsr   sphinx.domains.pythonr   sphinx.ext.autodocr   celery.app.taskr   r	   r9   rG   rP   r(   r   r   <module>rV      s    @             , , , , , , 1 1 1 1 1 1 $ $ $ $ $ $& & & & &' & & &B@ @ @ @ @J @ @ @
 
 

 
 
 
 
r   