o
    wvXjý	  ã                   @   sŠ   d Z ddlmZmZm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.é    )Úabsolute_importÚprint_functionÚunicode_literals)Ú_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   úP/var/www/html/myproject/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   ;   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_consF   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   Ú__inner6   s   
ÿÿ€z8shared_task.<locals>.create_shared_task.<locals>.__innerr   )r   r)   r   r(   r   Úcreate_shared_task4   s   z'shared_task.<locals>.create_shared_taskr   r   Nr   )ÚlenÚcallable)ÚargsÚkwargsr*   r   r   r   r      s   r   r   )Ú__doc__Ú
__future__r   r   r   Úceleryr   Úcelery._stater   r   r   r	   r
   Úcelery.localr   Úbaser   Úutilsr   Ú__all__r   r   r   r   r   r   r   Ú<module>   s   
