
    '<i/                    F   U d dl mZ d dlmZmZmZmZmZ  ed      Z ed      Z	er\d dl
mZ d dlmZmZ d dlmZmZ edef   Zd	ed
<   eeg ef   Zd	ed<   eee   egdf   Zd	ed<   eeegdf   Zd	ed<    G d dee         Z G d deee	f         Z G d dee         Zy)    )annotations)TYPE_CHECKINGGenericTypeVarcastoverload_T_U)Callable)AnyProtocol)Self	TypeAlias.r   _GetterCallable_GetterClassMethodN_SetterCallable_SetterClassMethodc                      e Zd ZdddZddZy)_ClassPropertyAttributeNc                     y N selfobjobjtypes      /home/jay/workspace/.worktrees/task-2057-dev2/scripts/.codegraph-venv/lib/python3.12/site-packages/jaraco/classes/properties.py__get__z_ClassPropertyAttribute.__get__           c                     y r   r   )r   r   values      r   __set__z_ClassPropertyAttribute.__set__   r   r    r   )r   objectr   ztype[Any] | Nonereturnr	   )r   r$   r"   r	   r%   None)__name__
__module____qualname__r   r#   r   r    r   r   r      s    S>r    r   c                  l    e Zd ZdZddZe	 	 	 	 	 	 dd       Ze	 d		 	 	 	 	 d
d       Z	 d		 	 	 	 	 ddZy)NonDataPropertya  Much like the property builtin, but only implements __get__,
    making it a non-data property, and can be subsequently reset.

    See http://users.rcn.com/python/download/Descriptor.htm for more
    information.

    >>> class X(object):
    ...   @NonDataProperty
    ...   def foo(self):
    ...     return 3
    >>> x = X()
    >>> x.foo
    3
    >>> x.foo = 4
    >>> x.foo
    4

    '...' below should be 'jaraco.classes' but for pytest-dev/pytest#3396
    >>> X.foo
    <....properties.NonDataProperty object at ...>
    c                H    |J d       t        |      sJ d       || _        y )Nzfget cannot be nonezfget must be callable)callablefget)r   r.   s     r   __init__zNonDataProperty.__init__2   s-    6!66~666~	r    c                     y r   r   r   s      r   r   zNonDataProperty.__get__7   s    
 r    Nc                     y r   r   r   s      r   r   zNonDataProperty.__get__>   s    
 r    c                ,    || S | j                  |      S r   )r.   r   s      r   r   zNonDataProperty.__get__E   s    
 ;Kyy~r    )r.   zCallable[[_T], _U]r%   r&   )r   r&   r   r&   r%   r   r   )r   r	   r   type[_T] | Noner%   r
   )r   z	_T | Noner   r3   r%   z	Self | _U)r'   r(   r)   __doc__r/   r   r   r   r    r   r+   r+      s    ,
   
	   $( ! 
	  $( ! 
	r    r+   c                      e Zd ZU dZded<   ded<    G d de      Z	 d	 	 	 	 	 dd	Zddd
ZddZ	ddZ
ee	 	 	 	 dd              Zee	 	 	 	 dd              Ze	 	 	 	 dd       Zy)classpropertya  
    Like @property but applies at the class level.


    >>> class X(metaclass=classproperty.Meta):
    ...   val = None
    ...   @classproperty
    ...   def foo(cls):
    ...     return cls.val
    ...   @foo.setter
    ...   def foo(cls, val):
    ...     cls.val = val
    >>> X.foo
    >>> X.foo = 3
    >>> X.foo
    3
    >>> x = X()
    >>> x.foo
    3
    >>> X.foo = 4
    >>> x.foo
    4

    Setting the property on an instance affects the class.

    >>> x.foo = 5
    >>> x.foo
    5
    >>> X.foo
    5
    >>> vars(x)
    {}
    >>> X().foo
    5

    Attempting to set an attribute where no setter was defined
    results in an AttributeError:

    >>> class GetOnly(metaclass=classproperty.Meta):
    ...   @classproperty
    ...   def foo(cls):
    ...     return 'bar'
    >>> GetOnly.foo = 3
    Traceback (most recent call last):
    ...
    AttributeError: can't set attribute

    It is also possible to wrap a classmethod or staticmethod in
    a classproperty.

    >>> class Static(metaclass=classproperty.Meta):
    ...   @classproperty
    ...   @classmethod
    ...   def foo(cls):
    ...     return 'foo'
    ...   @classproperty
    ...   @staticmethod
    ...   def bar():
    ...     return 'bar'
    >>> Static.foo
    'foo'
    >>> Static.bar
    'bar'

    *Legacy*

    For compatibility, if the metaclass isn't specified, the
    legacy behavior will be invoked.

    >>> class X:
    ...   val = None
    ...   @classproperty
    ...   def foo(cls):
    ...     return cls.val
    ...   @foo.setter
    ...   def foo(cls, val):
    ...     cls.val = val
    >>> X.foo
    >>> X.foo = 3
    >>> X.foo
    3
    >>> x = X()
    >>> x.foo
    3
    >>> X.foo = 4
    >>> x.foo
    4

    Note, because the metaclass was not specified, setting
    a value on an instance does not have the intended effect.

    >>> x.foo = 5
    >>> x.foo
    5
    >>> X.foo  # should be 5
    4
    >>> vars(x)  # should be empty
    {'foo': 5}
    >>> X().foo  # should be 5
    4
    z/_ClassPropertyAttribute[_GetterClassMethod[_T]]r.   z6_ClassPropertyAttribute[_SetterClassMethod[_T] | None]fsetc                        e Zd Zd fdZ xZS )classproperty.Metac                    | j                   j                  |d       }t        |      t        u r|j	                  | |      S t
        |   ||      S r   )__dict__gettyper6   r#   super__setattr__)r   keyr"   r   	__class__s       r   r?   zclassproperty.Meta.__setattr__   sH    --##C.CCyM){{4//7&sE22r    )r@   strr"   r$   r%   r&   )r'   r(   r)   r?   __classcell__)rA   s   @r   Metar9      s    	3 	3r    rD   Nc                l    | j                  |      | _        || _        |xr | j                  |       y  y r   )_ensure_methodr.   r7   setter)r   r.   r7   s      r   r/   zclassproperty.__init__   s1    
 ''-		"T""r    c                D     | j                   j                  d |             S r   )r.   r   )r   instanceowners      r   r   zclassproperty.__get__   s    -tyy  u-//r    c                    | j                   st        d      t        |      t        j                  urt        |      } | j                   j                  d t        d|            |      S )Nzcan't set attributeztype[object])r7   AttributeErrorr=   r6   rD   r   r   )r   rJ   r"   s      r   r#   zclassproperty.__set__   sU    yy !677;m000KECtyy  tNE'BCEJJr    c                2    | j                  |      | _        | S r   )rF   r7   )r   r7   s     r   rG   zclassproperty.setter   s    ''-	r    c                     y r   r   clsfns     r   rF   zclassproperty._ensure_method       
 "%r    c                     y r   r   rO   s     r   rF   zclassproperty._ensure_method   rR   r    c                N    t        |t        t        f       }|rt        |      S |S )z=
        Ensure fn is a classmethod or staticmethod.
        )
isinstanceclassmethodstaticmethod)rP   rQ   needs_methods      r   rF   zclassproperty._ensure_method   s)     &b;*EFF".{26B6r    r   )r.   ,_GetterCallable[_T] | _GetterClassMethod[_T]r7   z3_SetterCallable[_T] | _SetterClassMethod[_T] | Noner%   r&   )rI   r$   rJ   ztype[object] | Noner%   r	   )rJ   r$   r"   r	   r%   r&   )r7   ,_SetterCallable[_T] | _SetterClassMethod[_T]r%   r   )rQ   rY   r%   z_GetterClassMethod[_T])rQ   rZ   r%   z_SetterClassMethod[_T])rQ   z[_GetterCallable[_T] | _GetterClassMethod[_T] | _SetterCallable[_T] | _SetterClassMethod[_T]r%   z/_GetterClassMethod[_T] | _SetterClassMethod[_T])r'   r(   r)   r4   __annotations__r=   rD   r/   r   r#   rG   r   rV   rF   r   r    r   r6   r6   O   s    dL :9
@@3t 3 EI#:# B# 
	#0K %8% 
 %  %
 %8% 
 %  %
 7!7 
97 7r    r6   )
__future__r   typingr   r   r   r   r   r	   r
   collections.abcr   r   r   typing_extensionsr   r   r   r[   rV   r   r=   r   r   r   r+   r6   r   r    r   <module>r`      s    " B BT]T]($1 "*#r'!2OY2$/R$<	<!)49b/4*?!@OY@$/bT4$@	@?(2, ?1gb"fo 1hb7GBK b7r    