
    k7i/                    P   % S SK Jr  S SKJrJrJrJrJr  \" S5      r\" S5      r	\(       a\  S SK
Jr  S SKJrJr  S SKJrJr  \S\4   rS	\S
'   \\/ \4   rS	\S'   \\\   \/S4   rS	\S'   \\\/S4   rS	\S'    " S S\\   5      r " S S\\\	4   5      r " S S\\   5      rg)    )annotations)TYPE_CHECKINGGenericTypeVarcastoverload_T_U)Callable)AnyProtocol)Self	TypeAlias.r   _GetterCallable_GetterClassMethodN_SetterCallable_SetterClassMethodc                  ,    \ rS rSrSSS jjrSS jrSrg)	_ClassPropertyAttribute   Nc                    g N selfobjobjtypes      S/home/james-whalen/.local/lib/python3.13/site-packages/jaraco/classes/properties.py__get___ClassPropertyAttribute.__get__   s    PS    c                    g r   r   )r   r   values      r   __set___ClassPropertyAttribute.__set__   s    3r!   r   r   )r   objectr   ztype[Any] | Nonereturnr	   )r   r&   r#   r	   r'   None)__name__
__module____qualname____firstlineno__r   r$   __static_attributes__r   r!   r   r   r      s    S>r!   r   c                      \ rS rSrSrS	S jr\      S
S j5       r\ S     SS jj5       r S     SS jjrSrg)NonDataProperty   a  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                R    Uc   S5       e[        U5      (       d   S5       eXl        g )Nzfget cannot be nonezfget must be callable)callablefget)r   r3   s     r   __init__NonDataProperty.__init__2   s-    6!66~~666~	r!   c                    g r   r   r   s      r   r   NonDataProperty.__get__7   s    
 r!   Nc                    g r   r   r   s      r   r   r7   >   s    
 r!   c                .    Uc  U $ U R                  U5      $ r   r3   r   s      r   r   r7   E   s    
 ;Kyy~r!   r:   )r3   zCallable[[_T], _U]r'   r(   )r   r(   r   r(   r'   r   r   )r   r	   r   type[_T] | Noner'   r
   )r   z	_T | Noner   r;   r'   z	Self | _U)	r)   r*   r+   r,   __doc__r4   r   r   r-   r   r!   r   r/   r/      s    ,
   
	   $( ! 
	  $( ! 
	 r!   r/   c                      \ rS rSr% SrS\S'   S\S'    " S S\5      r S     SS
 jjrSSS jjr	SS jr
SS jr\\    SS j5       5       r\\    SS j5       5       r\    SS j5       rSrg	)classpropertyO   a~  
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]]r3   z6_ClassPropertyAttribute[_SetterClassMethod[_T] | None]fsetc                  ,   ^  \ rS rSrSU 4S jjrSrU =r$ )classproperty.Meta   c                   > U R                   R                  US 5      n[        U5      [        L a  UR	                  X5      $ [
        TU ]  X5      $ r   )__dict__gettyper>   r$   super__setattr__)r   keyr#   r   	__class__s       r   rI   classproperty.Meta.__setattr__   sD    --##C.CCyM){{4//7&s22r!   r   )rJ   strr#   r&   r'   r(   )r)   r*   r+   r,   rI   r-   __classcell__)rK   s   @r   MetarB      s    	3 	3r!   rO   Nc                t    U R                  U5      U l        X l        U=(       a    U R                  U5        g   g r   )_ensure_methodr3   r@   setter)r   r3   r@   s      r   r4   classproperty.__init__   s/    
 ''-		"T""r!   c                D    U R                   R                  S U5      " 5       $ r   )r3   r   )r   instanceowners      r   r   classproperty.__get__   s    yy  u-//r!   c                    U R                   (       d  [        S5      e[        U5      [        R                  La  [        U5      nU R                   R                  S [        SU5      5      " U5      $ )Nzcan't set attributeztype[object])r@   AttributeErrorrG   r>   rO   r   r   )r   rV   r#   s      r   r$   classproperty.__set__   sS    yy !677;m000KEyy  tNE'BCEJJr!   c                2    U R                  U5      U l        U $ r   )rQ   r@   )r   r@   s     r   rR   classproperty.setter   s    ''-	r!   c                    g r   r   clsfns     r   rQ   classproperty._ensure_method       
 "%r!   c                    g r   r   r^   s     r   rQ   ra      rb   r!   c                `    [        U[        [        45      (       + nU(       a  [        U5      $ U$ )z-
Ensure fn is a classmethod or staticmethod.
)
isinstanceclassmethodstaticmethod)r_   r`   needs_methods      r   rQ   ra      s)     &b;*EFF".{26B6r!   )r3   r@   r   )r3   ,_GetterCallable[_T] | _GetterClassMethod[_T]r@   z3_SetterCallable[_T] | _SetterClassMethod[_T] | Noner'   r(   )rU   r&   rV   ztype[object] | Noner'   r	   )rV   r&   r#   r	   r'   r(   )r@   ,_SetterCallable[_T] | _SetterClassMethod[_T]r'   r   )r`   ri   r'   z_GetterClassMethod[_T])r`   rj   r'   z_SetterClassMethod[_T])r`   z[_GetterCallable[_T] | _GetterClassMethod[_T] | _SetterCallable[_T] | _SetterClassMethod[_T]r'   z/_GetterClassMethod[_T] | _SetterClassMethod[_T])r)   r*   r+   r,   r<   __annotations__rG   rO   r4   r   r$   rR   r   rf   rQ   r-   r   r!   r   r>   r>   O   s    dL :9
@@3t 3 EI#:# B# 
	#0K %8% 
 %  %
 %8% 
 %  %
 7!7 
97 7r!   r>   )
__future__r   typingr   r   r   r   r   r	   r
   collections.abcr   r   r   typing_extensionsr   r   r   rk   rf   r   rG   r   r   r   r/   r>   r   r!   r   <module>rp      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!   