U e5d-@s(ddlmZddZGdddeZdS))WeakSetcCstjS)zReturns 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. )ABCMeta_abc_invalidation_counterrr/usr/lib64/python3.8/_py_abc.pyget_cache_tokensrcsVeZdZdZdZfddZddZddd Zd d Zd d Z ddZ ddZ Z S)rahMetaclass 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()). rc  stj||||f|}dd|D}|D]:}t|dtD]&}t||d}t|ddr>||q>q,t||_t|_ t|_ t|_ t j |_|S)NcSs h|]\}}t|ddr|qS)__isabstractmethod__F)getattr).0namevaluerrr &s z"ABCMeta.__new__..__abstractmethods__rF)super__new__itemsr setadd frozensetrr _abc_registry _abc_cache_abc_negative_cacherr_abc_negative_cache_version) mclsr bases namespacekwargsclsZ abstractsbaser  __class__rrr#s   zABCMeta.__new__cCsPt|tstdt||r |St||r2td|j|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) isinstancetype TypeError issubclass RuntimeErrorrrrr)rsubclassrrrregister6s    zABCMeta.registerNcCs|td|jd|j|dtdt|d|jD]@}|dr6t||}t|tr`t |}t|d||dq6dS)z'Debug helper to print the ABC registry.zClass: .)filezInv. counter: Z_abc_z: N) print __module__ __qualname__r__dict__ startswithr r"rr)rr*r r rrr_dump_registryHs    zABCMeta._dump_registrycCs|jdS)z.Clear the registry (for debugging or testing).N)rclearrrrr_abc_registry_clearSszABCMeta._abc_registry_clearcCs|j|jdS)z,Clear the caches (for debugging or testing).N)rr1rr2rrr_abc_caches_clearWs zABCMeta._abc_caches_clearcsb|j}|jkrdSt|}||krHjtjkr>|jkr>dS|Stfdd||fDS)z'Override for isinstance(instance, cls).TFc3s|]}|VqdS)N)__subclasscheck__)r cr2rr jsz,ABCMeta.__instancecheck__..) r rr#rrrrr5any)rinstancer'Zsubtyperr2r__instancecheck__\s  zABCMeta.__instancecheck__cCst|tstd||jkr dS|jtjkr>t|_tj|_n||jkrLdS| |}|t k rt|t slt |r~|j |n |j ||S|t|ddkr|j |dS|jD] }t||r|j |dSq|D] }t||r|j |dSq|j |dS)z'Override for issubclass(subclass, cls).z"issubclass() arg 1 must be a classTF__mro__r)r"r#r$rrrrrr__subclasshook__NotImplementedboolAssertionErrorrr rr%__subclasses__)rr'okZrclsZsclsrrrr5ls:               zABCMeta.__subclasscheck__)N) __name__r,r-__doc__rrr(r0r3r4r:r5 __classcell__rrrrrs  rN)Z _weakrefsetrrr#rrrrrs