B 31 @ s d Z dd ZG dd deZG dd deZG dd deZy,d d lm Z m Z mZmZm Z mZmZmZ W n* ek r d dlmZm Z de_Y nX G d d deZG dd dedZdS )z3Abstract Base Classes (ABCs) according to PEP 3119.c 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/python37/lib64/python3.7/abc.pyabstractmethod s r c s$ e Zd ZdZdZ fddZ ZS )abstractclassmethodaJ 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 | d S )NT)r super__init__)selfcallable) __class__r r r - s zabstractclassmethod.__init__)__name__ __module____qualname____doc__r r __classcell__r r )r r r s r c s$ e Zd ZdZdZ fddZ ZS )abstractstaticmethodaJ 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 | d S )NT)r r r )r r )r r r r D s zabstractstaticmethod.__init__)r r r r r r r r r )r r r 2 s r c @ s e Zd ZdZdZdS )abstractpropertyaf 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 I s r )get_cache_token _abc_init _abc_register_abc_instancecheck_abc_subclasscheck _get_dump_reset_registry _reset_caches)ABCMetar abcc sR e Zd ZdZ fddZdd Zdd Zdd ZdddZd d Z dd Z ZS )r a 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()). c s" t j| |||f|}t| |S )N)r __new__r )mclsnamebases namespacekwargscls)r r r r } s zABCMeta.__new__c C s t | |S )z{Register a virtual subclass of an ABC. Returns the subclass, to allow usage as a class decorator. )r )r$ subclassr r r register s zABCMeta.registerc C s t | |S )z'Override for isinstance(instance, cls).)r )r$ instancer r r __instancecheck__ s zABCMeta.__instancecheck__c C s t | |S )z'Override for issubclass(subclass, cls).)r )r$ r% r r r __subclasscheck__ s zABCMeta.__subclasscheck__Nc C s t d| j d| j |d t dt |d t| \}}}}t d||d t d||d t d||d t d||d d S ) z'Debug helper to print the ABC registry.zClass: .)filezInv. counter: z_abc_registry: z_abc_cache: z_abc_negative_cache: z_abc_negative_cache_version: N)printr r r r )r$ r+ _abc_registry _abc_cache_abc_negative_cache_abc_negative_cache_versionr r r _dump_registry s zABCMeta._dump_registryc C s t | dS )z.Clear the registry (for debugging or testing).N)r )r$ r r r _abc_registry_clear s zABCMeta._abc_registry_clearc C s t | dS )z,Clear the caches (for debugging or testing).N)r )r$ r r r _abc_caches_clear s zABCMeta._abc_caches_clear)N)r r r r r r&