
    ^fJ                       d Z ddlmZ ddlmZ ddlmZmZmZmZ ddl	m
Z
 ddlmZ ddlmZ erdd	lmZ dd
lmZ dZ ed          Z edd          Z edd          ZddZddZ G d d          Z G d de          ZdS )zObject utilities.    )annotations)copy)TYPE_CHECKINGAnyCallableTypeVar   )maybe_channel)NotBoundError)ChannelPromise)
Connection)Channel)ObjectMaybeChannelBound_T_ObjectTyper   )bound_MaybeChannelBoundTyper   clstype[_ObjectType]kwargsdict[str, Any]returnc                     | di |S N r   )r   r   s     @/var/www/html/env/lib/python3.11/site-packages/kombu/abstract.pyunpickle_dictr      s     3====    vc                    | S Nr   )r    s    r   _anyr#       s    Hr   c                  D    e Zd ZU dZdZded<   dd
ZdddZddZddZ	dS )r   zYCommon base class.

    Supports automatic kwargs->attributes handling, and cloning.
    r   ztuple[tuple[str, Any], ...]attrsargsr   r   r   Nonec                    | j         D ]p\  }}|                    |          }|"t          | | |pt          |                     >	 t	          | |           P# t
          $ r t          | |d            Y mw xY wd S r"   )r%   getsetattrr#   getattrAttributeError)selfr&   r   nametype_values         r   __init__zObject.__init__,   s    : 	. 	.KD%JJt$$E d]U]dE$:$:;;;;.D$''''% . . .D$-----.	. 	.s   AA65A6Frecurseboolr   c                >     dd	fd fd j         D             S )
Nobjr   typeCallable[[Any], Any] | Noner   c                    r+t          | t                    r|                     d          S |r|  ||           n| S )NT)r2   )
isinstancer   as_dict)r5   r6   r2   s     r   fzObject.as_dict.<locals>.f8   sK     1:c622 1{{4{000 $A44999cAr   c           	     L    i | ] \  }}| t          |          |          !S r   )r+   ).0attrr6   r;   r-   s      r   
<dictcomp>z"Object.as_dict.<locals>.<dictcomp><   sB     
 
 
3=4D!!GD$''..
 
 
r   r"   )r5   r   r6   r7   r   r   )r%   )r-   r2   r;   s   ``@r   r:   zObject.as_dict7   sa    	B 	B 	B 	B 	B 	B 	B
 
 
 
 
AE
 
 
 	
r   r-   r   ktuple[Callable[[type[_ObjectType], dict[str, Any]], _ObjectType], tuple[type[_ObjectType], dict[str, Any]]]c                F    t           | j        |                                 ffS r"   )r   	__class__r:   r-   s    r   
__reduce__zObject.__reduce__@   s     t~t||~~>>>r   c                @     | j         di |                                 S r   )rB   r:   rC   s    r   __copy__zObject.__copy__F   s"    t~/////r   N)r&   r   r   r   r   r'   )F)r2   r3   r   r   )r-   r   r   r@   )r-   r   r   r   )
__name__
__module____qualname____doc__r%   __annotations__r1   r:   rD   rF   r   r   r   r   r   $   s          
 *,E++++	. 	. 	. 	.
 
 
 
 
? ? ? ?0 0 0 0 0 0r   c                      e Zd ZU dZdZded<   dZdZddZddZ	ddZ
ddZddZddZdddZed d            Zed!d            ZdS )"r   z7Mixin for classes that can be bound to an AMQP channel.NzChannel | None_channelFr-   r   channelChannel | Connectionr   c                ,    |                      |          S )z&`self(channel) -> self.bind(channel)`.)bindr-   rN   s     r   __call__zMaybeChannelBound.__call__S   s     yy!!!r   c                F    t          |                               |          S )z7Create copy of the instance that is bound to a channel.)r   
maybe_bindrR   s     r   rQ   zMaybeChannelBound.bindY   s     Dzz$$W---r   c                v    | j         s1|r/t          |          | _        |                                  d| _        | S )z.Bind instance to channel if not already bound.T)is_boundr
   rM   
when_bound	_is_boundrR   s     r   rU   zMaybeChannelBound.maybe_bind_   s@     } 	" 	")'22DMOO!DNr   r   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)rW   rM   rX   rR   s     r   revivezMaybeChannelBound.revivei   s5     = 	#DMOO	 	r   c                    dS )z(Callback called when the class is bound.Nr   rC   s    r   rX   zMaybeChannelBound.when_bounds   s      r   strc                P    |                      t          |           j                  S r"   )_repr_entityr6   rG   rC   s    r   __repr__zMaybeChannelBound.__repr__v   s      d!4555r    itemc                    |pt          |           j        }| j        r4d                    |pt          |           j        | j        j                  S d| dS )Nz<{} bound to chan:{}>z	<unbound >)r6   rG   rW   formatrN   
channel_id)r-   rb   s     r   r_   zMaybeChannelBound._repr_entityy   sd    *tDzz*= 	F*11+T

+T\-DF F F"4""""r   r3   c                "    | j         o| j        duS )z!Flag set if the channel is bound.N)rY   rM   rC   s    r   rW   zMaybeChannelBound.is_bound   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)rM   r   re   r6   rG   r9   r   rR   s     r   rN   zMaybeChannelBound.channel   sl     -?@GGJJ') )* * * g~.. 	0&-gii/Gdmr   )r-   r   rN   rO   r   r   )rN   r   r   r'   )r   r'   )r   r]   )ra   )rb   r]   r   r]   )r   r3   )r   r   )rG   rH   rI   rJ   rM   rK   rY   can_cache_declarationrS   rQ   rU   r[   rX   r`   r_   propertyrW   rN   r   r   r   r   r   J   s        AA#H####I "" " " ". . . .      7 7 7 76 6 6 6# # # # # < < < X< 	 	 	 X	 	 	r   N)r   r   r   r   r   r   )r    r   r   r   )rJ   
__future__r   r   typingr   r   r   r   
connectionr
   
exceptionsr   utils.functionalr   kombu.connectionr   kombu.transport.virtualr   __all__r   r   r   r   r#   r   r   r   r   r   <module>rs      s     " " " " " "       8 8 8 8 8 8 8 8 8 8 8 8 % % % % % % % % % % % % , , , , , , 0++++++////// *WT]]gm8444 $7   
      #0 #0 #0 #0 #0 #0 #0 #0LE E E E E E E E E Er   