File: //usr/local/lib/python3.9/site-packages/celery/contrib/__pycache__/sphinx.cpython-39.pyc
a
X>h?
� @ st d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
G dd� de�ZG d d
� d
e�Zdd� Z
d
d� ZdS )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 sF e Zd ZdZdZdZedd� �Zdd� Zd
d d
�Z � fdd�Z
� ZS )�TaskDocumenterzDocument task definitions.�task� c C s t |t�ot|d�S )N�__wrapped__��
isinstancer �getattr)�cls�memberZ
membernameZisattr�parent� r �?/usr/local/lib/python3.9/site-packages/celery/contrib/sphinx.py�can_document_member0 s z"TaskDocumenter.can_document_memberc C s\ t | jdd �}|d urXt|�}d|jv s2d|jv rP|jt|j�� �dd � d�}t|�S dS )Nr
�selfr � )�
parameters� )r
�objectr r �replace�list�values�str)r �wrapped�sigr r r �format_args4 s zTaskDocumenter.format_argsFc C s d S �Nr )r Zall_membersr r r �document_members= s zTaskDocumenter.document_membersc s0 t | jdd �}|r&t |d�| jkr&dS t� �� S )Nr
�
__module__T)r
r �modname�super�check_module)r r �� __class__r r r% @ s zTaskDocumenter.check_module)F)�__name__r"