3 \@sdaddZddZiZiZGdddeZGdddZGd d d ZGd d d Z d dZ ddZ ddZ ddddZ ddZddZddZddZGdd d ZGd!d"d"Zddd#d$d%Zd\d&d'Zd(d)d*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7ZGd8d9d9ZGd:d;d;ZGdd?Z d@dAZ!d]dBdCZ"dDdEZ#dFZ$e$dGZ%dHdIZ&e'Z(dJdKZ)d^dMdNZ*d(dOdPdQZ+dRdSZ,ddfdLfdTdUZ-dVdWZ.dXdYZ/dZd[Z0dS)_NcCs<x(dD] }t||rt||t||qW|jj|jdS)N __module____name__ __qualname____doc__)rrrr)hasattrsetattrgetattr__dict__update)newoldreplacer ,/usr/lib64/python3.6/importlib/_bootstrap.py_wraps  rcCs tt|S)N)typesys)namer r r _new_module#src@s eZdZdS)_DeadlockErrorN)rrrr r r rr0src@s4eZdZddZddZddZddZd d Zd S) _ModuleLockcCs0tj|_tj|_||_d|_d|_d|_dS)N)_thread allocate_locklockwakeuprownercountwaiters)selfrr r r__init__:s   z_ModuleLock.__init__cCs@tj}|j}x,tj|}|dkr&dS|j}||krdSqWdS)NFT)r get_identr _blocking_onget)rmetidrr r r has_deadlockBs z_ModuleLock.has_deadlockcCstj}|t|<zx|j`|jdks0|j|krH||_|jd7_dS|jr\td||jj drv|j d7_ WdQRX|jj |jj qWWdt|=XdS)NrTzdeadlock detected by %rF) rr r!rrrr%rracquirerrelease)rr$r r rr'Ns    z_ModuleLock.acquirec Csltj}|jT|j|kr"td|jd8_|jdkr^d|_|jr^|jd8_|jjWdQRXdS)Nzcannot release un-acquired lockr&r) rr rr RuntimeErrorrrrr()rr$r r rr(gs  z_ModuleLock.releasecCsdj|jt|S)Nz_ModuleLock({!r}) at {})formatrid)rr r r__repr__tsz_ModuleLock.__repr__N)rrrrr%r'r(r,r r r rr4s   rc@s,eZdZddZddZddZddZd S) _DummyModuleLockcCs||_d|_dS)Nr)rr)rrr r rr|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr&T)r)rr r rr'sz_DummyModuleLock.acquirecCs$|jdkrtd|jd8_dS)Nrzcannot release un-acquired lockr&)rr))rr r rr(s z_DummyModuleLock.releasecCsdj|jt|S)Nz_DummyModuleLock({!r}) at {})r*rr+)rr r rr,sz_DummyModuleLock.__repr__N)rrrrr'r(r,r r r rr-xsr-c@s$eZdZddZddZddZdS)_ModuleLockManagercCs||_d|_dS)N)_name_lock)rrr r rrsz_ModuleLockManager.__init__cCst|j|_|jjdS)N)_get_module_lockr/r0r')rr r r __enter__s z_ModuleLockManager.__enter__cOs|jjdS)N)r0r()rargskwargsr r r__exit__sz_ModuleLockManager.__exit__N)rrrrr2r5r r r rr.sr.cCstjzjyt|}Wntk r0d}YnX|dkrptdkrLt|}nt|}|fdd}tj||t|<Wdtj X|S)Nc Ss0tjztj||krt|=WdtjXdS)N)_imp acquire_lock _module_locksr" release_lock)refrr r rcbs  z_get_module_lock..cb) r6r7r8KeyErrorrr-r_weakrefr:r9)rrr;r r rr1s    r1c Cs6t|}y |jWntk r(Yn X|jdS)N)r1r'rr()rrr r r_lock_unlock_modules  r>cOs |||S)Nr )fr3kwdsr r r_call_with_frames_removedsrAr&) verbositycGs6tjj|kr2|jdsd|}t|j|tjddS)N#import z# )file)rCrD)rflagsverbose startswithprintr*stderr)messagerBr3r r r_verbose_messages  rLcsfdd}t||S)Ncs&|tjkrtdj||d||S)Nz{!r} is not a built-in module)r)rbuiltin_module_names ImportErrorr*)rfullname)fxnr r_requires_builtin_wrappers  z4_requires_builtin.._requires_builtin_wrapper)r)rPrQr )rPr_requires_builtins  rRcsfdd}t||S)Ncs&tj|stdj||d||S)Nz{!r} is not a frozen module)r)r6 is_frozenrNr*)rrO)rPr r_requires_frozen_wrappers  z2_requires_frozen.._requires_frozen_wrapper)r)rPrTr )rPr_requires_frozens  rUcCs>t||}|tjkr2tj|}t||tj|St|SdS)N)spec_from_loaderrmodules_exec_load)rrOspecmoduler r r_load_module_shims      r\c#Cst|dd}t|dr6y |j|Stk r4YnXy |j}Wntk rTYnX|dk rft|Sy |j}Wntk rd}YnXy |j}Wn2tk r|dkrdj |Sdj ||SYnXdj ||SdS)N __loader__ module_repr?z zz) rrr^ Exception__spec__AttributeError_module_repr_from_specr__file__r*)r[loaderrZrfilenamer r r _module_repr s.        rgc@s$eZdZddZddZddZdS)_installed_safelycCs||_|j|_dS)N)_modulera_spec)rr[r r rr3sz_installed_safely.__init__cCsd|j_|jtj|jj<dS)NT)rj _initializingrirrWr)rr r rr27sz_installed_safely.__enter__cGsbzR|j}tdd|Dr@ytj|j=WqPtk r<YqPXntd|j|jWdd|j_XdS)Ncss|]}|dk VqdS)Nr ).0argr r r Asz-_installed_safely.__exit__..zimport {!r} # {!r}F) rjanyrrWrr<rLrerk)rr3rZr r rr5>sz_installed_safely.__exit__N)rrrrr2r5r r r rrh1srhc@sneZdZddddddZddZddZed d Zejd d Zed d Z eddZ e jddZ dS) ModuleSpecN)origin loader_state is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS)NF)rrerqrrsubmodule_search_locations _set_fileattr_cached)rrrerqrrrsr r rrqszModuleSpec.__init__cCsfdj|jdj|jg}|jdk r4|jdj|j|jdk rP|jdj|jdj|jjdj|S)Nz name={!r}z loader={!r}z origin={!r}zsubmodule_search_locations={}z{}({})z, ) r*rrerqappendrt __class__rjoin)rr3r r rr,}s    zModuleSpec.__repr__c Csf|j}yF|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkStk r`dSXdS)NF)rtrrerqcached has_locationrb)rothersmslr r r__eq__s      zModuleSpec.__eq__cCs:|jdkr4|jdk r4|jr4tdkr&ttj|j|_|jS)N)rvrqru_bootstrap_externalNotImplementedError _get_cached)rr r rrzs  zModuleSpec.cachedcCs ||_dS)N)rv)rrzr r rrzscCs$|jdkr|jjddS|jSdS)N.r)rtr rpartition)rr r rparents zModuleSpec.parentcCs|jS)N)ru)rr r rr{szModuleSpec.has_locationcCst||_dS)N)boolru)rvaluer r rr{s) rrrrr,r~propertyrzsetterrr{r r r rrpLs%     rp)rqrscCst|drJtdkrttj}|dkr0|||dS|r8gnd}||||dS|dkrt|dry|j|}Wqtk rd}YqXnd}t||||dS)N get_filename)re)rertrsF)rqrs)rrrspec_from_file_locationrsrNrp)rrerqrsrsearchr r rrVs"     rVc5Cs8y |j}Wntk rYnX|dk r,|S|j}|dkrZy |j}Wntk rXYnXy |j}Wntk r|d}YnX|dkr|dkry |j}Wqtk rd}YqXn|}y |j}Wntk rd}YnXyt|j}Wntk rd}YnXt |||d}|dkr"dnd|_ ||_ ||_ |S)N)rqFT) rarbrr]rd_ORIGIN __cached__list__path__rprurzrt)r[rerqrZrlocationrzrtr r r_spec_from_modulesH         rF)overridec;Cs|st|dddkr6y |j|_Wntk r4YnX|sJt|dddkr|j}|dkr|jdk rtdkrnttj}|j |}|j|_ y ||_ Wntk rYnX|st|dddkry |j |_ Wntk rYnXy ||_Wntk rYnX|st|dddkrD|jdk rDy |j|_Wntk rBYnX|jr|sdt|dddkry |j|_Wntk rYnX|st|dddkr|jdk ry |j|_Wntk rYnX|S)Nrr] __package__rrdr)rrrrbrertrr_NamespaceLoader__new___pathr]rrrarr{rqrdrzr)rZr[rrerr r r_init_module_attrss\           rcCsRd}t|jdr|jj|}nt|jdr2td|dkrDt|j}t|||S)N create_module exec_modulezBloaders that define exec_module() must also define create_module())rrerrNrrr)rZr[r r rmodule_from_spec4s    rcCsj|jdkrdn|j}|jdkrB|jdkr2dj|Sdj||jSn$|jrVdj||jSdj|j|jSdS)Nr_z zzz)rrqrer*r{)rZrr r rrcEs   rcc Cs|j}t|tjj||k r6dj|}t||d|jdkrj|jdkrXtd|jdt ||dd|St ||ddt |jds|jj |n |jj |WdQRXtj|S)Nzmodule {!r} not in sys.modules)rzmissing loaderT)rr) rr.rrWr"r*rNrertrr load_moduler)rZr[rmsgr r rrXVs      rXcCs|jj|jtj|j}t|dddkrLy |j|_Wntk rJYnXt|dddkry(|j|_ t |ds|jj dd|_ Wntk rYnXt|dddkry ||_ Wntk rYnX|S)Nr]rrrrra) rerrrrWrr]rbrrrrra)rZr[r r r_load_backward_compatiblens(    rc Csv|jdk rt|jdst|St|}t|6|jdkrT|jdkr`td|jdn |jj|WdQRXt j |jS)Nrzmissing loader)r) rerrrrhrtrNrrrrW)rZr[r r r_load_unlockeds     rc Cst|j t|SQRXdS)N)r.rr)rZr r rrYs rYc@seZdZeddZedddZedddZedd Zed d Z ee d d Z ee ddZ ee ddZ eeZdS)BuiltinImportercCs dj|jS)Nz)r*r)r[r r rr^szBuiltinImporter.module_reprNcCs,|dk r dStj|r$t||ddSdSdS)Nzbuilt-in)rq)r6 is_builtinrV)clsrOpathtargetr r r find_specs  zBuiltinImporter.find_speccCs|j||}|dk r|jSdS)N)rre)rrOrrZr r r find_modules zBuiltinImporter.find_modulecCs.|jtjkr"tdj|j|jdttj|S)Nz{!r} is not a built-in module)r)rrrMrNr*rAr6create_builtin)rrZr r rrs   zBuiltinImporter.create_modulecCsttj|dS)N)rAr6 exec_builtin)rr[r r rrszBuiltinImporter.exec_modulecCsdS)Nr )rrOr r rget_codeszBuiltinImporter.get_codecCsdS)Nr )rrOr r r get_sourceszBuiltinImporter.get_sourcecCsdS)NFr )rrOr r rrsszBuiltinImporter.is_package)NN)N)rrr staticmethodr^ classmethodrrrrrRrrrsr\rr r r rrs    rc@seZdZeddZedddZedddZedd Zed d Z ed d Z ee ddZ ee ddZ ee ddZdS)FrozenImportercCs dj|jS)Nz)r*r)mr r rr^szFrozenImporter.module_reprNcCs tj|rt||ddSdSdS)Nfrozen)rq)r6rSrV)rrOrrr r rr s zFrozenImporter.find_speccCstj|r|SdS)N)r6rS)rrOrr r rrszFrozenImporter.find_modulecCsdS)Nr )rrZr r rrszFrozenImporter.create_modulecCs@|jj}tj|s$tdj||dttj|}t||j dS)Nz{!r} is not a frozen module)r) rarr6rSrNr*rAget_frozen_objectexecr)r[rcoder r rr s    zFrozenImporter.exec_modulecCs t||S)N)r\)rrOr r rr)szFrozenImporter.load_modulecCs tj|S)N)r6r)rrOr r rr2szFrozenImporter.get_codecCsdS)Nr )rrOr r rr8szFrozenImporter.get_sourcecCs tj|S)N)r6is_frozen_package)rrOr r rrs>szFrozenImporter.is_package)NN)N)rrrrr^rrrrrrrUrrrsr r r rrs     rc@seZdZddZddZdS)_ImportLockContextcCs tjdS)N)r6r7)rr r rr2Ksz_ImportLockContext.__enter__cCs tjdS)N)r6r9)rexc_type exc_value exc_tracebackr r rr5Osz_ImportLockContext.__exit__N)rrrr2r5r r r rrGsrcCs@|jd|d}t||kr$td|d}|r= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module name) isinstancestr TypeErrorr*rrrN)rrrr r r _sanity_checks   rzNo module named z{!r}c Csd}|jdd}|r|tjkr*t|||tjkr>tj|Stj|}y |j}Wn2tk rtdj||}t||ddYnXt ||}|dkrttj||dnt |}|rtj|}t ||jdd||S)Nrrz; {!r} is not a package)r) rrrWrArrb_ERR_MSGr*ModuleNotFoundErrorrrr)rimport_rr parent_modulerrZr[r r r_find_and_load_unlockeds*        rc Cs^t|&tjj|t}|tkr*t||SWdQRX|dkrRdj|}t||dt||S)Nz(import of {} halted; None in sys.modules)r) r.rrWr"_NEEDS_LOADINGrr*rr>)rrr[rKr r r_find_and_loads  rrcCs*t||||dkr t|||}t|tS)Nr)rrr _gcd_import)rrrr r rrs  r) recursivecCst|drx|D]}t|tsN|r.|jd}nd}td|dt|jq|dkrz| rt|drt||j|dd qt||sd j|j|}yt ||Wqt k r}z&|j |krt j j|tdk rwWYdd}~XqXqW|S) Nrz.__all__z ``from list''zItem in z must be str, not *__all__T)rz{}.{})rrrrrr_handle_fromlistrr*rArrrrWr"r)r[fromlistrrxwhere from_nameexcr r rrs*        rcCs|jd}|jd}|dk rR|dk rN||jkrNtjd|d|jdtdd|S|dk r`|jStjdtdd|d }d |kr|jd d }|S) Nrraz __package__ != __spec__.parent (z != )) stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rrrr)r"rrrrr)globalsrrZr r r_calc___package__ s    rc Cs|dkrt|}n$|dk r|ni}t|}t|||}|s|dkrTt|jddS|s\|St|t|jdd}tj|jdt|j|Sn t||tSdS)Nrr)rr partitionrrrWrr) rrlocalsrrr[globals_rcut_offr r r __import__&s    rcCs&tj|}|dkrtd|t|S)Nzno built-in module named )rrrNr)rrZr r r_builtin_from_nameIs  rc Cs|a|att}xVtjjD]H\}}t||r|tjkr>t}ntj|rt }nqt ||}t ||qWtjt }x6dD].}|tjkrt |} n tj|} t||| qxWy t d} Wntk rd} YnXt|d| t d} t|d| dS)Nrrr=)r)r6rrrWitemsrrMrrSrrrrrrrN) sys_module _imp_module module_typerr[rerZ self_module builtin_namebuiltin_module thread_moduleweakref_moduler r r_setupPs2             rcCsBt||tjjttjjtddl}|a|jtj t dS)Nr) rrrrwrr_frozen_importlib_externalr_installrWr)rrrr r rrs    r)NN)N)Nr)1rrrr8r!r)rrr-r.r1r>rArLrRrUr\rgrhrprVrrrrcrXrrrYrrrrrrr_ERR_MSG_PREFIXrrobjectrrrrrrrrrr r r rs\D%   $e -<IM   / &#/