a 97a@sdZddlZddlZejddkZer.efZnddlZefZddl m Z iZ da e ZddZe ed d Zd d Zd dZe eddZGdddZGdddZGdddZddZdS)zThis module implements a post import hook mechanism styled after what is described in PEP-369. Note that it doesn't cope with modules being reloaded. N) synchronizedFcsfdd}|S)NcsFd\}}|d}t|tj|}|D]}t||}q.||S)N:.)split __import__sysmodulesgetattr)module module_namefunctionattrscallbackattrnamei/private/var/folders/s6/9n5zrl012gv99k63s4q6ccsd4s6mqz/T/pip-target-f5cq3f2q/lib/python/wrapt/importer.py import_hook%s   z4_create_import_hook_from_string..import_hookr)rrrrr_create_import_hook_from_string$s rcCst|trt|}ts*datjdtt |d}|durrtj |d}|durfgt|<||q|gt|<n*|gkrtj |}||nt| |dSNTr) isinstance string_typesr_post_import_hooks_initr meta_pathinsertImportHookFinder_post_import_hooksgetr append)hookrhooksr rrrregister_post_import_hook/s       r$csfdd}|S)Ncs4tjtjj}jD]}t||}q||SN)rr r r rr )r rr entrypointrrrgs     z8_create_import_hook_from_entrypoint..import_hookr)r'rrr&r#_create_import_hook_from_entrypointfs r(cCsLz ddl}Wnty YdS0|j|dD]}t|}t||jq.dS)Nr)group) pkg_resources ImportErroriter_entry_pointsr(r$r)r)r*r'rrrrdiscover_post_import_hooksos  r-cCs:t|dd}t|d}|r6gt|<|D] }||q(dS)N__name__)r rr )r rr#r"rrrnotify_module_loaded~s   r/c@seZdZddZdS)_ImportHookLoadercCstj|}t||Sr%)r r r/selffullnamer rrr load_modules z_ImportHookLoader.load_moduleN)r. __module__ __qualname__r4rrrrr0sr0c@seZdZddZddZdS)_ImportHookChainedLoadercCs ||_dSr%)loader)r2r8rrr__init__sz!_ImportHookChainedLoader.__init__cCs|j|}t||Sr%)r8r4r/r1rrrr4s z$_ImportHookChainedLoader.load_moduleN)r.r5r6r9r4rrrrr7sr7c@s&eZdZddZeedddZdS)rcCs i|_dSr%) in_progress)r2rrrr9szImportHookFinder.__init__Nc Cs|tvr dS||jvrdSd|j|<z|trBt|tW|j|=Szddl}|j|j}Wn"t t fy~| ||}Yn0|rt |W|j|=SW|j|=n |j|=0dSr) rr:PY2rr0importlib.utilutil find_specr8r+AttributeError find_loaderr7)r2r3path importlibr8rrr find_modules*    zImportHookFinder.find_module)N)r.r5r6r9r_post_import_hooks_lockrCrrrrrsrcsfdd}|S)Ncst||Sr%)r$)r"rrrregisters zwhen_imported..registerr)rrErrr when_importeds rF)__doc__r threading version_infor; basestringrrBstrZ decoratorsrrrRLockrDrr$r(r-r/r0r7rrFrrrrs,    6   A