o
    Df~	                     @   sv   d Z ddlmZ ddlmZmZmZmZmZ ddl	m
Z
 ddlmZ ddlmZ dZe
d	d
 ZdddZdd ZdS )zCelery Application.    )_state)app_or_defaultdisable_traceenable_tracepop_current_taskpush_current_task)Proxy   )Celery)
AppPickler)
r
   r   r   default_app	bugreportr   r   shared_taskr   r   c                   C   s   t jS N)r   r    r   r   L/home/ubuntu/webapp/venv/lib/python3.10/site-packages/celery/app/__init__.py<lambda>   s    r   Nc                 C   s   | pt   S )z)Return information useful in bug reports.)r   get_current_appr   appr   r   r   r      s   r   c                  O   sD   dd }t | dkrt| d r|di || d S || i |S )aL  Create shared task (decorator).

    This can be used by library authors to create tasks that'll work
    for any app environment.

    Returns:
        ~celery.local.Proxy: A proxy that always takes the task from the
        current apps task registry.

    Example:

        >>> from celery import Celery, shared_task
        >>> @shared_task
        ... def add(x, y):
        ...     return x + y
        ...
        >>> app1 = Celery(broker='amqp://')
        >>> add.app is app1
        True
        >>> app2 = Celery(broker='redis://')
        >>> add.app is app2
        True
    c                     s    fdd}|S )Nc              	      s    dt fdd t D ]!}|jr4|j |j fi  W d    n1 s/w   Y  q fdd}t|S )Nnamec                    s   | j  fi S r   )_task_from_funr   )funoptionsr   r   r   7   s    zJshared_task.<locals>.create_shared_task.<locals>.__inner.<locals>.<lambda>c                     s"   t  } | jp|  j j S r   )r   r   tasksgen_task_name__name__
__module__r   r   r   r   r   task_by_consB   s   zNshared_task.<locals>.create_shared_task.<locals>.__inner.<locals>.task_by_cons)getr   connect_on_app_finalize_get_active_apps	finalized_finalize_mutexr   r   )r   r   r   r   r   r   __inner2   s   
z8shared_task.<locals>.create_shared_task.<locals>.__innerr   )r   r&   r   r%   r   create_shared_task0   s   z'shared_task.<locals>.create_shared_taskr	   r   Nr   )lencallable)argskwargsr'   r   r   r   r      s   r   r   )__doc__celeryr   celery._stater   r   r   r   r   celery.localr   baser
   utilsr   __all__r   r   r   r   r   r   r   <module>   s    
