
    ge                         d Z ddlZddlmZ ddlmZmZmZmZm	Z	m
Z
mZmZ dZej                  dk\  rddlmZ neZ e
d      Z G d	 d
e	ee         Z G d dee         Zy)zVarious helper functions.    N)cached_property)AnyCallableGenericOptionalProtocolTypeVarUnionoverload)under_cached_propertyr   )      )Self_Tc                   "    e Zd ZU eeef   ed<   y)_TSelf_cacheN)__name__
__module____qualname__dictstrr   __annotations__     J/var/www/openai/venv/lib/python3.12/site-packages/propcache/_helpers_py.pyr   r      s    bMr   r   c            	           e Zd ZdZdedef   ddfdZeddddee	e
      defd	       Zeddee   dee	e
      defd
       Z	 ddeee      dee	e
      deeef   fdZdee   deddfdZy)r   aU  Use as a class method decorator.

    It operates almost exactly like
    the Python `@property` decorator, but it puts the result of the
    method it decorates into the instance dict after the first call,
    effectively replacing the function it decorates with an instance
    variable.  It is, in Python parlance, a data descriptor.
    wrapped.returnNc                 V    || _         |j                  | _        |j                  | _        y N)r   __doc__r   name)selfr   s     r   __init__zunder_cached_property.__init__    s!    $$	r   instownerc                      y r!   r   r$   r&   r'   s      r   __get__zunder_cached_property.__get__%   s    QTr   c                      y r!   r   r)   s      r   r*   zunder_cached_property.__get__(   s    UXr   c                     || S 	 |j                   | j                     S # t        $ r/ | j                  |      }||j                   | j                  <   |cY S w xY wr!   )r   r#   KeyErrorr   )r$   r&   r'   vals       r   r*   zunder_cached_property.__get__+   sZ     <K	;;tyy)) 	,,t$C%(DKK		"J	s    5AAvaluec                     t        d      )Nzcached property is read-only)AttributeError)r$   r&   r/   s      r   __set__zunder_cached_property.__set__7   s    ;<<r   r!   )r   r   r   r"   r   r   r%   r   r   typeobjectr   r*   r   r
   r2   r   r   r   r   r      s    %b 1 %d %
 TDT$v,)?T4T TXF2JXxV/EXQSX X KO
VBZ(
19$v,1G
	r4x
=F2J =r =d =r   r   )r"   sys	functoolsr   typingr   r   r   r   r   r	   r
   r   __all__version_infor   r   r   r   r   r   r   <module>r:      s_     
 % W W W
6 wDT]Xwr{ "=GBK "=r   