File "_bootstrap.cpython-34.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python34/lib64/python3.4/importlib/__pycache__/_bootstrap.cpython-34.pyc
File size: 68.38 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit


e f!S@sdZdZddZddZdd	Zd
dZdd
ZddZddZddZ	ddZ
dddZddZddZ
eejZGdddZiZiZGdd d eZGd!d"d"ZGd#d$d$ZGd%d&d&Zd'd(Zd)d*Zd+d,Zd-jd.d/d0Zejed/Z d1Z!d2gZ"d3gZ#d4gZ$d5d6d7Z%d8d9Z&d:d;Z'd<d=Z(d>d?d@dAZ)dBdCZ*dDdEZ+dFdGZ,dHdIZ-dJdKZ.d5d5d5dLdMZ/d5d5d5dNdOZ0dPdPdQdRZ1dSdTZ2dUdVZ3GdWdXdXZ4GdYdZdZZ5d[d5d\d5d]d^Z6e7Z8d5d_d5d`e8dadbZ9d5d5dcddZ:GdedfdfZ;d5dgdhZ<GdidjdjZ=GdkdldlZ>GdmdndnZ?GdodpdpZ@Gdqdrdre@ZAGdsdtdtZBGdudvdveBeAZCGdwdxdxeBe@ZDgZEGdydzdzZFGd{d|d|ZGGd}d~d~ZHGdddZIGdddZJGdddZKddZLddZMd5ddZNddZOdZPePdZQddZRddZSd5dPddZTddZUddZVddZWd5d5fdPddZXddZYddZZddZ[d5S)aSCore implementation of import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

wincygwindarwincCs1tjjtr!dd}ndd}|S)NcSs
dtjkS)z5True if filenames must be checked case-insensitively.sPYTHONCASEOK)_osenvironrr9/opt/alt/python34/lib64/python3.4/importlib/_bootstrap.py_relax_casesz%_make_relax_case.<locals>._relax_casecSsdS)z5True if filenames must be checked case-insensitively.Frrrrrr"s)sysplatform
startswith_CASE_INSENSITIVE_PLATFORMS)rrrr_make_relax_casesr
cCst|d@jddS)z*Convert a 32-bit integer to little-endian.llittle)intto_bytes)xrrr_w_long(srcCstj|dS)z/Convert 4 bytes in little-endian to an integer.r)r
from_bytes)	int_bytesrrr_r_long-srcGstjdd|DS)zReplacement for os.path.join().cSs%g|]}|r|jtqSr)rstrippath_separators).0partrrr
<listcomp>4s	z_path_join.<locals>.<listcomp>)path_sepjoin)
path_partsrrr
_path_join2srcCsttdkr4|jt\}}}||fSxEt|D]7}|tkrA|j|dd\}}||fSqAWd|fS)z Replacement for os.path.split().maxsplit)lenr
rpartitionrreversedrsplit)pathfront_tailrrrr_path_split8s
r+cCs
tj|S)z~Stat the path.

    Made a separate function to make it easier to override in experiments
    (e.g. cache stat results).

    )rstat)r'rrr
_path_statDsr-cCs:yt|}Wntk
r(dSYnX|jd@|kS)z1Test whether the path is the specified mode type.Fi)r-OSErrorst_mode)r'mode	stat_inforrr_path_is_mode_typeNs

	r2cCs
t|dS)zReplacement for os.path.isfile.i)r2)r'rrr_path_isfileWsr3cCs"|stj}nt|dS)zReplacement for os.path.isdir.i@)rgetcwdr2)r'rrr_path_isdir\sr5icCsdj|t|}tj|tjtjBtjB|d@}y<tj|d}|j	|WdQXtj
||Wn;tk
rytj|Wntk
rYnXYnXdS)zBest-effort function to write data to a path atomically.
    Be prepared to handle a FileExistsError if concurrent writing of the
    temporary file is attempted.z{}.{}iwbN)
formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwritereplacer.unlink)r'datar0path_tmpfdfilerrr
_write_atomiccs	!

rFcCs_xEddddgD]1}t||rt||t||qqW|jj|jdS)z/Simple substitute for functools.update_wrapper.
__module____name____qualname____doc__N)hasattrsetattrgetattr__dict__update)newoldr@rrr_wrapys rRcCstt|S)N)typer	)namerrr_new_modulesrUc@s:eZdZdZddZddZddZdS)	
_ManageReloadz?Manages the possible clean-up of sys.modules for load_module().cCs
||_dS)N)_name)selfrTrrr__init__sz_ManageReload.__init__cCs|jtjk|_dS)N)rWr	modules
_is_reload)rXrrr	__enter__sz_ManageReload.__enter__cGsPtdd|DrL|jrLytj|j=WqLtk
rHYqLXndS)Ncss|]}|dk	VqdS)Nr)rargrrr	<genexpr>sz)_ManageReload.__exit__.<locals>.<genexpr>)anyr[r	rZrWKeyError)rXargsrrr__exit__s
#
z_ManageReload.__exit__N)rHrGrIrJrYr\rbrrrrrVsrVc@seZdZdS)_DeadlockErrorN)rHrGrIrrrrrcsrcc@sReZdZdZddZddZddZdd	Zd
dZdS)
_ModuleLockzA recursive lock implementation which is able to detect deadlocks
    (e.g. thread 1 trying to take locks A then B, and thread 2 trying to
    take locks B then A).
    cCsFtj|_tj|_||_d|_d|_d|_dS)N)_thread
allocate_locklockwakeuprTownercountwaiters)rXrTrrrrYs			z_ModuleLock.__init__cCsXtj}|j}x<tj|}|dkr7dS|j}||krdSqWdS)NFT)rf	get_identrj_blocking_onget)rXmetidrhrrrhas_deadlocks		z_ModuleLock.has_deadlockcCstj}|t|<zx|j|jdksD|j|kr`||_|jd7_dS|jrtd|n|jj	dr|j
d7_
nWdQX|jj	|jjqWWdt|=XdS)z
        Acquire the module lock.  If a potential deadlock is detected,
        a _DeadlockError is raised.
        Otherwise, the lock is always acquired and True is returned.
        rer Tzdeadlock detected by %rFN)rfrmrnrhrkrjrrrcriacquirerlrelease)rXrqrrrrss 

	
z_ModuleLock.acquirec
Cstj}|j|j|kr4tdn|jdksIt|jd8_|jdkrd|_|jr|jd8_|jj	qnWdQXdS)Nzcannot release un-acquired lockrer )
rfrmrhrjRuntimeErrorrkAssertionErrorrlrirt)rXrqrrrrts
		z_ModuleLock.releasecCsdj|jt|S)Nz_ModuleLock({!r}) at {})r7rTr8)rXrrr__repr__sz_ModuleLock.__repr__N)	rHrGrIrJrYrrrsrtrwrrrrrds
rdc@sFeZdZdZddZddZddZdd	Zd
S)_DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without
    multi-threading support.cCs||_d|_dS)Nre)rTrk)rXrTrrrrYs	z_DummyModuleLock.__init__cCs|jd7_dS)Nr T)rk)rXrrrrssz_DummyModuleLock.acquirecCs1|jdkrtdn|jd8_dS)Nrezcannot release un-acquired lockr )rkru)rXrrrrtsz_DummyModuleLock.releasecCsdj|jt|S)Nz_DummyModuleLock({!r}) at {})r7rTr8)rXrrrrwsz_DummyModuleLock.__repr__N)rHrGrIrJrYrsrtrwrrrrrxs
rxc@s4eZdZddZddZddZdS)_ModuleLockManagercCs||_d|_dS)N)rW_lock)rXrTrrrrYs	z_ModuleLockManager.__init__c
Cs5zt|j|_WdtjX|jjdS)N)_get_module_lockrWrz_imprelease_lockrs)rXrrrr\sz_ModuleLockManager.__enter__cOs|jjdS)N)rzrt)rXrakwargsrrrrbsz_ModuleLockManager.__exit__N)rHrGrIrYr\rbrrrrrysrycsd}yt}Wntk
r+YnX|dkrtdkrSt}nt}fdd}tj||t<n|S)zmGet or create the module lock for a given module name.

    Should only be called with the import lock taken.Ncst=dS)N)
_module_locks)r))rTrrcb sz_get_module_lock.<locals>.cb)rr`rfrxrd_weakrefref)rTrhrr)rTrr{s
r{cCsGt|}tjy|jWntk
r8YnX|jdS)aRelease the global import lock, and acquires then release the
    module lock for a given module name.
    This is used to ensure a module is completely initialized, in the
    event it is being imported by another thread.

    Should only be called with the import lock taken.N)r{r|r}rsrcrt)rTrhrrr_lock_unlock_module%s

rcOs
|||S)a.remove_importlib_frames in import.c will always remove sequences
    of importlib frames that end with a call to this function

    Use it instead of a normal call in places where including the importlib
    frames introduces unwanted noise into the traceback (e.g. when executing
    module code)
    r)frakwdsrrr_call_with_frames_removed9srirs
__pycache__z.pyz.pycz.pyoNcCs|dkrtjjn|}|r.t}nt}t|\}}|jd\}}}tjj}	|	dkrt	dndj
|r|n|||	|dg}
t|t|
S)aGiven the path to a .py file, return the path to its .pyc/.pyo file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc/.pyo file calculated as if the .py file were imported.  The extension
    will be .pyc unless sys.flags.optimize is non-zero, then it will be .pyo.

    If debug_override is not None, then it must be a boolean and is used in
    place of sys.flags.optimize.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.

    N.z$sys.implementation.cache_tag is Noner"re)
r	flagsoptimizeDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESr+r$implementation	cache_tagNotImplementedErrorrr_PYCACHE)r'debug_overridedebugsuffixesheadr*basesepresttagfilenamerrrcache_from_sources
	+rcCstjjdkr!tdnt|\}}t|\}}|tkrltdjt|n|jddkrtdj|n|j	dd}t
||tdS)ayGiven the path to a .pyc./.pyo file, return the path to its .py file.

    The .pyc/.pyo file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc/.pyo file.  If path does
    not conform to PEP 3147 format, ValueError will be raised. If
    sys.implementation.cache_tag is None then NotImplementedError is raised.

    Nz$sys.implementation.cache_tag is Nonez%{} not bottom-level directory in {!r}rrzexpected only 2 dots in {!r}re)r	rrrr+r
ValueErrorr7rk	partitionrSOURCE_SUFFIXES)r'rpycache_filenamepycache
base_filenamerrrsource_from_caches			rcCst|dkrdS|jd\}}}|sQ|jdddkrU|Syt|}Wn(ttfk
r|dd	}YnXt|r|S|S)
zConvert a bytecode file path to a source path (if possible).

    This function exists purely for backwards-compatibility for
    PyImport_ExecCodeModuleWithFilenames() in the C API.

    reNrr pyr)r#r$lowerrrrr3)
bytecode_pathrr)	extensionsource_pathrrr_get_sourcefiles#rcCs<yt|j}Wntk
r-d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.i)r-r/r.)r'r0rrr
_calc_modes

r	verbosityr cGsQtjj|krM|jds.d|}nt|j|dtjndS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.#import z# rEN)rr)r	rverboserprintr7stderr)messagerrarrr_verbose_messages
rcs&dfdd}t||S)zDecorator to verify that the module being requested matches the one the
    loader can handle.

    The first argument (self) must define _name which the second argument is
    compared against. If the comparison fails then ImportError is raised.

    NcsS|dkr|j}n(|j|kr@td|d|n||||S)Nzloader cannot handle %srT)rTImportError)rXrTrar~)methodrr_check_name_wrappers
z(_check_name.<locals>._check_name_wrapper)rR)rrr)rr_check_names
rcs#fdd}t||S)z1Decorator to verify the named module is built-in.cs:|tjkr-tdj|d|n||S)Nz{!r} is not a built-in modulerT)r	builtin_module_namesrr7)rXfullname)fxnrr_requires_builtin_wrapper"sz4_requires_builtin.<locals>._requires_builtin_wrapper)rR)rrr)rr_requires_builtin s
rcs#fdd}t||S)z/Decorator to verify the named module is frozen.cs:tj|s-tdj|d|n||S)Nz{!r} is not a frozen modulerT)r|	is_frozenrr7)rXr)rrr_requires_frozen_wrapper-sz2_requires_frozen.<locals>._requires_frozen_wrapper)rR)rrr)rr_requires_frozen+s
rcCsW|j|\}}|dkrSt|rSd}tj|j|dtn|S)zTry to find a loader for the specified module by delegating to
    self.find_loader().

    This method is deprecated in favor of finder.find_spec().

    Nz,Not importing directory {}: missing __init__re)find_loaderr#	_warningswarnr7
ImportWarning)rXrloaderportionsmsgrrr_find_module_shim6s

 rcCs]t||}t|}|tjkrOtj|}|j|tj|S|jSdS)zLoad the specified module into sys.modules and return it.

    This method is deprecated.  Use loader.exec_module instead.

    N)spec_from_loader_SpecMethodsr	rZexecload)rXrspecmethodsmodulerrr_load_module_shimGs

rcCsi}|dk	r||d<nd}|dk	r>||d<n|dd}|dd}|dd}|tkrdj||}td	|t||nzt|dkrd
j|}td	|t|n=t|dkr%dj|}td	|t|n|dk	ryt|d}	Wntk
rYYnAXt||	krd
j|}td	|t||ny|dd@}
Wntk
rYqXt||
krtd
j||qn|ddS)azValidate the header of the passed-in bytecode against source_stats (if
    given) and returning the bytecode that can be compiled by compile().

    All other arguments are used to enhance error reporting.

    ImportError is raised when the magic number is incorrect or the bytecode is
    found to be stale. EOFError is raised when the data is found to be
    truncated.

    NrTz
<bytecode>r'rzbad magic number in {!r}: {!r}z{}z+reached EOF while reading timestamp in {!r}z0reached EOF while reading size of source in {!r}mtimezbytecode is stale for {!r}sizel)	MAGIC_NUMBERr7rrr#EOFErrorrr`r)rBsource_statsrTr'exc_detailsmagic
raw_timestampraw_sizersource_mtimesource_sizerrr_validate_bytecode_headerWsL







rcCsstj|}t|trNtd||dk	rJtj||n|Stdj|d|d|dS)z<Compile bytecode as returned by _validate_bytecode_header().zcode object from {!r}NzNon-code object in {!r}rTr')	marshalloads
isinstance
_code_typerr|_fix_co_filenamerr7)rBrTrrcoderrr_compile_bytecodes
rrecCsLtt}|jt||jt||jtj||S)zPCompile a code object into bytecode for writing out to a byte-compiled
    file.)	bytearrayrextendrrdumps)rrrrBrrr_code_to_bytecodes
rcCsYddl}tj|j}|j|}tjdd}|j|j|dS)zyDecode bytes representing source code and return the string.

    Universal newline support is used in the decoding.
    reNT)tokenizer=BytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode)source_bytesrsource_bytes_readlineencodingnewline_decoderrrr
decode_sources
rc#Cst|dd}t|drJy|j|SWqJtk
rFYqJXny
|j}Wntk
rkYnX|dk	rt|jSy
|j}Wntk
rd}YnXy
|j}Wn;tk
r|dkrdj	|Sdj	||SYnXdj	||SdS)N
__loader__module_repr?z
<module {!r}>z<module {!r} ({!r})>z<module {!r} from {!r}>)
rMrKr	Exception__spec__AttributeErrorrrH__file__r7)rrrrTrrrr_module_reprs.







rc@s4eZdZddZddZddZdS)_installed_safelycCs||_|j|_dS)N)_moduler_spec)rXrrrrrYs	z_installed_safely.__init__cCs&d|j_|jtj|jj<dS)NT)r
_initializingrr	rZrT)rXrrrr\sz_installed_safely.__enter__cGsyze|j}tdd|DrNytj|j=Wqdtk
rJYqdXntd|j|jWdd|j_XdS)Ncss|]}|dk	VqdS)Nr)rr]rrrr^sz-_installed_safely.__exit__.<locals>.<genexpr>zimport {!r} # {!r}F)	rr_r	rZrTr`rrr)rXrarrrrrbs	
z_installed_safely.__exit__N)rHrGrIrYr\rbrrrrrsrc@seZdZdZddddddddZdd	Zd
dZedd
Zej	dd
ZeddZ
eddZej	ddZdS)
ModuleSpecaThe specification for a module, used for loading.

    A module's spec is the source for information about the module.  For
    data associated with the module, including source, use the spec's
    loader.

    `name` is the absolute name of the module.  `loader` is the loader
    to use when loading the module.  `parent` is the name of the
    package the module is in.  The parent is derived from the name.

    `is_package` determines if the module is considered a package or
    not.  On modules this is reflected by the `__path__` attribute.

    `origin` is the specific location used by the loader from which to
    load the module, if that information is available.  When filename is
    set, origin will match.

    `has_location` indicates that a spec's "origin" reflects a location.
    When this is True, `__file__` attribute of the module is set.

    `cached` is the location of the cached bytecode file, if any.  It
    corresponds to the `__cached__` attribute.

    `submodule_search_locations` is the sequence of path entries to
    search when importing submodules.  If set, is_package should be
    True--and False otherwise.

    Packages are simply modules that (may) have submodules.  If a spec
    has a non-None value in `submodule_search_locations`, the import
    system will consider modules loaded from the spec as packages.

    Only finders (see importlib.abc.MetaPathFinder and
    importlib.abc.PathEntryFinder) should modify ModuleSpec instances.

    originNloader_state
is_packagecCsO||_||_||_||_|r0gnd|_d|_d|_dS)NF)rTrrrsubmodule_search_locations
_set_fileattr_cached)rXrTrrrrrrrrYs					zModuleSpec.__init__cCsdj|jdj|jg}|jdk	rO|jdj|jn|jdk	rz|jdj|jndj|jjdj|S)Nz	name={!r}zloader={!r}zorigin={!r}zsubmodule_search_locations={}z{}({})z, )	r7rTrrappendr	__class__rHr)rXrarrrrw"szModuleSpec.__repr__cCs|j}yk|j|jkor|j|jkor|j|jkor||jkor|j|jkor|j|jkSWntk
rdSYnXdS)NF)rrTrrcachedhas_locationr)rXothersmslrrr__eq__,s	
zModuleSpec.__eq__cCs|jdkr|jdk	r|jr|j}|jttrpyt||_Wqtk
rlYqXq|jttr||_qqn|jS)N)	rrrendswithtuplerrrBYTECODE_SUFFIXES)rXrrrrr8s	
zModuleSpec.cachedcCs
||_dS)N)r)rXrrrrrFscCs.|jdkr#|jjddS|jSdS)z The name of the module's parent.Nrre)rrTr$)rXrrrparentJszModuleSpec.parentcCs|jS)N)r)rXrrrrRszModuleSpec.has_locationcCst||_dS)N)boolr)rXvaluerrrrVs)rHrGrIrJrYrwrpropertyrsetterrrrrrrrs#
rrrcCst|drS|dkr+t|d|S|r7gnd}t|d|d|S|dkrt|dry|j|}Wqtk
rd}YqXqd}nt||d|d|S)z5Return a module spec based on various loader methods.get_filenameNrrrFr)rKspec_from_file_locationrrr)rTrrrsearchrrrr[s
	rrrc	Csn|dkrOd}t|drOy|j|}WqLtk
rHYqLXqOnt||d|}d|_|dkrxOtD]=\}}|jt|r|||}||_PqqWdSn|t	kr&t|dr/y|j
|}Wntk
r
Yq#X|r#g|_q#q/n	||_|jgkrj|rjt|d}|jj
|qjn|S)a=Return a module spec based on a file location.

    To indicate that the module is a package, set
    submodule_search_locations to a list of directory paths.  An
    empty list is sufficient, though its not otherwise useful to the
    import system.

    The loader must take a spec as its only __init__() arg.

    Nz	<unknown>rrTrre)rKrrrr_get_supported_file_loadersrrr	_POPULATErrr+r	)	rTlocationrrrloader_classrrdirnamerrrrts<
		
	rc5Cs|y
|j}Wntk
r!YnX|dk	r2|S|j}|dkrly
|j}Wqltk
rhYqlXny
|j}Wntk
rd}YnX|dkr|dkry
|j}Wqtk
rd}YqXq|}ny
|j}Wntk
rd}YnXyt|j}Wntk
r5d}YnXt	||d|}|dkr]dnd|_
||_||_|S)NrFT)
rrrHrr_ORIGIN
__cached__list__path__rrrr)rrrrrTrrrrrr_spec_from_modulesH

	





	


		r$c@seZdZdZddZddZdddd	d
dZdd
ZddZddZ	ddZ
ddZddZdS)rzMConvenience wrapper around spec objects to provide spec-specific
    methods.cCs
||_dS)N)r)rXrrrrrYsz_SpecMethods.__init__cCs|j}|jdkrdn|j}|jdkrh|jdkrRdj|Sdj||jSn2|jrdj||jSdj|j|jSdS)z&Return the repr to use for the module.Nrz
<module {!r}>z<module {!r} ({!r})>z<module {!r} from {!r}>z<module {!r} ({})>)rrTrrr7r)rXrrTrrrrs	
	z_SpecMethods.module_repr	_overrideF_force_nameTc;CsK|j}|s-|s-t|dddkrUy|j|_WqUtk
rQYqUXn|sst|dddkr|j}|dkr|jdk	rtjt}|j|_	qny
||_
Wqtk
rYqXn|st|dddkr#y|j|_Wq#tk
rYq#Xny
||_
Wntk
rDYnX|sct|dddkr|jdk	ry|j|_Wqtk
rYqXqn|jrG|st|dddkry|j|_Wqtk
rYqXn|s
t|dddkrG|jdk	rDy|j|_WqAtk
r=YqAXqDqGndS)aSet the module's attributes.

        All missing import-related module attributes will be set.  Here
        is how the spec attributes map onto the module:

        spec.name -> module.__name__
        spec.loader -> module.__loader__
        spec.parent -> module.__package__
        spec -> module.__spec__

        Optional:
        spec.origin -> module.__file__ (if spec.set_fileattr is true)
        spec.cached -> module.__cached__ (if __file__ also set)
        spec.submodule_search_locations -> module.__path__ (if set)

        rHNr__package__r#rr!)rrMrTrHrrr_NamespaceLoader__new___pathrrr'rr#rrrrr!)rXrr%r&rrrrrinit_module_attrssX	
	





	

z_SpecMethods.init_module_attrscCse|j}t|jdr0|jj|}nd}|dkrTt|j}n|j||S)zReturn a new module to be loaded.

        The import-related module attributes are also set with the
        appropriate values from the spec.

        
create_moduleN)rrKrr,rUrTr+)rXrrrrrcreateKs	
z_SpecMethods.createcCs|jjj|dS)zDo everything necessary to execute the module.

        The namespace of `module` is used as the target of execution.
        This method uses the loader's `exec_module()` method.

        N)rrexec_module)rXrrrr_execbsz_SpecMethods._execcCs|jj}tjt|tjj||k	r_dj|}t	|d|n|jj
dkr|jjdkrt	dd|jjn|j|dd|S|j|ddt
|jj
ds|jj
j|n
|j|WdQXtj|S)z3Execute the spec in an existing module's namespace.zmodule {!r} not in sys.modulesrTNzmissing loaderr%Tr.)rrTr|acquire_lockryr	rZror7rrrr+rKload_moduler/)rXrrTrrrrrls 

z_SpecMethods.execcCs|j}|jj|jtj|j}t|dddkrly|j|_Wqltk
rhYqlXnt|dddkry;|j	|_
t|ds|jjdd|_
nWqtk
rYqXnt|dddkry
||_
Wqtk
rYqXn|S)Nrr'r#rrer)rrr1rTr	rZrMrrrHr'rKr$r)rXrrrrr_load_backward_compatibles*	
 


z&_SpecMethods._load_backward_compatiblecCs|jjdk	r4t|jjds4|jSn|j}t|T|jjdkr|jjdkrtdd|jjqn
|j	|WdQXt
j|jjS)Nr.zmissing loaderrT)rrrKr2r-rrrrTr/r	rZ)rXrrrr_load_unlockeds

z_SpecMethods._load_unlockedcCs1tjt|jj|jSWdQXdS)zReturn a new module object, loaded by the spec's loader.

        The module is not added to its parent.

        If a module is already in sys.modules, that existing module gets
        clobbered.

        N)r|r0ryrrTr3)rXrrrrs	
z_SpecMethods.loadN)
rHrGrIrJrYrr+r-r/rr2r3rrrrrrsP
rcCs|jd}|jd}|sf|r6|j}qf||krTt||}qft||}n|st||d|}ny,||d<||d<||d<||d<Wntk
rYnXdS)Nrrrrr!)rorSourcelessFileLoaderSourceFileLoaderrr)nsrTpathname	cpathnamerrrrr_fix_up_modules"



r9c@seZdZdZeddZeddddZedddZee	d	d
Z
ee	ddZee	d
dZee	ddZ
dS)BuiltinImporterzMeta path import for built-in modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    cCsdj|jS)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (built-in)>)r7rH)rrrrrszBuiltinImporter.module_reprNcCs:|dk	rdStj|r2t||ddSdSdS)Nrzbuilt-in)r|
is_builtinr)clsrr'targetrrr	find_specs
zBuiltinImporter.find_speccCs)|j||}|dk	r%|jSdS)zFind the built-in module.

        If 'path' is ever specified then the search is considered a failure.

        This method is deprecated.  Use find_spec() instead.

        N)r>r)r<rr'rrrrfind_modules	zBuiltinImporter.find_modulec
Cs;t|ttj|}WdQX||_d|_|S)zLoad a built-in module.Nr")rVrr|init_builtinrr')r<rrrrrr1s

		zBuiltinImporter.load_modulecCsdS)z9Return None as built-in modules do not have code objects.Nr)r<rrrrget_codeszBuiltinImporter.get_codecCsdS)z8Return None as built-in modules do not have source code.Nr)r<rrrr
get_sourceszBuiltinImporter.get_sourcecCsdS)z4Return False as built-in modules are never packages.Fr)r<rrrrrszBuiltinImporter.is_package)rHrGrIrJstaticmethodrclassmethodr>r?rr1rArBrrrrrr:s	r:c@seZdZdZeddZeddddZedddZed	d
Z	eddZ
eed
dZeeddZ
eeddZdS)FrozenImporterzMeta path import for frozen modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    cCsdj|jS)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (frozen)>)r7rH)mrrrr/szFrozenImporter.module_reprNcCs*tj|r"t||ddSdSdS)Nrfrozen)r|rr)r<rr'r=rrrr>8szFrozenImporter.find_speccCstj|r|SdS)z]Find a frozen module.

        This method is deprecated.  Use find_spec() instead.

        N)r|r)r<rr'rrrr??szFrozenImporter.find_modulecCs_|jj}tj|s9tdj|d|nttj|}t||j	dS)Nz{!r} is not a frozen modulerT)
rrTr|rrr7rget_frozen_objectrrN)rrTrrrrr.HszFrozenImporter.exec_modulecCs
t||S)z_Load a frozen module.

        This method is deprecated.  Use exec_module() instead.

        )r)r<rrrrr1QszFrozenImporter.load_modulecCs
tj|S)z-Return the code object for the frozen module.)r|rH)r<rrrrrAZszFrozenImporter.get_codecCsdS)z6Return None as frozen modules do not have source code.Nr)r<rrrrrB`szFrozenImporter.get_sourcecCs
tj|S)z.Return True if the frozen module is a package.)r|is_frozen_package)r<rrrrrfszFrozenImporter.is_package)rHrGrIrJrCrrDr>r?r.r1rrArBrrrrrrE&s			rEc@syeZdZdZdZdZdZeddZeddZ	ed	d	d
dZ
ed	dd
Zd	S)WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCsCytjtj|SWn%tk
r>tjtj|SYnXdS)N)_winregOpenKeyHKEY_CURRENT_USERr.HKEY_LOCAL_MACHINE)r<keyrrr_open_registryys
z$WindowsRegistryFinder._open_registrycCs|jr|j}n	|j}|jd|dtjdd}y.|j|}tj|d}WdQXWnt	k
rdSYnX|S)Nrsys_versionrr")
DEBUG_BUILDREGISTRY_KEY_DEBUGREGISTRY_KEYr7r	versionrPrK
QueryValuer.)r<rregistry_keyrOhkeyfilepathrrr_search_registrys		
	z&WindowsRegistryFinder._search_registryNcCs|j|}|dkrdSyt|Wntk
rEdSYnXxNtD]C\}}|jt|rPt||||d|}|SqPWdS)Nr)rZr-r.rrrr)r<rr'r=rYrrrrrrr>s
		zWindowsRegistryFinder.find_speccCs-|j||}|dk	r%|jSdSdS)zlFind module named in the registry.

        This method is deprecated.  Use exec_module() instead.

        N)r>r)r<rr'rrrrr?sz!WindowsRegistryFinder.find_module)rHrGrIrJrTrSrRrDrPrZr>r?rrrrrJmsrJc@s4eZdZdZddZddZeZdS)
_LoaderBasicszSBase class of common code needed by both SourceLoader and
    SourcelessFileLoader.cCsXt|j|d}|jddd}|jdd}|dkoW|dkS)zConcrete implementation of InspectLoader.is_package by checking if
        the path returned by get_filename has a filename of '__init__.py'.r rrerrY)r+rr&r$)rXrr
filename_base	tail_namerrrrsz_LoaderBasics.is_packagecCsP|j|j}|dkr9tdj|jntt||jdS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)rArHrr7rrrN)rXrrrrrr.s
	z_LoaderBasics.exec_moduleN)rHrGrIrJrr.rr1rrrrr[sr[c@sjeZdZddZddZddZddZd	d
Zddd
dZddZ	dS)SourceLoadercCs
tdS)zOptional method that returns the modification time (an int) for the
        specified path, where path is a str.

        Raises IOError when the path cannot be handled.
        N)IOError)rXr'rrr
path_mtimeszSourceLoader.path_mtimecCsi|j|d6S)aOptional method returning a metadata dict for the specified path
        to by the path (str).
        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.

        Implementing this method allows the loader to read bytecode files.
        Raises IOError when the path cannot be handled.
        r)r`)rXr'rrr
path_statsszSourceLoader.path_statscCs|j||S)zOptional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.

        The source path is needed in order to correctly transfer permissions
        )set_data)rXr
cache_pathrBrrr_cache_bytecodeszSourceLoader._cache_bytecodecCsdS)zOptional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.
        Nr)rXr'rBrrrrbszSourceLoader.set_datacCsi|j|}y|j|}Wn:tk
r^}ztdd||WYdd}~XnXt|S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()rTN)rget_datar.rr)rXrr'rexcrrrrBs	zSourceLoader.get_source	_optimizer c	Cstt||dddd|S)zReturn the code object compiled from source.

        The 'data' argument can be any object type that compile() supports.
        rdont_inheritTr)rcompile)rXrBr'rgrrrsource_to_codeszSourceLoader.source_to_codec
+Cs|j|}d}yt|}Wntk
r?d}YnXy|j|}Wntk
rgYnXt|d}y|j|}Wntk
rYnjXy"t|d|d|d|}Wnt	t
fk
rYn-Xtd||t|d|d|d|S|j|}|j
||}	td	|tjr|dk	r|dk	rt|	|t|}y$|j|||td
|Wqtk
rYqXn|	S)zConcrete implementation of InspectLoader.get_code.

        Reading of bytecode requires path_stats to be implemented. To write
        bytecode, set_data must also be implemented.

        NrrrTr'z
{} matches {}rrzcode object from {}z
wrote {!r})rrrrar_rrer.rrrrrrjr	dont_write_bytecoderr#rd)
rXrrrrstrB
bytes_datarcode_objectrrrrAsN


	
	
	
zSourceLoader.get_codeNr)
rHrGrIr`rardrbrBrjrArrrrr^s


r^cspeZdZdZddZddZddZefdd	Zed
dZ	dd
Z
S)
FileLoaderzgBase file loader class which implements the loader protocol methods that
    require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the
        finder.N)rTr')rXrr'rrrrY7s	zFileLoader.__init__cCs"|j|jko!|j|jkS)N)r
rN)rXr
rrrr=szFileLoader.__eq__cCst|jt|jAS)N)hashrTr')rXrrr__hash__AszFileLoader.__hash__cstt|j|S)zdLoad a module from a file.

        This method is deprecated.  Use exec_module() instead.

        )superror1)rXr)r
rrr1Ds
zFileLoader.load_modulecCs|jS)z:Return the path to the source file as found by the finder.)r')rXrrrrrPszFileLoader.get_filenamecCs)tj|d}|jSWdQXdS)z'Return the data from path as raw bytes.rN)r=r>read)rXr'rErrrreUszFileLoader.get_data)rHrGrIrJrYrrqrr1rrerr)r
rro2sroc@s@eZdZdZddZddZdddd	Zd
S)r5z>Concrete implementation of SourceLoader using the file system.cCs$t|}i|jd6|jd6S)z!Return the metadata for the path.rr)r-st_mtimest_size)rXr'rlrrrra_szSourceFileLoader.path_statscCs"t|}|j||d|S)N_mode)rrb)rXrrrBr0rrrrddsz SourceFileLoader._cache_bytecoderwic	Cs5t|\}}g}x6|rPt|rPt|\}}|j|qWxt|D]v}t||}ytj|Wq^tk
rw^Yq^tk
r}zt	d||dSWYdd}~Xq^Xq^Wy!t
|||t	d|Wn5tk
r0}zt	d||WYdd}~XnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nzcreated {!r})r+r5r	r%rrmkdirFileExistsErrorr.rrF)	rXr'rBrwrrrrrfrrrrbis&
zSourceFileLoader.set_dataN)rHrGrIrJrardrbrrrrr5[sr5c@s.eZdZdZddZddZdS)r4z-Loader which handles sourceless file imports.cCsL|j|}|j|}t|d|d|}t|d|d|S)NrTr'r)rrerr)rXrr'rBrmrrrrAszSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nr)rXrrrrrBszSourcelessFileLoader.get_sourceN)rHrGrIrJrArBrrrrr4sr4c@seZdZdZddZddZddZedd	Zd
dZ	dd
Z
ddZeddZdS)ExtensionFileLoaderz]Loader for extension modules.

    The constructor is designed to work with FileFinder.

    cCs||_||_dS)N)rTr')rXrTr'rrrrYs	zExtensionFileLoader.__init__cCs"|j|jko!|j|jkS)N)r
rN)rXr
rrrrszExtensionFileLoader.__eq__cCst|jt|jAS)N)rprTr')rXrrrrqszExtensionFileLoader.__hash__cCst|ttj||j}WdQXtd|j|j|}|r|t|dr|t|jdg|_	n||_
|j|_|s|jj
dd|_n|S)zLoad an extension module.Nz!extension module loaded from {!r}r#rer)rVrr|load_dynamicr'rrrKr+r#rrHr'r$)rXrrrrrrr1s
		zExtensionFileLoader.load_modulecs0t|jdtfddtDS)z1Return True if the extension module is a package.r c3s|]}d|kVqdS)rYNr)rsuffix)	file_namerrr^sz1ExtensionFileLoader.is_package.<locals>.<genexpr>)r+r'r_EXTENSION_SUFFIXES)rXrr)r}rrszExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nr)rXrrrrrAszExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nr)rXrrrrrBszExtensionFileLoader.get_sourcecCs|jS)z:Return the path to the source file as found by the finder.)r')rXrrrrrsz ExtensionFileLoader.get_filenameN)
rHrGrIrJrYrrqrr1rrArBrrrrrrzsrzc@seZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZddZdS)_NamespacePatha&Represents a namespace package's path.  It uses the module name
    to find its parent module, and from there it looks up the parent's
    __path__.  When this changes, the module's own path is recomputed,
    using path_finder.  For top-level modules, the parent module's path
    is sys.path.cCs4||_||_t|j|_||_dS)N)rWr*r_get_parent_path_last_parent_path_path_finder)rXrTr'path_finderrrrrYs		z_NamespacePath.__init__cCs5|jjd\}}}|dkr+dS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rr"r	r'r#)zsyszpath)rWr$)rXrdotrprrr_find_parent_path_namessz&_NamespacePath._find_parent_path_namescCs&|j\}}ttj||S)N)rrMr	rZ)rXparent_module_namepath_attr_namerrrrsz_NamespacePath._get_parent_pathcCst|j}||jkrx|j|j|}|dk	rl|jdkrl|jrl|j|_qln||_n|jS)N)rrrrrWrrr*)rXparent_pathrrrr_recalculates	z_NamespacePath._recalculatecCst|jS)N)iterr)rXrrr__iter__sz_NamespacePath.__iter__cCst|jS)N)r#r)rXrrr__len__sz_NamespacePath.__len__cCsdj|jS)Nz_NamespacePath({!r}))r7r*)rXrrrrwsz_NamespacePath.__repr__cCs||jkS)N)r)rXitemrrr__contains__sz_NamespacePath.__contains__cCs|jj|dS)N)r*r	)rXrrrrr	sz_NamespacePath.appendN)
rHrGrIrJrYrrrrrrwrr	rrrrrs

rc@sjeZdZddZeddZddZddZd	d
ZddZ	d
dZ
dS)r(cCst||||_dS)N)rr*)rXrTr'rrrrrYsz_NamespaceLoader.__init__cCsdj|jS)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (namespace)>)r7rH)r<rrrrrsz_NamespaceLoader.module_reprcCsdS)NTr)rXrrrrrsz_NamespaceLoader.is_packagecCsdS)Nr"r)rXrrrrrBsz_NamespaceLoader.get_sourcecCstdddddS)Nr"z<string>rrhT)ri)rXrrrrrAsz_NamespaceLoader.get_codecCsdS)Nr)rXrrrrr.!sz_NamespaceLoader.exec_modulecCstd|jt||S)zbLoad a namespace module.

        This method is deprecated.  Use exec_module() instead.

        z&namespace module loaded with path {!r})rr*r)rXrrrrr1$sz_NamespaceLoader.load_moduleN)rHrGrIrYrDrrrBrAr.r1rrrrr(s	r(c@seZdZdZeddZeddZeddZedd	Zed
ddZ	ed
d
d
dZ
ed
ddZd
S)
PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs:x3tjjD]"}t|dr|jqqWdS)z}Call the invalidate_caches() method on all path entry finders
        stored in sys.path_importer_caches (where implemented).invalidate_cachesN)r	path_importer_cachevaluesrKr)r<finderrrrr5szPathFinder.invalidate_cachescCs^tjstjdtnx;tjD],}y||SWq&tk
rQw&Yq&Xq&WdSdS)zqSearch sequence of hooks for a finder for 'path'.

        If 'hooks' is false then use sys.path_hooks.

        zsys.path_hooks is emptyN)r	
path_hooksrrrr)r<r'hookrrr_path_hooks=s	
zPathFinder._path_hookscCsa|dkrtj}nytj|}Wn.tk
r\|j|}|tj|<YnX|S)zGet the finder for the path entry from sys.path_importer_cache.

        If the path entry is not in the cache, find the appropriate finder
        and cache it. If no finder is available, store None.

        r")rr4r	rr`r)r<r'rrrr_path_importer_cacheNs
zPathFinder._path_importer_cachecCsqt|dr'|j|\}}n|j|}g}|dk	rUt||St|d}||_|S)Nr)rKrr?rrr)r<rrrrrrrr_legacy_get_spec_s
	zPathFinder._legacy_get_specNc	Csg}x|D]}t|ttfs.q
n|j|}|dk	r
t|drm|j||}n|j||}|dkrq
n|jdk	r|S|j}|dkrt	dn|j
|q
q
Wt|d}||_|SdS)z?Find the loader or namespace_path for this module/package name.Nr>zspec missing loader)rstrbytesrrKr>rrrrrr)	r<rr'r=namespace_pathentryrrrrrr	_get_specns(
		zPathFinder._get_speccCs|dkrtj}n|j|||}|dkr=dS|jdkr|j}|rd|_t|||j|_|SdSn|SdS)zbfind the module on sys.path or 'path' based on sys.path_hooks and
        sys.path_importer_cache.N	namespace)r	r'rrrrr)r<rr'r=rrrrrr>s		zPathFinder.find_speccCs)|j||}|dkr"dS|jS)zfind the module on sys.path or 'path' based on sys.path_hooks and
        sys.path_importer_cache.

        This method is deprecated.  Use find_spec() instead.

        N)r>r)r<rr'rrrrr?szPathFinder.find_module)rHrGrIrJrDrrrrrr>r?rrrrr1src@seZdZdZddZddZeZddZdd	Z	d
ddZ
d
dZeddZ
ddZd
S)
FileFinderzFile-based finder.

    Interactions with the file system are cached for performance, being
    refreshed when the directory the finder is handling has been modified.

    cszg}x4|D],\}|jfdd|Dq
W||_|pOd|_d|_t|_t|_dS)zInitialize with the path to search on and a variable number of
        2-tuples containing the loader and the file suffixes the loader
        recognizes.c3s|]}|fVqdS)Nr)rr|)rrrr^sz&FileFinder.__init__.<locals>.<genexpr>rr Nr)r_loadersr'_path_mtimeset_path_cache_relaxed_path_cache)rXr'loader_detailsloadersrr)rrrYs$		zFileFinder.__init__cCs
d|_dS)zInvalidate the directory mtime.r Nr)r)rXrrrrszFileFinder.invalidate_cachescCs;|j|}|dkr%dgfS|j|jp7gfS)zTry to find a loader for the specified module, or the namespace
        package portions. Returns (loader, list-of-portions).

        This method is deprecated.  Use find_spec() instead.

        N)r>rr)rXrrrrrrs
zFileFinder.find_loadercCs(|||}t||d|d|S)Nrr)r)rXrrr'rr=rrrrrszFileFinder._get_specNcCsd}|jdd}y"t|jp1tjj}Wntk
rUd
}YnX||jkr{|j||_nt	r|j
}|j}n|j}|}||kr3t
|j|}xg|jD]M\}	}
d|	}t
||}t|r|j|
|||g|SqWt|}nx~|jD]s\}	}
t
|j||	}tdj|dd||	|kr=t|r|j|
||d|Sq=q=W|rtd	j|t|d}
|g|
_|
SdS)z}Try to find a loader for the specified module, or the namespace
        package portions. Returns (loader, list-of-portions).Frrr rYz	trying {}rNzpossible namespace for {}r)r$r-r'rr4rur.r_fill_cacherrrrrrr3rr5rr7rr)rXrr=is_namespacetail_modulercachecache_module	base_pathr|r
init_filename	full_pathrrrrr>sD"

			
  zFileFinder.find_specc	
Cs|j}ytj|p!tj}Wn!tttfk
rKg}YnXtjj	dspt
||_not
}xZ|D]R}|jd\}}}|rdj
||j}n|}|j|qW||_tjj	tr
dd|D|_ndS)zDFill the cache of potential modules and packages for this directory.rrz{}.{}cSsh|]}|jqSr)r)rfnrrr	<setcomp>*s	z)FileFinder._fill_cache.<locals>.<setcomp>N)r'rlistdirr4FileNotFoundErrorPermissionErrorNotADirectoryErrorr	r
rrrrr7raddrr)	rXr'contentslower_suffix_contentsrrTrr|new_namerrrr
s"		
	zFileFinder._fill_cachecsfdd}|S)aA class method which returns a closure to use on sys.path_hook
        which will return an instance using the specified loaders and the path
        called on the closure.

        If the path called on the closure is not a directory, ImportError is
        raised.

        cs.t|s!tdd|n|S)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedr')r5r)r')r<rrrpath_hook_for_FileFinder6sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)r<rrr)r<rr	path_hook,s
zFileFinder.path_hookcCsdj|jS)NzFileFinder({!r}))r7r')rXrrrrw>szFileFinder.__repr__)rHrGrIrJrYrrr?rrr>rrDrrwrrrrrs-rc@s.eZdZdZddZddZdS)_ImportLockContextz$Context manager for the import lock.cCstjdS)zAcquire the import lock.N)r|r0)rXrrrr\Hsz_ImportLockContext.__enter__cCstjdS)z<Release the import lock regardless of any raised exceptions.N)r|r})rXexc_type	exc_value
exc_tracebackrrrrbLsz_ImportLockContext.__exit__N)rHrGrIrJr\rbrrrrrDsrcCs[|jd|d}t||kr7tdn|d}|rWdj||S|S)z2Resolve a relative module name to an absolute one.rr z2attempted relative import beyond top-level packagerez{}.{})r&r#rr7)rTpackagelevelbitsrrrr
_resolve_nameQs

rcCs/|j||}|dkr"dSt||S)N)r?r)rrTr'rrrr_find_spec_legacyZsrc	Cs"tjstjdtn|tjk}xtjD]}t]y
|j}Wn6tk
rt	|||}|dkrw5nYnX||||}WdQX|dk	r5|r|tjkrtj|}y
|j
}Wntk
r|SYqX|dkr|S|Sq|Sq5q5WdSdS)zFind a module's loader.zsys.meta_path is emptyN)r		meta_pathrrrrZrr>rrr)	rTr'r=	is_reloadrr>rrrrrr
_find_speccs0	





	rcCst|ts-tdjt|n|dkrHtdn|rt|tsltdq|tjkrd}t|j|qn|r|dkrtdndS)zVerify arguments are "sane".zmodule name must be str, not {}rezlevel must be >= 0z__package__ not set to a stringz=Parent module {!r} not loaded, cannot perform relative importzEmpty module nameN)	rr	TypeErrorr7rSrr	rZSystemError)rTrrrrrr
_sanity_checksrzNo module named z{!r}cCs4d}|jdd}|r|tjkr>t||n|tjkrXtj|Stj|}y
|j}Wqtk
rtdj||}t|d|YqXnt	||}|dkrttj|d|nt
|j}|r0tj|}t||jdd|n|S)Nrrez; {!r} is not a packagerTr)
r$r	rZrr#r_ERR_MSGr7rrrr3rL)rTimport_r'r
parent_modulerrrrrr_find_and_load_unlockeds*



 rc
Cs$t|t||SWdQXdS)z6Find and load the module, and release the import lock.N)ryr)rTrrrr_find_and_loads
rcCst||||dkr1t|||}ntj|tjkrWt|tStj|}|dkrtjdj	|}t
|d|nt||S)a2Import and return the module based on its name, the package the call is
    being made from, and the level adjustment.

    This function represents the greatest common denominator of functionality
    between import_module and __import__. This includes setting __package__ if
    the loader did not.

    reNz(import of {} halted; None in sys.modulesrT)rrr|r0r	rZr_gcd_importr}r7rr)rTrrrrrrrrs	



	
rcCst|drd|krYt|}|jdt|drY|j|jqYnx|D]}t||s`dj|j|}yt||Wqtk
r}z5t	|j
tr|j|krw`qnWYdd}~XqXq`q`Wn|S)zFigure out what __import__ should return.

    The import_ parameter is a callable which takes the name of module to
    import. It is required to decouple the function from assuming importlib's
    import implementation is desired.

    r#*__all__z{}.{}N)
rKr"removerrr7rHrrrr_ERR_MSG_PREFIXrT)rfromlistrr	from_namerfrrr_handle_fromlists"


	 rcCsN|jd}|dkrJ|d}d|krJ|jdd}qJn|S)zCalculate what __package__ should be.

    __package__ is not guaranteed to be defined or could be set to None
    to represent that its proper value is unknown.

    r'NrHr#rre)ror$)globalsrrrr_calc___package__s
rcCs7ttjf}ttf}ttf}|||gS)z_Returns a list of file-based module loaders.

    Each item is a tuple (loader, suffixes).
    )rzr|extension_suffixesr5rr4r)
extensionssourcebytecoderrrr	src	Cs|dkrt|}n6|dk	r-|ni}t|}t|||}|s|dkrzt|jddS|s|St|t|jdd}tj|jdt|j|Snt||tSdS)aImport a module.

    The 'globals' argument is used to infer where the import is occuring from
    to handle relative imports. The 'locals' argument is ignored. The
    'fromlist' argument specifies what should exist as attributes on the module
    being imported (e.g. ``from module import <fromlist>``).  The 'level'
    argument represents the package location to import from in a relative
    import (e.g. ``from ..pkg import mod`` would have a 'level' of 2).

    reNr)rrrr#r	rZrHr)	rTrlocalsrrrglobals_rcut_offrrr
__import__	s#(rcCsDtj|}|dkr.td|nt|}|jS)Nzno built-in module named )r:r>rrr3)rTrrrrr_builtin_from_name5	s
rcCs|a|atjjr!tantatt}xtjj	D]y\}}t
||rC|tjkrvt}ntj
|rCt}nqCt||}t|}|j|qCqCWtjt}xIdD]A}	|	tjkrt|	}
n
tj|	}
t||	|
qWddgfdddgff}x|D]~\}}
td	d
|
Dslt|
d}|tjkrtj|}PqAyt|}PWqAtk
rwAYqAXqAWtdt|d
|t|d|t|ddj|
ytd}Wntk
r2d}YnXt|d|td}t|d||dkrtd}t|d|nt|dttjtj|dkrtjddtkrdt_ qndS)zSetup importlib by importing needed built-in modules and injecting them
    into the global namespace.

    As sys is needed for sys.modules access and _imp is needed to load built-in
    modules, those two modules must be explicitly passed in.

    r=rbuiltinsrposix/nt\css!|]}t|dkVqdS)r N)r#)rrrrrr^i	sz_setup.<locals>.<genexpr>rezimportlib requires posix or ntrrrr"rfNrwinregrKrz.pywz_d.pydT)z_ioz	_warningszbuiltinszmarshal)!r|r	rrrrrrSrZitemsrrr:rrEr$rr+rHrrLallrvrrr
r~rrrr	rJrR)
sys_module_imp_modulemodule_typerTrrrrself_modulebuiltin_namebuiltin_module
os_details
builtin_osrr	os_module
thread_moduleweakref_module
winreg_modulerrr_setup=	sl				


!




rcCst||t}tjjtj|gtjjt	tjjt
tjdkrttjjt
ntjjtdS)z2Install importlib as the implementation of import.rN)rrr	rrrrrr	r:rErrHrJr)rrsupported_loadersrrr_install	s
	r)zwinzcygwinzdarwin)\rJrr
rrrr+r-r2r3r5rFrRrUrS__code__rrVrrnrurcrdrxryr{rrrrrr_RAW_MAGIC_NUMBERrrrrrrrrrrrrrrrrrrrrrrobjectrrr$rr9r:rErJr[r^ror5r4r~rzrr(rrrrrrrrrrrrrrrrrrrrrrr<module>s
	Dr			7
$j	?-FG?n)+99&
		(
 #W