o
    ÞñÐa-  ã                   @   s.   d dl mZ G dd„ deƒZG dd„ dƒZdS )é    )Úabcc                   @   s   e Zd ZdZdd„ ZdS )ÚClassPropertya™  
    An implementation of a property callable on a class. Used to decorate a
    classmethod but to then treat it like a property.

    Example:

    >>> class MyClass:
    ...    @ClassProperty
    ...    @classmethod
    ...    def skillz(cls):
    ...        return cls.__name__.startswith('My')
    >>> MyClass.skillz
    True
    >>> class YourClass(MyClass): pass
    >>> YourClass.skillz
    False
    c                 C   s   | j  d |¡ƒ S ©N)ÚfgetÚ__get__)ÚselfÚclsÚowner© r
   ú9/usr/lib/python3/dist-packages/keyring/util/properties.pyr      s   zClassProperty.__get__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r
   r
   r
   r   r      s    r   c                   @   s"   e Zd ZdZdd„ Zddd„ZdS )Ú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:
    ...   @NonDataProperty
    ...   def foo(self):
    ...     return 3
    >>> x = X()
    >>> x.foo
    3
    >>> x.foo = 4
    >>> x.foo
    4
    c                 C   s.   |d usJ dƒ‚t |tjƒsJ dƒ‚|| _d S )Nzfget cannot be nonezfget must be callable)Ú
isinstancer   ÚCallabler   )r   r   r
   r
   r   Ú__init__1   s   
zNonDataProperty.__init__Nc                 C   s   |d u r| S |   |¡S r   )r   )r   ÚobjÚobjtyper
   r
   r   r   6   s   
zNonDataProperty.__get__r   )r   r   r   r   r   r   r
   r
   r
   r   r      s    r   N)Úcollectionsr   Úpropertyr   r   r
   r
   r
   r   Ú<module>   s    