Your IP : 18.116.67.9


Current Path : /lib64/python3.6/importlib/__pycache__/
Upload File :
Current File : //lib64/python3.6/importlib/__pycache__/_bootstrap_external.cpython-36.opt-1.pyc

3


 \���@s�dZd[Zd\ZeeZdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zd]dd�Z
ee
j�Zdjdd�dZejed�ZdZdZdgZd gZeZZd^d!d"�d#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Z d-d.�Z!d/d0�Z"d_d1d2�Z#d`d3d4�Z$dad6d7�Z%d8d9�Z&e'�Z(dbd!e(d:�d;d<�Z)Gd=d>�d>�Z*Gd?d@�d@�Z+GdAdB�dBe+�Z,GdCdD�dD�Z-GdEdF�dFe-e,�Z.GdGdH�dHe-e+�Z/gZ0GdIdJ�dJe-e+�Z1GdKdL�dL�Z2GdMdN�dN�Z3GdOdP�dP�Z4GdQdR�dR�Z5dcdSdT�Z6dUdV�Z7dWdX�Z8dYdZ�Z9d!S)da^Core implementation of path-based 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.

�win�cygwin�darwincs<tjjt�r0tjjt�rd�nd��fdd�}ndd�}|S)N�PYTHONCASEOKsPYTHONCASEOKcs
�tjkS)z5True if filenames must be checked case-insensitively.)�_os�environ�)�keyr�+/usr/lib64/python3.6/_bootstrap_external.py�_relax_case%sz%_make_relax_case.<locals>._relax_casecSsdS)z5True if filenames must be checked case-insensitively.Frrrrr	r
)s)�sys�platform�
startswith�_CASE_INSENSITIVE_PLATFORMS�#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)r
r)rr	�_make_relax_casesrcCst|�d@jdd�S)z*Convert a 32-bit integer to little-endian.l����little)�int�to_bytes)�xrrr	�_w_long/srcCstj|d�S)z/Convert 4 bytes in little-endian to an integer.r)r�
from_bytes)�	int_bytesrrr	�_r_long4srcGstjdd�|D��S)zReplacement for os.path.join().cSsg|]}|r|jt��qSr)�rstrip�path_separators)�.0�partrrr	�
<listcomp>;sz_path_join.<locals>.<listcomp>)�path_sep�join)�
path_partsrrr	�
_path_join9s
r"cCs`tt�dkr$|jt�\}}}||fSx2t|�D]&}|tkr.|j|dd�\}}||fSq.Wd|fS)z Replacement for os.path.split().�)�maxsplit�)�lenr�
rpartitionr�reversed�rsplit)�path�front�_�tailrrrr	�_path_split?s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).

    )r�stat)r*rrr	�
_path_statKsr0cCs0yt|�}Wntk
r dSX|jd@|kS)z1Test whether the path is the specified mode type.Fi�)r0�OSError�st_mode)r*�mode�	stat_inforrr	�_path_is_mode_typeUs
r5cCs
t|d�S)zReplacement for os.path.isfile.i�)r5)r*rrr	�_path_isfile^sr6cCs|stj�}t|d�S)zReplacement for os.path.isdir.i@)r�getcwdr5)r*rrr	�_path_isdircsr8�cCs�dj|t|��}tj|tjtjBtjB|d@�}y2tj|d��}|j	|�WdQRXtj
||�Wn:tk
r�ytj|�Wntk
r�YnX�YnXdS)z�Best-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{}.{}i��wbN)
�format�idr�open�O_EXCL�O_CREAT�O_WRONLY�_io�FileIO�write�replacer1�unlink)r*�datar3�path_tmp�fd�filerrr	�
_write_atomicjsrJi3
�rs
�__pycache__zopt-z.pyz.pycN)�optimizationcCs�|dk	r4tjdt�|dk	r(d}t|��|r0dnd}tj|�}t|�\}}|jd�\}}}tj	j
}	|	dkrrtd��dj|r~|n|||	g�}
|dkr�tj
jdkr�d}ntj
j}t|�}|dkr�|j�s�td	j|���d
j|
t|�}
t|t|
td�S)a�Given the path to a .py file, return the path to its .pyc file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc file calculated as if the .py file were imported.

    The 'optimization' parameter controls the presumed optimization level of
    the bytecode file. If 'optimization' is not None, the string representation
    of the argument is taken and verified to be alphanumeric (else ValueError
    is raised).

    The debug_override parameter is deprecated. If debug_override is not None,
    a True value is the same as setting 'optimization' to the empty string
    while a False value is equivalent to setting 'optimization' to '1'.

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

    NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Noner%r#�.z$sys.implementation.cache_tag is None�z{!r} is not alphanumericz{}.{}{})�	_warnings�warn�DeprecationWarning�	TypeErrorr�fspathr.r'r�implementation�	cache_tag�NotImplementedErrorr �flags�optimize�str�isalnum�
ValueErrorr;�_OPTr"�_PYCACHE�BYTECODE_SUFFIXES)r*�debug_overriderM�message�headr-�base�sep�rest�tag�almost_filenamerrr	�cache_from_sources0
rhcCs�tjjdkrtd��tj|�}t|�\}}t|�\}}|tkrNtdj	t|���|j
d�}|dkrptdj	|���nV|dkr�|jdd�d}|jt
�s�tdj	t
���|tt
�d�}|j�s�td	j	|���|jd�d
}t||td
�S)
anGiven the path to a .pyc. file, return the path to its .py file.

    The .pyc file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc file.  If path does
    not conform to PEP 3147/488 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}rNrK�z!expected only 2 or 3 dots in {!r}z9optimization portion of filename does not start with {!r}z4optimization level {!r} is not an alphanumeric valuerO>rKri���)rrUrVrWrrTr.r^r\r;�countr)r
r]r&r[�	partitionr"�SOURCE_SUFFIXES)r*rb�pycache_filename�pycache�	dot_countrM�	opt_level�
base_filenamerrr	�source_from_cache4s.	




rscCs�t|�dkrdS|jd�\}}}|s:|j�dd�dkr>|Syt|�}Wn$ttfk
rn|dd	�}YnXt|�r||S|S)
z�Convert a bytecode file path to a source path (if possible).

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

    rONrNrir#�py������rv)r&r'�lowerrsrWr\r6)�
bytecode_pathrer,�	extension�source_pathrrr	�_get_sourcefileVsr{cCsH|jtt��r.yt|�Stk
r*YqDXn|jtt��r@|SdSdS)N)�endswith�tuplermrhrWr_)�filenamerrr	�_get_cachedisrcCs4yt|�j}Wntk
r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.i��)r0r2r1)r*r3rrr	�
_calc_modeus
r�csDd�fdd�	}y
tj}Wntk
r4dd�}YnX||��|S)z�Decorator 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.

    NcsB|dkr|j}n |j|kr0td|j|f|d���||f|�|�S)Nzloader for %s cannot handle %s)�name)r��ImportError)�selfr��args�kwargs)�methodrr	�_check_name_wrapper�s
z(_check_name.<locals>._check_name_wrappercSs<x(dD] }t||�rt||t||��qW|jj|j�dS)N�
__module__�__name__�__qualname__�__doc__)r�r�r�r�)�hasattr�setattr�getattr�__dict__�update)�new�oldrDrrr	�_wrap�s

z_check_name.<locals>._wrap)N)�
_bootstrapr��	NameError)r�r�r�r)r�r	�_check_name�s

r�cCs<|j|�\}}|dkr8t|�r8d}tj|j|d�t�|S)z�Try 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__rO)�find_loaderr&rPrQr;�
ImportWarning)r��fullname�loader�portions�msgrrr	�_find_module_shim�s

r�cCs�i}|dk	r||d<nd}|dk	r*||d<|dd�}|dd�}|dd�}|tkr|dj||�}tjd	|�t|f|��nVt|�dkr�d
j|�}tjd	|�t|��n*t|�dkr�dj|�}tjd	|�t|��|dk	�r|yt|d�}	Wntk
�rYn2Xt	|�|	k�r4d
j|�}tjd	|�t|f|��y|dd@}
Wntk
�rZYn"Xt	|�|
k�r|td
j|�f|��|dd�S)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.

    Nr�z
<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_NUMBERr;r��_verbose_messager�r&�EOFErrorr�KeyErrorr)rF�source_statsr�r*�exc_details�magic�
raw_timestamp�raw_sizera�source_mtime�source_sizerrr	�_validate_bytecode_header�sL





r�cCsPtj|�}t|t�r8tjd|�|dk	r4tj||�|Stdj	|�||d��dS)z<Compile bytecode as returned by _validate_bytecode_header().zcode object from {!r}NzNon-code object in {!r})r�r*)
�marshal�loads�
isinstance�
_code_typer�r��_imp�_fix_co_filenamer�r;)rFr�rxrz�coderrr	�_compile_bytecode�s


r�rOcCs8tt�}|jt|��|jt|��|jtj|��|S)zPCompile a code object into bytecode for writing out to a byte-compiled
    file.)�	bytearrayr��extendrr��dumps)r�r�r�rFrrr	�_code_to_bytecode�s
r�cCs>ddl}tj|�j}|j|�}tjdd�}|j|j|d��S)zyDecode bytes representing source code and return the string.

    Universal newline support is used in the decoding.
    rONT)�tokenizerA�BytesIO�readline�detect_encoding�IncrementalNewlineDecoder�decode)�source_bytesr��source_bytes_readline�encoding�newline_decoderrrr	�
decode_source�s

r�)r��submodule_search_locationsc	Cs|dkr<d}t|d�rFy|j|�}WqFtk
r8YqFXn
tj|�}tj|||d�}d|_|dkr�x6t�D](\}}|j	t
|��rl|||�}||_PqlWdS|tkr�t|d�r�y|j
|�}Wntk
r�Yq�X|r�g|_n||_|jgk�r|�rt|�d}|jj|�|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>�get_filename)�originT�
is_packagerO)r�r�r�rrTr��
ModuleSpec�
_set_fileattr�_get_supported_file_loadersr|r}r��	_POPULATEr�r�r.�append)	r��locationr�r��spec�loader_class�suffixesr��dirnamerrr	�spec_from_file_locations>



r�c@sPeZdZdZdZdZdZedd��Zedd��Z	edd
d��Z
edd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}\DebugFcCs2ytjtj|�Stk
r,tjtj|�SXdS)N)�_winreg�OpenKey�HKEY_CURRENT_USERr1�HKEY_LOCAL_MACHINE)�clsrrrr	�_open_registry\sz$WindowsRegistryFinder._open_registrycCsp|jr|j}n|j}|j|dtjdd�d�}y&|j|��}tj|d�}WdQRXWnt	k
rjdSX|S)Nz%d.%drK)r��sys_versionr%)
�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEYr;r�version_infor�r��
QueryValuer1)r�r��registry_keyr�hkey�filepathrrr	�_search_registrycsz&WindowsRegistryFinder._search_registryNcCsx|j|�}|dkrdSyt|�Wntk
r6dSXx:t�D]0\}}|jt|��r@tj||||�|d�}|Sq@WdS)N)r�)r�r0r1r�r|r}r��spec_from_loader)r�r�r*�targetr�r�r�r�rrr	�	find_specrs
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�r�r*r�rrr	�find_module�sz!WindowsRegistryFinder.find_module)NN)N)r�r�r�r�r�r�r��classmethodr�r�r�r�rrrr	r�Psr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
_LoaderBasicszSBase class of common code needed by both SourceLoader and
    SourcelessFileLoader.cCs@t|j|��d}|jdd�d}|jd�d}|dko>|dkS)z�Concrete implementation of InspectLoader.is_package by checking if
        the path returned by get_filename has a filename of '__init__.py'.r#rNrOrK�__init__)r.r�r)r')r�r�r~�
filename_base�	tail_namerrr	r��sz_LoaderBasics.is_packagecCsdS)z*Use default semantics for module creation.Nr)r�r�rrr	�
create_module�sz_LoaderBasics.create_modulecCs8|j|j�}|dkr$tdj|j���tjt||j�dS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)�get_coder�r�r;r��_call_with_frames_removed�execr�)r��moduler�rrr	�exec_module�s

z_LoaderBasics.exec_modulecCstj||�S)zThis module is deprecated.)r��_load_module_shim)r�r�rrr	�load_module�sz_LoaderBasics.load_moduleN)r�r�r�r�r�r�r�r�rrrr	r��s
r�c@sJeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�d
d�Zdd�Z	dS)�SourceLoadercCst�dS)z�Optional 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)r�r*rrr	�
path_mtime�szSourceLoader.path_mtimecCsd|j|�iS)a�Optional 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�)r�r*rrr	�
path_stats�szSourceLoader.path_statscCs|j||�S)z�Optional 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)r�rz�
cache_pathrFrrr	�_cache_bytecode�szSourceLoader._cache_bytecodecCsdS)z�Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.
        Nr)r�r*rFrrr	r��szSourceLoader.set_datacCsR|j|�}y|j|�}Wn0tk
rH}ztd|d�|�WYdd}~XnXt|�S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data())r�N)r��get_datar1r�r�)r�r�r*r��excrrr	�
get_source�s
zSourceLoader.get_sourcer#)�	_optimizecCstjt||dd|d�S)z�Return the code object compiled from source.

        The 'data' argument can be any object type that compile() supports.
        r�T)�dont_inheritrY)r�r��compile)r�rFr*rrrr	�source_to_code�szSourceLoader.source_to_codec
+Cs^|j|�}d}yt|�}Wntk
r2d}Yn�Xy|j|�}Wntk
rVYn~Xt|d�}y|j|�}Wntk
r�YnNXyt||||d�}Wnt	t
fk
r�Yn Xtjd||�t
||||d�S|j|�}|j||�}	tjd|�tj�rZ|dk	�rZ|dk	�rZt|	|t|��}y|j|||�tjd|�Wntk
�rXYnX|	S)z�Concrete implementation of InspectLoader.get_code.

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

        Nr�)r�r�r*z
{} matches {})r�rxrzzcode object from {}z
wrote {!r})r�rhrWr�r�rr�r1r�r�r�r�r�r�rr�dont_write_bytecoder�r&r�)
r�r�rzr�rx�strF�
bytes_datar��code_objectrrr	r��sN




zSourceLoader.get_codeNrv)
r�r�r�r�r�r�r�rrr�rrrr	r��s


r�csPeZdZdZdd�Zdd�Zdd�Ze�fdd	��Zed
d��Z	dd
�Z
�ZS)�
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)r�r*)r�r�r*rrr	r� szFileLoader.__init__cCs|j|jko|j|jkS)N)�	__class__r�)r��otherrrr	�__eq__&szFileLoader.__eq__cCst|j�t|j�AS)N)�hashr�r*)r�rrr	�__hash__*szFileLoader.__hash__cstt|�j|�S)zdLoad a module from a file.

        This method is deprecated.  Use exec_module() instead.

        )�superr	r�)r�r�)r
rr	r�-s
zFileLoader.load_modulecCs|jS)z:Return the path to the source file as found by the finder.)r*)r�r�rrr	r�9szFileLoader.get_filenamec	Cs tj|d��
}|j�SQRXdS)z'Return the data from path as raw bytes.�rN)rArB�read)r�r*rIrrr	r�>szFileLoader.get_data)r�r�r�r�r�rrr�r�r�r��
__classcell__rr)r
r	r	sr	c@s.eZdZdZdd�Zdd�Zdd�dd	�Zd
S)�SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|�}|j|jd�S)z!Return the metadata for the path.)r�r�)r0�st_mtime�st_size)r�r*rrrr	r�HszSourceFileLoader.path_statscCst|�}|j|||d�S)N)�_mode)r�r�)r�rzrxrFr3rrr	r�Msz SourceFileLoader._cache_bytecodei�)rc	Cs�t|�\}}g}x(|r8t|�r8t|�\}}|j|�qWxlt|�D]`}t||�}ytj|�WqDtk
rvwDYqDtk
r�}zt	j
d||�dSd}~XqDXqDWyt|||�t	j
d|�Wn0tk
r�}zt	j
d||�WYdd}~XnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nzcreated {!r})r.r8r�r(r"r�mkdir�FileExistsErrorr1r�r�rJ)	r�r*rFr�parentr~r!rr�rrr	r�Rs*
zSourceFileLoader.set_dataN)r�r�r�r�r�r�r�rrrr	rDsrc@s eZdZdZdd�Zdd�ZdS)�SourcelessFileLoaderz-Loader which handles sourceless file imports.cCs0|j|�}|j|�}t|||d�}t|||d�S)N)r�r*)r�rx)r�r�r�r�)r�r�r*rFrrrr	r�us

zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nr)r�r�rrr	r{szSourcelessFileLoader.get_sourceN)r�r�r�r�r�rrrrr	rqsrc@s\eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zedd��Z
dS)�ExtensionFileLoaderz]Loader for extension modules.

    The constructor is designed to work with FileFinder.

    cCs||_||_dS)N)r�r*)r�r�r*rrr	r��szExtensionFileLoader.__init__cCs|j|jko|j|jkS)N)r
r�)r�rrrr	r�szExtensionFileLoader.__eq__cCst|j�t|j�AS)N)r
r�r*)r�rrr	r�szExtensionFileLoader.__hash__cCs$tjtj|�}tjd|j|j�|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})r�r�r��create_dynamicr�r�r*)r�r�r�rrr	r��s

z!ExtensionFileLoader.create_modulecCs$tjtj|�tjd|j|j�dS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)r�r�r��exec_dynamicr�r�r*)r�r�rrr	r��szExtensionFileLoader.exec_modulecs$t|j�d�t�fdd�tD��S)z1Return True if the extension module is a package.r#c3s|]}�d|kVqdS)r�Nr)r�suffix)�	file_namerr	�	<genexpr>�sz1ExtensionFileLoader.is_package.<locals>.<genexpr>)r.r*�any�EXTENSION_SUFFIXES)r�r�r)rr	r��szExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nr)r�r�rrr	r��szExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nr)r�r�rrr	r�szExtensionFileLoader.get_sourcecCs|jS)z:Return the path to the source file as found by the finder.)r*)r�r�rrr	r��sz ExtensionFileLoader.get_filenameN)r�r�r�r�r�rrr�r�r�r�rr�r�rrrr	r�src@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
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.cCs$||_||_t|j��|_||_dS)N)�_name�_pathr}�_get_parent_path�_last_parent_path�_path_finder)r�r�r*�path_finderrrr	r��sz_NamespacePath.__init__cCs&|jjd�\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rNr%rr*�__path__)rr*)r$r')r�r�dot�merrr	�_find_parent_path_names�sz&_NamespacePath._find_parent_path_namescCs|j�\}}ttj||�S)N)r-r�r�modules)r��parent_module_name�path_attr_namerrr	r&�sz_NamespacePath._get_parent_pathcCsPt|j��}||jkrJ|j|j|�}|dk	rD|jdkrD|jrD|j|_||_|jS)N)r}r&r'r(r$r�r�r%)r��parent_pathr�rrr	�_recalculate�s
z_NamespacePath._recalculatecCst|j��S)N)�iterr2)r�rrr	�__iter__�sz_NamespacePath.__iter__cCs||j|<dS)N)r%)r��indexr*rrr	�__setitem__�sz_NamespacePath.__setitem__cCst|j��S)N)r&r2)r�rrr	�__len__�sz_NamespacePath.__len__cCsdj|j�S)Nz_NamespacePath({!r}))r;r%)r�rrr	�__repr__�sz_NamespacePath.__repr__cCs||j�kS)N)r2)r��itemrrr	�__contains__�sz_NamespacePath.__contains__cCs|jj|�dS)N)r%r�)r�r9rrr	r��sz_NamespacePath.appendN)r�r�r�r�r�r-r&r2r4r6r7r8r:r�rrrr	r#�s

r#c@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)�_NamespaceLoadercCst|||�|_dS)N)r#r%)r�r�r*r)rrr	r��sz_NamespaceLoader.__init__cCsdj|j�S)zsReturn repr for the module.

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

        z<module {!r} (namespace)>)r;r�)r�r�rrr	�module_repr�sz_NamespaceLoader.module_reprcCsdS)NTr)r�r�rrr	r�sz_NamespaceLoader.is_packagecCsdS)Nr%r)r�r�rrr	rsz_NamespaceLoader.get_sourcecCstddddd�S)Nr%z<string>r�T)r)r)r�r�rrr	r�sz_NamespaceLoader.get_codecCsdS)z*Use default semantics for module creation.Nr)r�r�rrr	r�sz_NamespaceLoader.create_modulecCsdS)Nr)r�r�rrr	r�sz_NamespaceLoader.exec_modulecCstjd|j�tj||�S)zbLoad a namespace module.

        This method is deprecated.  Use exec_module() instead.

        z&namespace module loaded with path {!r})r�r�r%r�)r�r�rrr	r�sz_NamespaceLoader.load_moduleN)r�r�r�r�r�r<r�rr�r�r�r�rrrr	r;�s	r;c@sjeZdZdZedd��Zedd��Zedd��Zedd	��Zeddd��Z	edd
d��Z
eddd��Zd
S)�
PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs*x$tjj�D]}t|d�r|j�qWdS)z}Call the invalidate_caches() method on all path entry finders
        stored in sys.path_importer_caches (where implemented).�invalidate_cachesN)r�path_importer_cache�valuesr�r>)r��finderrrr	r>#s
zPathFinder.invalidate_cachescCsVtjdk	rtjrtjdt�x2tjD]$}y||�Stk
rHw&Yq&Xq&WdSdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r�
path_hooksrPrQr�r�)r�r*�hookrrr	�_path_hooks+szPathFinder._path_hookscCsf|dkr*ytj�}Wntk
r(dSXytj|}Wn(tk
r`|j|�}|tj|<YnX|S)z�Get 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%N)rr7�FileNotFoundErrorrr?r�rD)r�r*rArrr	�_path_importer_cache8s
zPathFinder._path_importer_cachecCsRt|d�r|j|�\}}n|j|�}g}|dk	r<tj||�Stj|d�}||_|S)Nr�)r�r�r�r�r�r�r�)r�r�rAr�r�r�rrr	�_legacy_get_specNs

zPathFinder._legacy_get_specNc	Cs�g}x�|D]�}t|ttf�sq
|j|�}|dk	r
t|d�rH|j||�}n|j||�}|dkr^q
|jdk	rl|S|j}|dkr�t	d��|j
|�q
Wtj|d�}||_|SdS)z?Find the loader or namespace_path for this module/package name.Nr�zspec missing loader)
r�rZ�bytesrFr�r�rGr�r�r�r�r�r�)	r�r�r*r��namespace_path�entryrAr�r�rrr	�	_get_spec]s(



zPathFinder._get_speccCsd|dkrtj}|j|||�}|dkr(dS|jdkr\|j}|rVd|_t|||j�|_|SdSn|SdS)z�Try to find a spec for 'fullname' on sys.path or 'path'.

        The search is based on sys.path_hooks and sys.path_importer_cache.
        N�	namespace)rr*rKr�r�r�r#)r�r�r*r�r�rIrrr	r�}s
zPathFinder.find_speccCs|j||�}|dkrdS|jS)z�find 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�r�r*r�rrr	r��szPathFinder.find_module)N)NN)N)r�r�r�r�r�r>rDrFrGrKr�r�rrrr	r=s
r=c@sZeZdZdZdd�Zdd�ZeZdd�Zdd	�Z	ddd�Z
d
d�Zedd��Z
dd�Zd
S)�
FileFinderz�File-based finder.

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

    csXg}x(|D] \�}|j�fdd�|D��q
W||_|p:d|_d|_t�|_t�|_dS)z�Initialize 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)r�rr	r �sz&FileFinder.__init__.<locals>.<genexpr>rNr#Nrv)r��_loadersr*�_path_mtime�set�_path_cache�_relaxed_path_cache)r�r*�loader_details�loadersr�r)r�r	r��s
zFileFinder.__init__cCs
d|_dS)zInvalidate the directory mtime.r#Nrv)rO)r�rrr	r>�szFileFinder.invalidate_cachescCs*|j|�}|dkrdgfS|j|jp&gfS)z�Try 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�r�r�)r�r�r�rrr	r��s
zFileFinder.find_loadercCs|||�}t||||d�S)N)r�r�)r�)r�r�r�r*�smslr�r�rrr	rK�s
zFileFinder._get_specNcCsbd}|jd�d}yt|jp"tj��j}Wntk
rBd
}YnX||jkr\|j�||_t	�rr|j
}|j�}n
|j}|}||kr�t
|j|�}xH|jD]6\}	}
d|	}t
||�}t|�r�|j|
|||g|�Sq�Wt|�}xX|jD]N\}	}
t
|j||	�}tjd|dd�||	|kr�t|�r�|j|
||d|�Sq�W|�r^tjd	|�tj|d�}
|g|
_|
SdS)zoTry to find a spec for the specified module.

        Returns the matching spec, or None if not found.
        FrNrKr#r�z	trying {})�	verbosityNzpossible namespace for {}rv)r'r0r*rr7rr1rO�_fill_cacher
rRrwrQr"rNr6rKr8r�r�r�r�)r�r�r��is_namespace�tail_moduler��cache�cache_module�	base_pathrr��
init_filename�	full_pathr�rrr	r��sF




zFileFinder.find_specc	
Cs�|j}ytj|ptj��}Wntttfk
r:g}YnXtjj	d�sTt
|�|_nNt
�}x@|D]8}|jd�\}}}|r�dj
||j��}n|}|j|�q`W||_tjj	t�r�dd�|D�|_dS)zDFill the cache of potential modules and packages for this directory.rrNz{}.{}cSsh|]}|j��qSr)rw)r�fnrrr	�	<setcomp>sz)FileFinder._fill_cache.<locals>.<setcomp>N)r*r�listdirr7rE�PermissionError�NotADirectoryErrorrrr
rPrQrlr;rw�addrrR)	r�r*�contents�lower_suffix_contentsr9r�r+r�new_namerrr	rWs"

zFileFinder._fill_cachecs��fdd�}|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|�std|d���|f���S)z-Path hook for importlib.machinery.FileFinder.zonly directories are supported)r*)r8r�)r*)r�rSrr	�path_hook_for_FileFinder*sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)r�rSrhr)r�rSr	�	path_hook s
zFileFinder.path_hookcCsdj|j�S)NzFileFinder({!r}))r;r*)r�rrr	r82szFileFinder.__repr__)N)r�r�r�r�r�r>r�r�r�rKr�rWr�rir8rrrr	rM�s
0rMcCs�|jd�}|jd�}|sB|r$|j}n||kr8t||�}n
t||�}|sTt|||d�}y$||d<||d<||d<||d<Wntk
r�YnXdS)N�
__loader__�__spec__)r��__file__�
__cached__)�getr�rrr��	Exception)�nsr��pathname�	cpathnamer�r�rrr	�_fix_up_module8s"


rscCs&ttj�f}ttf}ttf}|||gS)z_Returns a list of file-based module loaders.

    Each item is a tuple (loader, suffixes).
    )rr��extension_suffixesrrmrr_)�
extensions�source�bytecoderrr	r�Osr�cCs�|atjatjatjt}x8dD]0}|tjkr:tj|�}n
tj|}t|||�q Wddgfdddgff}x`|D]P\}}|d	}|tjkr�tj|}Pqpytj|�}PWqptk
r�wpYqpXqpWtd
��t|d|�t|d|�t|d
dj|��ytjd�}	Wntk
�rd}	YnXt|d|	�tjd�}
t|d|
�|dk�rbtjd�}t|d|�t|dt	��t
jtj��|dk�r�t
jd�dt
k�r�dt_dS)z�Setup the path-based importers for importlib by importing needed
    built-in modules and injecting them into the global namespace.

    Other components are extracted from the core bootstrap module.

    rArP�builtinsr��posix�/�nt�\rOzimportlib requires posix or ntrrrr%�_threadN�_weakref�winregr�r
z.pywz_d.pydT)rArPrxr�)r�rr�r.r��_builtin_from_namer�r�r rr"r�rtrmr�r�r�)�_bootstrap_module�self_module�builtin_name�builtin_module�
os_details�
builtin_osrr�	os_module�
thread_module�weakref_module�
winreg_modulerrr	�_setupZsP













r�cCs2t|�t�}tjjtj|�g�tjjt	�dS)z)Install the path-based import components.N)
r�r�rrBr�rMri�	meta_pathr�r=)r��supported_loadersrrr	�_install�sr�)r)rr)r9)N)NNN)NNN)rOrO)N)N):r�r�%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrrrr"r.r0r5r6r8rJ�type�__code__r�rr�rr�_RAW_MAGIC_NUMBERr^r]rmr_�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXESrhrsr{rr�r�r�r�r�r�r��objectr�r�r�r�r�r	rrr"rr#r;r=rMrsr�r�r�rrrr	�<module>sl
	

{-"
7


C@n)-5<*
D