HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/kombu/__pycache__/abstract.cpython-310.pyc
o

'weJ�@s�dZddlmZddlmZddlmZmZmZmZddl	m
Z
ddlmZddl
mZer:dd	lmZdd
lmZdZed�Zed
dd�Zeddd�Zddd�Zd dd�ZGdd�d�ZGdd�de�ZdS)!zObject 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]�returncCs|di|��S�N�r)rrrr�G/home/arjun/projects/env/lib/python3.10/site-packages/kombu/abstract.py�
unpickle_dictsr�vcCs|S�Nr)rrrr�_any src@sHeZdZUdZdZded<dd
d�Zdddd�Zddd�Zddd�Z	dS)rzYCommon base class.

    Supports automatic kwargs->attributes handling, and cloning.
    rztuple[tuple[str, Any], ...]�attrs�argsrrr�Nonec	Osh|jD].\}}|�|�}|durt|||pt|��qzt||�Wqty1t||d�YqwdSr)r �get�setattrr�getattr�AttributeError)�selfr!r�name�type_�valuerrr�__init__,s
��zObject.__init__F�recurse�boolrcs&d
d�fdd�
���fdd	��jD�S)N�objr�type�Callable[[Any], Any] | Nonercs2�r
t|t�r
|jdd�S|r|dur||�S|S)NT�r,)�
isinstancer�as_dict)r.r/r1rr�f8szObject.as_dict.<locals>.fcs"i|]
\}}|�t�|�|��qSr)r%)�.0�attrr/)r4r'rr�
<dictcomp><s�z"Object.as_dict.<locals>.<dictcomp>r)r.rr/r0rr)r )r'r,r)r4r,r'rr37s�zObject.as_dictr'r�ktuple[Callable[[type[_ObjectType], dict[str, Any]], _ObjectType], tuple[type[_ObjectType], dict[str, Any]]]cCst|j|��ffSr)r�	__class__r3�r'rrr�
__reduce__@szObject.__reduce__cCs|jdi|����Sr)r9r3r:rrr�__copy__FszObject.__copy__N)r!rrrrr")F)r,r-rr)r'rrr8)r'rrr)
�__name__�
__module__�__qualname__�__doc__r �__annotations__r+r3r;r<rrrrr$s


	c@s�eZdZUdZdZded<dZdZd#dd�Zd#d
d�Z	d#dd�Z
d$dd�Zd%dd�Zd&dd�Z
d'd(dd�Zed)dd ��Zed*d!d"��ZdS)+rz7Mixin for classes that can be bound to an AMQP channel.NzChannel | None�_channelFr'r�channel�Channel | ConnectionrcCs
|�|�S)z&`self(channel) -> self.bind(channel)`.)�bind�r'rCrrr�__call__Ss
zMaybeChannelBound.__call__cCst|��|�S)z7Create copy of the instance that is bound to a channel.)r�
maybe_bindrFrrrrEYszMaybeChannelBound.bindcCs&|js|rt|�|_|��d|_|S)z.Bind instance to channel if not already bound.T)�is_boundr	rB�
when_bound�	_is_boundrFrrrrH_s


zMaybeChannelBound.maybe_bindr
r"cCs|jr||_|��dSdS)zyRevive channel after the connection has been re-established.

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

        N)rIrBrJrFrrr�reviveis�zMaybeChannelBound.revivecCsdS)z(Callback called when the class is bound.Nrr:rrrrJsszMaybeChannelBound.when_bound�strcCs|�t|�j�Sr)�_repr_entityr/r=r:rrr�__repr__vszMaybeChannelBound.__repr__��itemcCs:|pt|�j}|jrd�|pt|�j|jj�Sd|�d�S)Nz<{} bound to chan:{}>z	<unbound �>)r/r=rI�formatrC�
channel_id)r'rQrrrrNys�zMaybeChannelBound._repr_entityr-cCs|jo|jduS)z!Flag set if the channel is bound.N)rKrBr:rrrrI�szMaybeChannelBound.is_boundcCs<|j}|durtd�t|�j���t|t�r|�}|_|S)z'Current channel if the object is bound.Nz.Can't call method on {} not bound to a channel)rBr
rSr/r=r2rrFrrrrC�s��
zMaybeChannelBound.channel)r'rrCrDrr)rCr
rr")rr")rrM)rP)rQrMrrM)rr-)rr
)r=r>r?r@rBrArK�can_cache_declarationrGrErHrLrJrOrN�propertyrIrCrrrrrJs 








N)rrrrrr)rrrr)r@�
__future__rr�typingrrrr�
connectionr	�
exceptionsr
�utils.functionalr�kombu.connectionr�kombu.transport.virtualr
�__all__rrrrrrrrrrr�<module>s(�

&