Your IP : 3.15.15.91


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/abc.cpython-35.pyc



��Yf�!�@s�dZddlmZdd�ZGdd�de�ZGdd�de�ZGd	d
�d
e�Z	Gdd�de
�ZGd
d�dde�Zdd�Z
dS)z3Abstract Base Classes (ABCs) according to PEP 3119.�)�WeakSetcCs
d|_|S)a�A decorator indicating abstract methods.

    Requires that the metaclass is ABCMeta or derived from it.  A
    class that has a metaclass derived from ABCMeta cannot be
    instantiated unless all of its abstract methods are overridden.
    The abstract methods can be called using any of the normal
    'super' call mechanisms.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractmethod
            def my_abstract_method(self, ...):
                ...
    T)�__isabstractmethod__)�funcobj�r�(/opt/alt/python35/lib64/python3.5/abc.py�abstractmethod	s	rcs.eZdZdZdZ�fdd�Z�S)�abstractclassmethodaO
    A decorator indicating abstract classmethods.

    Similar to abstractmethod.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractclassmethod
            def my_abstract_classmethod(cls, ...):
                ...

    'abstractclassmethod' is deprecated. Use 'classmethod' with
    'abstractmethod' instead.
    Tcsd|_t�j|�dS)NT)r�super�__init__)�self�callable)�	__class__rrr
0s	zabstractclassmethod.__init__)�__name__�
__module__�__qualname__�__doc__rr
rr)r
rrsrcs.eZdZdZdZ�fdd�Z�S)�abstractstaticmethodaO
    A decorator indicating abstract staticmethods.

    Similar to abstractmethod.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractstaticmethod
            def my_abstract_staticmethod(...):
                ...

    'abstractstaticmethod' is deprecated. Use 'staticmethod' with
    'abstractmethod' instead.
    Tcsd|_t�j|�dS)NT)rr	r
)rr)r
rrr
Hs	zabstractstaticmethod.__init__)rrrrrr
rr)r
rr5src@seZdZdZdZdS)�abstractpropertyak
    A decorator indicating abstract properties.

    Requires that the metaclass is ABCMeta or derived from it.  A
    class that has a metaclass derived from ABCMeta cannot be
    instantiated unless all of its abstract properties are overridden.
    The abstract properties can be called using any of the normal
    'super' call mechanisms.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractproperty
            def my_abstract_property(self):
                ...

    This defines a read-only property; you can also define a read-write
    abstract property using the 'long' form of property declaration:

        class C(metaclass=ABCMeta):
            def getx(self): ...
            def setx(self, value): ...
            x = abstractproperty(getx, setx)

    'abstractproperty' is deprecated. Use 'property' with 'abstractmethod'
    instead.
    TN)rrrrrrrrrrMsrcsaeZdZdZdZ�fdd�Zdd�Zddd	�Zd
d�Zdd
�Z	�S)�ABCMetaaiMetaclass for defining Abstract Base Classes (ABCs).

    Use this metaclass to create an ABC.  An ABC can be subclassed
    directly, and then acts as a mix-in class.  You can also register
    unrelated concrete classes (even built-in classes) and unrelated
    ABCs as 'virtual subclasses' -- these and their descendants will
    be considered subclasses of the registering ABC by the built-in
    issubclass() function, but the registering ABC won't show up in
    their MRO (Method Resolution Order) nor will method
    implementations defined by the registering ABC be callable (not
    even via super()).

    rcs�t�j||||�}dd�|j�D�}x_|D]W}xNt|dt��D]7}t||d�}t|dd�rW|j|�qWWq;Wt|�|_t�|_	t�|_
t�|_tj
|_|S)NcSs.h|]$\}}t|dd�r|�qS)rF)�getattr)�.0�name�valuerrr�	<setcomp>�s		z"ABCMeta.__new__.<locals>.<setcomp>�__abstractmethods__rF)r	�__new__�itemsr�set�add�	frozensetrr�
_abc_registry�
_abc_cache�_abc_negative_cacher�_abc_invalidation_counter�_abc_negative_cache_version)�mclsr�bases�	namespace�cls�	abstracts�baser)r
rrr�s	
zABCMeta.__new__cCslt|t�std��t||�r.|St||�rItd��|jj|�tjd7_|S)zsRegister a virtual subclass of an ABC.

        Returns the subclass, to allow usage as a class decorator.
        zCan only register classesz'Refusing to create an inheritance cycle�)	�
isinstance�type�	TypeError�
issubclass�RuntimeErrorr rrr#)r(�subclassrrr�register�szABCMeta.registerNcCs�td|j|jfd|�tdtjd|�xUt|jj��D]>}|jd�rMt	||�}td||fd|�qMWdS)z'Debug helper to print the ABC registry.zClass: %s.%s�filezInv.counter: %s�_abc_z%s: %rN)
�printrrrr#�sorted�__dict__�keys�
startswithr)r(r3rrrrr�_dump_registry�s zABCMeta._dump_registrycs�|j}|�jkrdSt|�}||krf�jtjkrY|�jkrYdS�j|�St�fdd�||hD��S)z'Override for isinstance(instance, cls).TFc3s|]}�j|�VqdS)N)�__subclasscheck__)r�c)r(rr�	<genexpr>�sz,ABCMeta.__instancecheck__.<locals>.<genexpr>)	r
r!r-r$rr#r"r;�any)r(�instancer1�subtyper)r(r�__instancecheck__�s	
zABCMeta.__instancecheck__cCsa||jkrdS|jtjkr@t�|_tj|_n||jkrSdS|j|�}|tk	r�t|t	�s�t
�|r�|jj|�n|jj|�|S|t|df�kr�|jj|�dSx4|j
D])}t||�r�|jj|�dSq�Wx7|j�D])}t||�r |jj|�dSq W|jj|�dS)z'Override for issubclass(subclass, cls).TF�__mro__)r!r$rr#rr"�__subclasshook__�NotImplementedr,�bool�AssertionErrorrrr r/�__subclasses__)r(r1�ok�rcls�sclsrrrr;�s6zABCMeta.__subclasscheck__)
rrrrr#rr2r:rAr;rr)r
rrms	rc@seZdZdZdS)�ABCzVHelper class that provides a standard way to create an ABC using
    inheritance.
    N)rrrrrrrrrK�srK�	metaclasscCstjS)z�Returns the current ABC cache token.

    The token is an opaque object (supporting equality testing) identifying the
    current version of the ABC cache for virtual subclasses. The token changes
    with every call to ``register()`` on any ABC.
    )rr#rrrr�get_cache_token�srMN)r�_weakrefsetrr�classmethodr�staticmethodr�propertyrr-rrKrMrrrr�<module>s }

?>