Your IP : 18.222.118.236
�
e f�! � @ s� d Z d d l m Z d d � Z Gd d � d e � Z Gd d � d e � Z Gd d
� d
e � Z Gd d � d e
� Z Gd
d � d d e �Z d d � Z
d S)z3Abstract Base Classes (ABCs) according to PEP 3119.� )�WeakSetc C s
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/python34/lib64/python3.4/abc.py�abstractmethod s r c s. e Z d Z d Z d Z � f d d � 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.
Tc s d | _ t � j | � d S)NT)r �super�__init__)�self�callable)� __class__r r r
0 s zabstractclassmethod.__init__)�__name__�
__module__�__qualname__�__doc__r r
r r )r
r r s r c s. e Z d Z d Z d Z � f d d � 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.
Tc s d | _ t � j | � d S)NT)r r r
)r r )r
r r r
H s zabstractstaticmethod.__init__)r r r r r r
r r )r
r r 5 s r c @ s e Z d Z d Z d Z d S)�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)r r r r r r r r r r M s r c sa e Z d Z d Z d Z � f d d � Z d d � Z d d d � Z d
d � Z d d
� Z � S)�ABCMetaai Metaclass 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()).
r c s� t � j | | | | � } d d � | j � D� } xb | D]Z } xQ t | d t � � D]: } t | | d � } t | d d � rW | j | � qW qW Wq; Wt | � | _ t � | _ t � | _
t � | _ t j
| _ | S)Nc S s. h | ]$ \ } } t | d d � r | � q S)r F)�getattr)�.0�name�valuer r r � <setcomp>� s z"ABCMeta.__new__.<locals>.<setcomp>�__abstractmethods__r F)r �__new__�itemsr �set�add� frozensetr r �
_abc_registry�
_abc_cache�_abc_negative_cacher �_abc_invalidation_counter�_abc_negative_cache_version)�mclsr �bases� namespace�cls� abstracts�baser )r
r r r � s
zABCMeta.__new__c C sr t | t � s t d � � n t | | � r1 | St | | � rO t d � � n | j j | � t j d 7_ | 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 r r r# )r( �subclassr r r �register� s zABCMeta.registerNc C s� t d | j | j f d | �t d t j d | �xX t | j j � � D]A } | j d � rM t | | � } t d | | f d | �qM qM Wd S)z'Debug helper to print the ABC registry.zClass: %s.%s�filezInv.counter: %s�_abc_z%s: %rN)
�printr r r r# �sorted�__dict__�keys�
startswithr )r( r3 r r r r r �_dump_registry� s zABCMeta._dump_registryc s� | j } | � j k r d St | � } | | k rf � j t j k rY | � j k rY d S� j | � St � f d d � | | h D� � S)z'Override for isinstance(instance, cls).TFc 3 s | ] } � j | � Vq d S)N)�__subclasscheck__)r �c)r( r r � <genexpr>� s z,ABCMeta.__instancecheck__.<locals>.<genexpr>) r
r! r- r$ r r# r"