
    k7i.                     ,     " S  S5      r  " S S5      rg)c                   (    \ rS rSrSrS rSS jrSrg)NonDataProperty   aO  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
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)selfr   s     S/home/james-whalen/.local/lib/python3.13/site-packages/keyring/compat/properties.py__init__NonDataProperty.__init__   s-    6!66~~666~	    Nc                 .    Uc  U $ U R                  U5      $ Nr   )r   objobjtypes      r	   __get__NonDataProperty.__get__   s    ;Kyy~r   r   r   )__name__
__module____qualname____firstlineno____doc__r
   r   __static_attributes__ r   r	   r   r      s    $
r   r   c                   ^    \ rS rSrSr " S S\5      rSS jrSS jrS r	S	 r
\S
 5       rSrg)classproperty"   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
c                   (   ^  \ rS rSrU 4S 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   __set__super__setattr__)r   keyvaluer   	__class__s       r	   r'   classproperty.Meta.__setattr__   sD    --##C.CCyM){{4//7&s22r   r   )r   r   r   r   r'   r   __classcell__)r*   s   @r	   Metar      s    	3 	3r   r-   Nc                 t    U R                  U5      U l        X l        U=(       a    U R                  U5        g   g r   )_ensure_methodr   fsetsetter)r   r   r0   s      r	   r
   classproperty.__init__   s-    ''-		"T""r   c                 D    U R                   R                  S U5      " 5       $ r   )r   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 U5      " U5      $ )Nzcan't set attribute)r0   AttributeErrorr$   r   r-   r   )r   r5   r)   s      r	   r%   classproperty.__set__   sL    yy !677;m000KEyy  u-e44r   c                 2    U R                  U5      U l        U $ r   )r/   r0   )r   r0   s     r	   r1   classproperty.setter   s    ''-	r   c                 `    [        U[        [        45      (       + nU(       a  [        U5      $ U$ )z-
Ensure fn is a classmethod or staticmethod.
)
isinstanceclassmethodstaticmethod)clsfnneeds_methods      r	   r/   classproperty._ensure_method   s)    
 &b;*EFF".{26B6r   )r   r0   r   )r   r   r   r   r   r$   r-   r
   r   r%   r1   r>   r/   r   r   r   r	   r   r   "   s=    dL3t 3#
05 7 7r   r   N)r   r   r   r   r	   <module>rD      s    <G7 G7r   