ó
P'^c           @@  s   d  Z  d d l m Z d d l m Z d d l m Z m Z d d l m	 Z	 e d  Z
 e d  Z d d	 d
 g Z d e f d     YZ d   Z d   Z d S(   ső   
    celery.app.annotations
    ~~~~~~~~~~~~~~~~~~~~~~

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

    This prepares and performs the annotations in the
    :setting:`CELERY_ANNOTATIONS` setting.

i    (   t   absolute_import(   t   string_t(   t   firstmethodt   mlazy(   t   instantiatet   annotatet   annotate_anyt   MapAnnotationt   preparet   resolve_allc           B@  s   e  Z d    Z d   Z RS(   c         C@  s*   y t  |  d  SWn t k
 r% n Xd  S(   Nt   *(   t   dictt   KeyError(   t   self(    (    s8   /tmp/pip-unpacked-wheel-gV1wwp/celery/app/annotations.pyR      s    c         C@  s-   y t  |  | j  SWn t k
 r( n Xd  S(   N(   R   t   nameR   (   R   t   task(    (    s8   /tmp/pip-unpacked-wheel-gV1wwp/celery/app/annotations.pyR   !   s    (   t   __name__t
   __module__R   R   (    (    (    s8   /tmp/pip-unpacked-wheel-gV1wwp/celery/app/annotations.pyR      s   	c         C@  sW   d   } |  d k r d St |  t t f  s: |  f }  n  g  |  D] } | |  ^ qA S(   s2   Expands the :setting:`CELERY_ANNOTATIONS` setting.c         S@  s9   t  |  t  r t |   St  |  t  r5 t t |   S|  S(   N(   t
   isinstanceR   R   R   R   R   (   t
   annotation(    (    s8   /tmp/pip-unpacked-wheel-gV1wwp/celery/app/annotations.pyt   expand_annotation+   s
    
N(    (   t   NoneR   t   listt   tuple(   t   annotationsR   t   anno(    (    s8   /tmp/pip-unpacked-wheel-gV1wwp/celery/app/annotations.pyR   (   s    	c         C@  s#   d   t  |  |  t |   f D S(   Nc         s@  s   |  ] } | r | Vq d  S(   N(    (   t   .0t   x(    (    s8   /tmp/pip-unpacked-wheel-gV1wwp/celery/app/annotations.pys	   <genexpr>:   s    (   t   _first_matcht   _first_match_any(   R   R   (    (    s8   /tmp/pip-unpacked-wheel-gV1wwp/celery/app/annotations.pyR	   9   s    N(   t   __doc__t
   __future__R    t   celery.fiveR   t   celery.utils.functionalR   R   t   celery.utils.importsR   R   R   t   __all__R   R   R   R	   (    (    (    s8   /tmp/pip-unpacked-wheel-gV1wwp/celery/app/annotations.pyt   <module>   s   	