
    h                     j    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y)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y)r   z(Annotation map: task_name => attributes.c                 >    	 t        | d         S # t        $ r Y y w xY w)N*)dictKeyError)selfs    R/var/www/Befach/backend/env/lib/python3.12/site-packages/celery/app/annotations.pyr   zMapAnnotation.annotate_any   s'    	S	?" 		s    	c                 R    	 t        | |j                           S # t        $ r Y y w xY wN)r   namer   )r   tasks     r   r   zMapAnnotation.annotate   s,    	TYY(( 		s    	&&N)__name__
__module____qualname____doc__r   r        r   r   r      s    2r   r   c                 v    d }| yt        | t        t        f      s| f} | D cg c]
  } ||       c}S c c}w )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$   s4    j$' ,,
C(j11r   r   )r   listtuple)annotationsr!   annos      r   r	   r	   "   sA     dE]3"n0;<d#<<<s   6c                 >    d t        | |      t        |       fD        S )z Resolve all pending annotations.c              3   &   K   | ]	  }|s|  y wr   r   ).0xs     r   	<genexpr>zresolve_all.<locals>.<genexpr>4   s     O!QAOs   )_first_match_first_match_any)r%   r   s     r   r
   r
   2   s    OT402B42HIOOr   N)r   celery.utils.functionalr   r   celery.utils.importsr   r+   r,   __all__r   r   r	   r
   r   r   r   <module>r0      sC    7 ,:&~. 
5D  = Pr   