
    [,hQ                         d Z dZdZdZddlmZ ddlmZ ddlZddlZ G d d	      Z	 G d
 d      Z
 G d d      ZeZeZ G d de      ZeZeZy)zDaniel Roy Greenfeldzdaniel@feldroy.comz2.0.1BSD    wraps)timeNc                   "    e Zd ZdZd Zd Zd Zy)cached_propertya   
    A property that is only computed once per instance and then replaces itself
    with an ordinary attribute. Deleting the attribute resets the property.
    Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76
    c                 4    t        |d      | _        || _        y N__doc__)getattrr   funcselfr   s     K/var/www/html/trade_iq/venv/lib/python3.12/site-packages/cached_property.py__init__zcached_property.__init__   s    tY/	    c                     || S t        j                  | j                        r| j                  |      S | j                  |      x}|j                  | j                  j
                  <   |S N)asyncioiscoroutinefunctionr   _wrap_in_coroutine__dict____name__)r   objclsvalues       r   __get__zcached_property.__get__   sY    ;K&&tyy1**3//3799S>ATYY//0r   c                 <     t               fd       } |       S )Nc                      t        j                  j                              } | j                  j                  j                  <   | S r   )r   ensure_futurer   r   r   )futurer   r   s    r   wrapperz3cached_property._wrap_in_coroutine.<locals>.wrapper"   s8    **499S>:F/5CLL++,Mr   r   )r   r   r"   s   `` r   r   z"cached_property._wrap_in_coroutine!   s#    	s	 
	
 yr   N)r   
__module____qualname__r   r   r   r    r   r   r   r      s    r   r   c                       e Zd ZdZd Zd Zy)threaded_cached_property
    A cached_property version for use in environments where multiple threads
    might concurrently try to access the property.
    c                 f    t        |d      | _        || _        t        j                         | _        y r
   )r   r   r   	threadingRLocklockr   s     r   r   z!threaded_cached_property.__init__1   s%    tY/	OO%	r   c                    || S |j                   }| j                  j                  }| j                  5  	 ||   cd d d        S # t        $ r- |j                  || j                  |            cY cd d d        S w xY w# 1 sw Y   y xY wr   )r   r   r   r,   KeyError
setdefault)r   r   r   obj_dictnames        r   r   z threaded_cached_property.__get__6   s    ;K<<yy!!YY 	AA~	A 	A
  A**43@@	A 	A
A	A 	As(   A<A*A9-A<8A99A<<BN)r   r#   r$   r   r   r   r%   r   r   r'   r'   +   s    
&
Ar   r'   c                   6    e Zd ZdZd	dZd Zd Zd Zd Zd Z	y)
cached_property_with_ttlz
    A property that is only computed once per instance and then replaces itself
    with an ordinary attribute. Setting the ttl to a number expresses how long
    the property will last before being timed out.
    Nc                 X    t        |      r|}d }nd }|| _        | j                  |       y r   )callablettl_prepare_func)r   r6   r   s      r   r   z!cached_property_with_ttl.__init__M   s-    C=DCD4 r   c                 (    | j                  |       | S r   )r7   r   s     r   __call__z!cached_property_with_ttl.__call__V   s    4 r   c                     || S t               }|j                  }| j                  }	 ||   \  }}| j                  xr | j                  ||z
  k  }|s|S | j                  |      }||f||<   |S # t        $ r Y %w xY wr   )r   r   r   r6   r.   r   )	r   r   r   nowr0   r1   r   last_updatedttl_expireds	            r   r   z cached_property_with_ttl.__get__Z   s    ;Kf<<}}	"*4.E< ((Dtxx#2D'DK		#  		s   A. .	A:9A:c                 P    |j                   j                  | j                  d        y r   )r   popr   )r   r   s     r   
__delete__z#cached_property_with_ttl.__delete__n   s    -r   c                 J    |t               f|j                  | j                  <   y r   )r   r   r   )r   r   r   s      r   __set__z cached_property_with_ttl.__set__q   s    ',dfoT]]#r   c                 ~    || _         |r4|j                  | _        |j                  | _        |j                  | _        y y r   )r   r   r   r#   r   s     r   r7   z&cached_property_with_ttl._prepare_funct   s2    	<<DL MMDM"ooDO r   r   )
r   r#   r$   r   r   r9   r   r@   rB   r7   r%   r   r   r3   r3   F   s%    !(.6.r   r3   c                   .     e Zd ZdZd fd	Z fdZ xZS )!threaded_cached_property_with_ttlr(   c                 ^    t         t        |   |       t        j                         | _        y r   )superrE   r   r*   r+   r,   )r   r6   	__class__s     r   r   z*threaded_cached_property_with_ttl.__init__   s!    /?DOO%	r   c                 p    | j                   5  t        t        |   ||      cd d d        S # 1 sw Y   y xY wr   )r,   rG   rE   r   )r   r   r   rH   s      r   r   z)threaded_cached_property_with_ttl.__get__   s5    YY 	T:DI#sS	T 	T 	Ts   ,5r   )r   r#   r$   r   r   r   __classcell__)rH   s   @r   rE   rE      s    
&T Tr   rE   )
__author__	__email____version____license__	functoolsr   r   r*   r   r   r'   r3   cached_property_ttltimed_cached_propertyrE   threaded_cached_property_ttltimed_threaded_cached_propertyr%   r   r   <module>rT      sr   #
 	     >A A63. 3.n / 0 T(@ T   A !B r   