3
\" ã @ sv d Z ddlmZ dd„ ZG dd„ deƒZG dd„ deƒZG d d
„ d
eƒZ G dd„ de
ƒZG d
d„ ded�Zdd„ Z
dS )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 ú/usr/lib64/python3.6/abc.pyÚabstractmethod s r c s$ e Zd ZdZdZ‡ fdd„Z‡ ZS )Ú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
Ú
__classcell__r r )r
r r s r c s$ e Zd ZdZdZ‡ fdd„Z‡ ZS )Ú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 r 5 s r c @ s e Zd ZdZdZdS )Ú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 sF e Zd ZdZdZ‡ fdd„Zdd„ Zddd „Zd
d„ Zdd
„ Z ‡ 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| |||f|Ž}dd„ |jƒ D ƒ}xF|D ]>}x8t|dtƒ ƒD ]&}t||d ƒ}t|ddƒrB|j|ƒ qBW q.W t|ƒ|_tƒ |_ tƒ |_
tƒ |_tj
|_|S )Nc S s h | ]\}}t |d dƒr|’qS )r F)Úgetattr)Ú.0ÚnameÚvaluer r r ú