Yf_" @sdZddlZddZeeZeddZeejZeejZ eej Z ddZ ee Z d d ZeZeeZejGd d d ZeejZeeZegjZeeZy eWnFek rMejd ZeeZeejZdZ[YnXeejZeej Z![[[ [[fddddZ"fdddZ#ddZ$GdddZ%ddl&Z'ddl(j)Z*GdddZ+ddZ,dde-DZ.dS)zO Define names for built-in types that aren't directly accessible as a builtin. NcCsdS)Nrrr*/opt/alt/python35/lib64/python3.5/types.py_f srcCsdS)Nrrrrr srccs dVdS)Nrrrrr_gsrcsdS)Nrrrrr_csrc@seZdZddZdS)_CcCsdS)Nr)selfrrr_msz_C._mN)__name__ __module__ __qualname__r rrrrr s r cCsDt|||\}}}|dk r1|||||||S)zBCreate a class object dynamically using the appropriate metaclass.N) prepare_class)namebaseskwds exec_bodymetansrrr new_class4s  rcCs|dkri}n t|}d|kr?|jd}n|rXt|d}nt}t|tr|t||}t|dr|j|||}ni}|||fS)azCall the __prepare__ method of the appropriate metaclass. Returns (metaclass, namespace, kwds) as a 3-tuple *metaclass* is the appropriate metaclass *namespace* is the prepared class namespace *kwds* is an updated copy of the passed in kwds argument with any 'metaclass' entry removed. If no kwds argument is passed in, this will be an empty dict. N metaclassr __prepare__)dictpoptype isinstance_calculate_metahasattrr)rrrrrrrrr;s    rcCs]|}xP|D]H}t|}t||r1q t||rI|}q tdq W|S)z%Calculate the most derived metaclass.zxmetaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases)r issubclass TypeError)rrwinnerbase base_metarrrr[s  rc@syeZdZdZddddddZdddZddZd d Zd d Zd dZ ddZ dS)DynamicClassAttributeaRoute attribute access on a class to __getattr__. This is a descriptor, used to define attributes that act differently when accessed through an instance and through a class. Instance access remains normal, but access to an attribute through a class will be routed to the class's __getattr__ method; this is done by raising AttributeError. This allows one to have properties active on an instance, and have virtual attributes on the class with the same name (see Enum for an example). NcCs[||_||_||_|p'|j|_|dk|_tt|dd|_dS)N__isabstractmethod__F)fgetfsetfdel__doc__ overwrite_docboolgetattrr&)r r'r(r)docrrr__init__xs    zDynamicClassAttribute.__init__cCsM|dkr%|jr|Stn|jdkr@td|j|S)Nzunreadable attribute)r&AttributeErrorr')r instance ownerclassrrr__get__s    zDynamicClassAttribute.__get__cCs/|jdkrtd|j||dS)Nzcan't set attribute)r(r0)r r1valuerrr__set__s zDynamicClassAttribute.__set__cCs,|jdkrtd|j|dS)Nzcan't delete attribute)r)r0)r r1rrr __delete__s z DynamicClassAttribute.__delete__cCsR|jr|jnd}t|||j|j|p<|j}|j|_|S)N)r+r*rr(r))r r'fdocresultrrrgetters* zDynamicClassAttribute.gettercCs4t||j||j|j}|j|_|S)N)rr'r)r*r+)r r(r8rrrsetters$ zDynamicClassAttribute.settercCs4t||j|j||j}|j|_|S)N)rr'r(r*r+)r r)r8rrrdeleters$ zDynamicClassAttribute.deleter) r r rr*r/r3r5r6r9r:r;rrrrr%ls      r%c@seZdZddZddZddZddZed d Zed d Z ed dZ eddZ eZ e Z e Ze ZddZddZeZdS)_GeneratorWrappercCsI||_|jtk|_t|dd|_t|dd|_dS)Nr r)_GeneratorWrapper__wrapped __class__ GeneratorType_GeneratorWrapper__isgenr-r r)r genrrrr/s z_GeneratorWrapper.__init__cCs|jj|S)N)r=send)r valrrrrBsz_GeneratorWrapper.sendcGs|jj||S)N)r=throw)r tprestrrrrDsz_GeneratorWrapper.throwcCs |jjS)N)r=close)r rrrrGsz_GeneratorWrapper.closecCs |jjS)N)r=gi_code)r rrrrHsz_GeneratorWrapper.gi_codecCs |jjS)N)r=gi_frame)r rrrrIsz_GeneratorWrapper.gi_framecCs |jjS)N)r= gi_running)r rrrrJsz_GeneratorWrapper.gi_runningcCs |jjS)N)r= gi_yieldfrom)r rrrrKsz_GeneratorWrapper.gi_yieldfromcCs t|jS)N)nextr=)r rrr__next__sz_GeneratorWrapper.__next__cCs|jr|jS|S)N)r@r=)r rrr__iter__s z_GeneratorWrapper.__iter__N)r r rr/rBrDrGpropertyrHrIrJrKcr_codecr_frame cr_runningcr_awaitrMrN __await__rrrrr<s       r<cststdjtkrtddjtkrjj}|d@r\S|d@rj}t|j|j |j |j |jdB|j |j |j|j|j|j|j|j|j|j_Stjfdd}|S) z2Convert regular generator function to a coroutine.z$types.coroutine() expects a callable__code__Ni cst||}|jtks=|jtkrA|jjd@rA|St|tjrpt|tj rpt |S|S)NrW) r> CoroutineTyper?rHco_flagsr_collections_abc Generator Coroutiner<)argskwargscoro)funcrrwrappeds zcoroutine..wrapped)callabler!r> FunctionTyper-CodeTyperUrY co_argcountco_kwonlyargcount co_nlocals co_stacksizeco_code co_constsco_names co_varnames co_filenameco_nameco_firstlineno co_lnotab co_freevars co_cellvars _functoolswraps)r`rYcorar)r`r coroutines(       !rvcCs,g|]"}|dddkr|qS)Nr_r).0nrrr s rz)/r*sysrrrc LambdaTyperUrd__dict__MappingProxyTypeimplementationSimpleNamespacerr?rrXrGr r MethodTypelenBuiltinFunctionTypeappendBuiltinMethodType ModuleTyper!exc_infotb TracebackTypetb_frame FrameTypeGetSetDescriptorType __globals__MemberDescriptorTyperrrr% functoolsrscollections.abcabcrZr<rvglobals__all__rrrrsL              : % 7