B
    øoh\C  ã               @   s2   d dl mZ e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	   ú6lib/python3.7/site-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 k	st dƒ‚t|tjƒs$t dƒ‚|| _d S )Nzfget cannot be nonezfget must be callable)ÚAssertionErrorÚ
isinstancer   ÚCallabler   )r   r   r	   r	   r
   Ú__init__2   s    zNonDataProperty.__init__Nc             C   s   |d kr| S |   |¡S )N)r   )r   ÚobjZobjtyper	   r	   r
   r   7   s    zNonDataProperty.__get__)N)r   r   r   r   r   r   r	   r	   r	   r
   r      s   r   N)Z
py32compatr   ÚtypeZ__metaclass__Úpropertyr   r   r	   r	   r	   r
   Ú<module>   s   