
    `f                     ~    d Z ddlmZmZ ddlmZ  ed          Z ed          ZdZ G d de	          Z
d	 Zd
 ZdS )zTask Annotations.

Annotations is a nice term for monkey-patching task classes
in the configuration.

This prepares and performs the annotations in the
:setting:`task_annotations` setting.
    )firstmethodmlazy)instantiateannotateannotate_any)MapAnnotationprepareresolve_allc                       e Zd ZdZd Zd ZdS )r   z(Annotation map: task_name => attributes.c                 P    	 t          | d                   S # t          $ r Y d S w xY w)N*)dictKeyError)selfs    H/var/www/html/env/lib/python3.11/site-packages/celery/app/annotations.pyr   zMapAnnotation.annotate_any   s9    	S	??" 	 	 	DD	s    
%%c                 Z    	 t          | |j                           S # t          $ r Y d S w xY wN)r   namer   )r   tasks     r   r   zMapAnnotation.annotate   s=    	TY((( 	 	 	DD	s    
**N)__name__
__module____qualname____doc__r   r        r   r   r      s8        22      r   r   c                 l    d | dS t          | t          t          f          s| f} fd| D             S )z/Expand the :setting:`task_annotations` setting.c                     t          | t                    rt          |           S t          | t                    rt	          t
          |           S | S r   )
isinstancer   r   strr   r   )
annotations    r   expand_annotationz"prepare.<locals>.expand_annotation$   sJ    j$'' 	2 ,,,
C(( 	2j111r   Nr   c                 &    g | ]} |          S r   r   ).0annor!   s     r   
<listcomp>zprepare.<locals>.<listcomp>/   s%    <<<d##<<<r   )r   listtuple)annotationsr!   s    @r   r	   r	   "   sV       rdE]33 %"n<<<<<<<<r   c                 T    d t          | |          t          |           fD             S )z Resolve all pending annotations.c              3      K   | ]}||V  	d S r   r   )r#   xs     r   	<genexpr>zresolve_all.<locals>.<genexpr>4   s'      OO!QOAOOOOOOr   )_first_match_first_match_any)r$   r   s     r   r
   r
   2   s.    OOT4002B42H2HIOOOOr   N)r   celery.utils.functionalr   r   celery.utils.importsr   r-   r.   __all__r   r   r	   r
   r   r   r   <module>r2      s     7 6 6 6 6 6 6 6 , , , , , ,{:&&;~.. 
5    D    = = = P P P P Pr   