o
    Df                     @  sj   d Z ddlmZ ddlmZ dZzddlmZ W n e	y'   ddlm
Z Y nw e ZG dd deZdS )	zObject Utilities.    )annotations)RLock)cached_property)threaded_cached_propertyc                      sP   e Zd ZdZd fdd	Zd fdd	Zdd Zd	d
 Zdd Zdd Z	  Z
S )r   z"Implementation of Cached property.Nc                   sF   t  | || _|| _t| ds| jj| _t| ds!t | _	d S d S )Nattrnamelock)
super__init___cached_property__set_cached_property__delhasattrfunc__name__r   r   r   )selffgetfsetfdel	__class__ L/home/ubuntu/webapp/venv/lib/python3.10/site-packages/kombu/utils/objects.pyr	      s   


zcached_property.__init__c                   s8   | j  t ||W  d    S 1 sw   Y  d S N)r   r   __get__)r   instanceownerr   r   r   r   $   s   $zcached_property.__get__c                 C  s^   |d u r| S | j  | jd ur| ||}|j}||| j< W d    d S 1 s(w   Y  d S r   )r   r
   __dict__r   )r   r   valuecacher   r   r   __set__*   s   
"zcached_property.__set__c                 C  s   |d u r| S | j . |j| jt}| jr'|tur/| || W d    d S W d    d S W d    d S 1 s:w   Y  d S r   )r   r   popr   
_NOT_FOUNDr   )r   r   r   r   r   r   
__delete__5   s   "zcached_property.__delete__c                 C  s   |  | j|| jS r   )r   r   r   )r   r   r   r   r   setter?      zcached_property.setterc                 C  s   |  | j| j|S r   )r   r   r
   )r   r   r   r   r   deleterB   r#   zcached_property.deleter)NNNr   )r   
__module____qualname____doc__r	   r   r   r!   r"   r$   __classcell__r   r   r   r   r      s    
r   N)r'   
__future__r   	threadingr   __all__	functoolsr   _cached_propertyImportErrorr   objectr    r   r   r   r   <module>   s    