
    AHj!                        d dl mZ d dlZd dlmZmZmZmZ ej                  dk\  rd dl	m
Z
 y edd      Z e       Z G d	 d
ee         Z
y)    )annotationsN)AnyGenericTypeVaroverload)      )cached_property_T_coT)	covariantc                  f    e Zd ZddZddZed	d
d       Ze	 d		 	 	 	 	 dd       Z	 d		 	 	 	 	 ddZy)r
   c                d    || _         d | _        |j                  | _        |j                  | _        y N)funcattrname__doc__
__module__)selfr   s     G/root/tools/cai/cai_env/lib/python3.12/site-packages/textual/_compat.py__init__zcached_property.__init__   s&    DI DM<<DL"ooDO    c                    | j                   || _         y || j                   k7  rt        d| j                   d|d      y )Nz?Cannot assign the same cached_property to two different names (z and z).)r   	TypeError)r   ownernames      r   __set_name__zcached_property.__set_name__   sM    }}$ $&(dXR9  'r   Nc                     y r    r   instancer   s      r   __get__zcached_property.__get__#   s    SVr   c                     y r   r   r   s      r   r!   zcached_property.__get__&   s     r   c                   || S | j                   t        d      	 |j                  }|j                  | j                   t              }|t        u r#| j                  |      }	 ||| j                   <   |S |S # t        $ r3 dt	        |      j
                  d| j                   d}t        |      d w xY w# t        $ r3 dt	        |      j
                  d| j                   d}t        |      d w xY w)NzGCannot use cached_property instance without calling __set_name__ on it.zNo '__dict__' attribute on z instance to cache z
 property.zThe '__dict__' attribute on z7 instance does not support item assignment for caching )	r   r   __dict__AttributeErrortype__name__get
_NOT_FOUNDr   )r   r    r   cachemsgvals         r   r!   zcached_property.__get__+   s"    }}$] 	/ )) ))DMM:6Cj ii)3+.E$--( J3J% / 2$x.2I2I1L M))-(9E   n$./ ! 36tH~7N7N6Q RHHLGXXbd  $C.d23s   A6 #B5 6<B25<C1)r   zCallable[[Any, _T_co]]returnNone)r   z	type[any]r   strr-   r.   r   )r    r.   r   type[Any] | Noner-   Self)r    objectr   r0   r-   r   )r    r2   r   r0   r-   z_T_co | Self)r'   r   __qualname__r   r   r   r!   r   r   r   r
   r
      sl    	.	 
V 
V	>B	"	+;		 
	
 ?C	"	+;		r   r
   )
__future__r   systypingr   r   r   r   version_info	functoolsr
   r   r2   r)   r   r   r   <module>r9      sG    " 
 2 2w) Gt,EJ6'%. 6r   