ó
O'^c           @@  sĪ   d  Z  d d l m Z d d l m Z d d l m Z d d l m Z d d l m	 Z	 d d	 g Z
 d
   Z d   Z d e f d     YZ d	 e f d     YZ d S(   s3   
kombu.abstract
==============

Object utilities.

i    (   t   absolute_import(   t   copyi   (   t   maybe_channel(   t   NotBoundError(   t   ChannelPromiset   Objectt   MaybeChannelBoundc         C@  s
   |  |   S(   N(    (   t   clst   kwargs(    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt   unpickle_dict   s    c         C@  s   |  S(   N(    (   t   v(    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt   _any   s    c           B@  s;   e  Z d  Z d Z d   Z e d  Z d   Z d   Z RS(   sT   Common base class supporting automatic kwargs->attributes handling,
    and cloning.c         O@  s   x |  j  D]{ \ } } | j |  } | d  k	 rP t |  | | pC t |   q
 y t |  |  Wq
 t k
 r t |  | d   q
 Xq
 Wd  S(   N(   t   attrst   gett   Nonet   setattrR   t   getattrt   AttributeError(   t   selft   argsR   t   namet   type_t   value(    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt   __init__    s    c         @  s/    f d     t     f d    j D  S(   Nc         @  s9     r% t  |  t  r% |  j d t  S| r5 | |   S|  S(   Nt   recurse(   t
   isinstanceR   t   as_dictt   True(   t   objt   type(   R   (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt   f,   s    c         3@  s3   |  ]) \ } } |   t   |  |  f Vq d  S(   N(   R   (   t   .0t   attrR   (   R   R   (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pys	   <genexpr>1   s    (   t   dictR   (   R   R   (    (   R   R   R   s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyR   +   s    c         C@  s   t  |  j |  j   f f S(   N(   R	   t	   __class__R   (   R   (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt
   __reduce__4   s    c         C@  s   |  j  |  j     S(   N(   R"   R   (   R   (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt   __copy__7   s    (    (	   t   __name__t
   __module__t   __doc__R   R   t   FalseR   R#   R$   (    (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyR      s   			c           B@  sw   e  Z d  Z d
 Z e Z e Z d   Z d   Z	 d   Z
 d   Z d   Z d d  Z e d    Z e d	    Z RS(   s7   Mixin for classes that can be bound to an AMQP channel.c         C@  s   |  j  |  S(   s%   `self(channel) -> self.bind(channel)`(   t   bind(   R   t   channel(    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt   __call__C   s    c         C@  s   t  |   j |  S(   s7   Create copy of the instance that is bound to a channel.(   R   t
   maybe_bind(   R   R*   (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyR)   G   s    c         C@  s9   |  j  r5 | r5 t |  |  _ |  j   t |  _ n  |  S(   s.   Bind instance to channel if not already bound.(   t   is_boundR   t   _channelt
   when_boundR   t	   _is_bound(   R   R*   (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyR,   K   s
    
c         C@  s#   |  j  r | |  _ |  j   n  d S(   sy   Revive channel after the connection has been re-established.

        Used by :meth:`~kombu.Connection.ensure`.

        N(   R-   R.   R/   (   R   R*   (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt   reviveS   s    		c         C@  s   d S(   s(   Callback called when the class is bound.N(    (   R   (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyR/   ]   s    t    c         C@  sP   | p t  |   j } |  j rC d j | p6 t  |   j |  j j  Sd j |  S(   Ns   <{0} bound to chan:{1}>s   <unbound {0}>(   R   R%   R-   t   formatR*   t
   channel_id(   R   t   item(    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt   __repr__a   s
    	c         C@  s   |  j  o |  j d k	 S(   s!   Flag set if the channel is bound.N(   R0   R.   R   (   R   (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyR-   h   s    c         C@  s\   |  j  } | d k r6 t d j t |   j    n  t | t  rX |   } |  _  n  | S(   s'   Current channel if the object is bound.s/   Can't call method on {0} not bound to a channelN(   R.   R   R   R3   R   R%   R   R   (   R   R*   (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyR*   m   s    	N(   R%   R&   R'   R   R.   R(   R0   t   can_cache_declarationR+   R)   R,   R1   R/   R6   t   propertyR-   R*   (    (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyR   ;   s   				
	N(   R'   t
   __future__R    R   t
   connectionR   t
   exceptionsR   t   utilsR   t   __all__R	   R   t   objectR   R   (    (    (    s0   /tmp/pip-unpacked-wheel-UAnTfW/kombu/abstract.pyt   <module>   s   		 