
     h                         d Z ddlmZ ddlmZ ddlmZ ddlmZ dZd Z	d	 Z
 G d
 d          Z G d de          ZdS )zObject utilities.    )copy   )maybe_channel)NotBoundError)ChannelPromise)ObjectMaybeChannelBoundc                      | di |S N r   )clskwargss     J/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/kombu/abstract.pyunpickle_dictr      s    3====    c                     | S Nr   )vs    r   _anyr      s    Hr   c                   0    e Zd ZdZdZd Zd	dZd Zd ZdS )
r   zYCommon base class.

    Supports automatic kwargs->attributes handling, and cloning.
    r   c                     | j         D ]p\  }}|                    |          }|"t          | | |pt          |                     >	 t	          | |           P# t
          $ r t          | |d            Y mw xY wd S r   )attrsgetsetattrr   getattrAttributeError)selfargsr   nametype_values         r   __init__zObject.__init__   s    : 	. 	.KD%JJt$$E d]U]dE$:$:;;;;.D$''''% . . .D$-----.	. 	.s   AA65A6Fc                 :     fd fd j         D             S )Nc                     r+t          | t                    r|                     d          S |r|  ||           n| S )NT)recurse)
isinstancer   as_dict)objtyper%   s     r   fzObject.as_dict.<locals>.f(   sK     1:c622 1{{4{000 $A44999cAr   c           	      L    i | ] \  }}| t          |          |          !S r   )r   ).0attrr)   r*   r   s      r   
<dictcomp>z"Object.as_dict.<locals>.<dictcomp>,   sB     
 
 
3=4D!!GD$''..
 
 
r   )r   )r   r%   r*   s   ``@r   r'   zObject.as_dict'   sU    	B 	B 	B 	B 	B
 
 
 
 
AE
 
 
 	
r   c                 F    t           | j        |                                 ffS r   )r   	__class__r'   r   s    r   
__reduce__zObject.__reduce__0   s    t~t||~~>>>r   c                 @     | j         di |                                 S r   )r0   r'   r1   s    r   __copy__zObject.__copy__3   s"    t~/////r   N)F)	__name__
__module____qualname____doc__r   r"   r'   r2   r4   r   r   r   r   r      sf         
 E	. 	. 	.
 
 
 
? ? ?0 0 0 0 0r   r   c                   v    e Zd ZdZdZdZdZd Zd Zd Z	d Z
d Zd	 ZddZed             Zed             ZdS )r	   z7Mixin for classes that can be bound to an AMQP channel.NFc                 ,    |                      |          S )z&`self(channel) -> self.bind(channel)`.)bindr   channels     r   __call__zMaybeChannelBound.__call__@   s    yy!!!r   c                 F    t          |                               |          S )z7Create copy of the instance that is bound to a channel.)r   
maybe_bindr<   s     r   r;   zMaybeChannelBound.bindD   s    Dzz$$W---r   c                 v    | j         s1|r/t          |          | _        |                                  d| _        | S )z.Bind instance to channel if not already bound.T)is_boundr   _channel
when_bound	_is_boundr<   s     r   r@   zMaybeChannelBound.maybe_bindH   s>    } 	" 	")'22DMOO!DNr   c                 N    | j         r|| _        |                                  dS dS )zyRevive channel after the connection has been re-established.

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

        N)rB   rC   rD   r<   s     r   revivezMaybeChannelBound.reviveP   s5     = 	#DMOO	 	r   c                     dS )z(Callback called when the class is bound.Nr   r1   s    r   rD   zMaybeChannelBound.when_boundZ   s      r   c                 P    |                      t          |           j                  S r   )_repr_entityr)   r5   r1   s    r   __repr__zMaybeChannelBound.__repr__]   s      d!4555r    c                     |pt          |           j        }| j        r4d                    |pt          |           j        | j        j                  S d| dS )Nz<{} bound to chan:{}>z	<unbound >)r)   r5   rB   formatr=   
channel_id)r   items     r   rJ   zMaybeChannelBound._repr_entity`   sd    *tDzz*= 	F*11+T

+T\-DF F F"4""""r   c                 "    | j         o| j        duS )z!Flag set if the channel is bound.N)rE   rC   r1   s    r   rB   zMaybeChannelBound.is_boundg   s     ~;$-t";;r   c                     | j         }|4t          d                    t          |           j                            t          |t                    r |            x}| _         |S )z'Current channel if the object is bound.Nz.Can't call method on {} not bound to a channel)rC   r   rO   r)   r5   r&   r   r<   s     r   r=   zMaybeChannelBound.channell   sl     -?@GGJJ') )* * * g~.. 	0&-gii/Gdmr   )rL   )r5   r6   r7   r8   rC   rE   can_cache_declarationr>   r;   r@   rG   rD   rK   rJ   propertyrB   r=   r   r   r   r	   r	   7   s        AAHI "" " ". . .    7 7 76 6 6# # # # < < X< 	 	 X	 	 	r   r	   N)r8   r   
connectionr   
exceptionsr   utils.functionalr   __all__r   r   r   r	   r   r   r   <module>rZ      s            % % % % % % % % % % % % , , , , , ,
)     0  0  0  0  0  0  0  0F? ? ? ? ? ? ? ? ? ?r   