AlkantarClanX12

Your IP : 18.216.53.7


Current Path : /opt/alt/python38/lib64/python3.8/importlib/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/importlib/__pycache__/_bootstrap_external.cpython-38.pyc

U

i�f��@s�dZddladdlZddladdlZddlZtjdkZerLddlZ	ddl
Z
nddlZ	erbddgZndgZe
dd�eD��s~t�edZee�Zd�e�Zd	d
�eD�ZdZdZeeZd
d�Zdd�Zdd�Zdd�Zer�dd�Zndd�Zdd�Zdd�Zdd�Zdd�Zd d!�Z e�r$d"d#�Z!nd$d#�Z!dod&d'�Z"e#e"j$�Z%d(�&d)d*�d+Z'e(�)e'd*�Z*d,Z+d-Z,d.gZ-d/gZ.e.Z/Z0dpdd0�d1d2�Z1d3d4�Z2d5d6�Z3d7d8�Z4d9d:�Z5d;d<�Z6d=d>�Z7d?d@�Z8dAdB�Z9dCdD�Z:dqdEdF�Z;drdGdH�Z<dsdJdK�Z=dLdM�Z>e?�Z@dtde@dN�dOdP�ZAGdQdR�dR�ZBGdSdT�dT�ZCGdUdV�dVeC�ZDGdWdX�dX�ZEGdYdZ�dZeEeD�ZFGd[d\�d\eEeC�ZGgZHGd]d^�d^eEeC�ZIGd_d`�d`�ZJGdadb�db�ZKGdcdd�dd�ZLGdedf�df�ZMdudgdh�ZNdidj�ZOdkdl�ZPdmdn�ZQdS)va^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.

�NZwin32�\�/ccs|]}t|�dkVqdS��N��len��.0�sep�r�B/opt/alt/python38/lib64/python3.8/importlib/_bootstrap_external.py�	<genexpr>+sr
�cCsh|]}d|���qS��:r�r	�srrr�	<setcomp>/sr)�win)�cygwin�darwincs<tj�t�r0tj�t�rd�nd��fdd�}ndd�}|S)N�PYTHONCASEOKsPYTHONCASEOKcs
�tjkS)�5True if filenames must be checked case-insensitively.)�_os�environr��keyrr�_relax_case@sz%_make_relax_case.<locals>._relax_casecSsdS)rFrrrrrrDs)�sys�platform�
startswith�_CASE_INSENSITIVE_PLATFORMS�#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrrr�_make_relax_case9sr#cCst|�d@�dd�S)z*Convert a 32-bit integer to little-endian.�����little)�int�to_bytes)�xrrr�_pack_uint32Jsr*cCst|�dkst�t�|d�S)z/Convert 4 bytes in little-endian to an integer.r%r&�r�AssertionErrorr'�
from_bytes��datarrr�_unpack_uint32Osr0cCst|�dkst�t�|d�S)z/Convert 2 bytes in little-endian to an integer.�r&r+r.rrr�_unpack_uint16Tsr2cGs�|sdSt|�dkr|dSd}g}ttj|�D]z\}}|�t�sL|�t�rf|�t�pX|}t	|g}q0|�d�r�|�
�|�
�kr�|}|g}q�|�|�q0|p�|}|�|�q0dd�|D�}t|�dkr�|ds�|t	S|t	�|�S)�Replacement for os.path.join().rrrrcSsg|]}|r|�t��qSr��rstrip�path_separators�r	�prrr�
<listcomp>rs�_path_join.<locals>.<listcomp>)
r�mapr�_path_splitrootr �path_sep_tuple�endswithr5r6�path_sep�casefold�append�join)�
path_parts�root�pathZnew_root�tailrrr�
_path_join[s*
rGcGst�dd�|D��S)r3cSsg|]}|r|�t��qSrr4)r	�partrrrr9{s�r:)r?rB)rCrrrrGys
�csBt�fdd�tD��}|dkr&d�fS�d|��|dd�fS)z Replacement for os.path.split().c3s|]}��|�VqdS�N)�rfindr7�rErrr
�sz_path_split.<locals>.<genexpr>rrNr)�maxr6)rE�irrKr�_path_splitsrNcCs
t�|�S)z~Stat the path.

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

    )r�statrKrrr�
_path_stat�srPcCs2zt|�}Wntk
r"YdSX|jd@|kS)z1Test whether the path is the specified mode type.Fi�)rP�OSError�st_mode)rE�mode�	stat_inforrr�_path_is_mode_type�s
rUcCs
t|d�S)zReplacement for os.path.isfile.i�)rUrKrrr�_path_isfile�srVcCs|st��}t|d�S)zReplacement for os.path.isdir.i@)r�getcwdrUrKrrr�_path_isdir�srXcCs>|sdSt�|�d�dd�}t|�dko<|�d�p<|�d�S)�Replacement for os.path.isabs.Frrrrz\\)rr<�replacerr r>)rErDrrr�_path_isabs�sr[cCs
|�t�S)rY)r r6rKrrrr[�s�cCs�d�|t|��}t�|tjtjBtjB|d@�}z2t�|d��}|�	|�W5QRXt�
||�Wn:tk
r�zt�|�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.�{}.{}r\�wbN)
�format�idr�open�O_EXCL�O_CREAT�O_WRONLY�_io�FileIO�writerZrQ�unlink)rEr/rS�path_tmp�fd�filerrr�
_write_atomic�s�rliU
r1r&s
�__pycache__zopt-z.pyz.pyc)�optimizationcCsX|dk	r4t�dt�|dk	r(d}t|��|r0dnd}t�|�}t|�\}}|�d�\}}}tj	j
}	|	dkrrtd��d�|r~|n|||	g�}
|dkr�tj
jdkr�d}ntj
j}t|�}|dkr�|��s�td	�|���d
�|
t|�}
|
td}tjdk	�rLt|��stt��|�}|ddk�r8|dtk�r8|dd�}ttj|�t�|�St|t|�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 Nonerr�.�$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}rr1)�	_warnings�warn�DeprecationWarning�	TypeErrorr�fspathrN�
rpartitionr�implementation�	cache_tag�NotImplementedErrorrB�flags�optimize�str�isalnum�
ValueErrorr_�_OPT�BYTECODE_SUFFIXES�pycache_prefixr[rGrWr6�lstrip�_PYCACHE)rE�debug_overridern�message�headrF�baser
�rest�tag�almost_filename�filenamerrr�cache_from_sourcebsH�
	
�r�c
Cs.tjjdkrtd��t�|�}t|�\}}d}tjdk	rftj�t	�}|�
|t�rf|t|�d�}d}|s�t|�\}}|t
kr�tt
�d|����|�d�}|dkr�td|����n\|d	k�r|�dd
�d}|�
t�s�tdt����|tt�d�}|���std
|�d���|�d�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.

    NrpFTz not bottom-level directory in ro>r1�zexpected only 2 or 3 dots in r�r1���z5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrwrxryrrurNr�r5r6r r?rr�r~�count�rsplitrr}�	partitionrG�SOURCE_SUFFIXES)
rEr��pycache_filename�found_in_pycache_prefix�
stripped_path�pycache�	dot_countrn�	opt_level�
base_filenamerrr�source_from_cache�s4	





r�c	Cs~t|�dkrdS|�d�\}}}|r8|��dd�dkr<|Szt|�}Wn$ttfk
rl|dd�}YnXt|�rz|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.

    rNro�������py)rrv�lowerr�ryr~rV)�
bytecode_pathr��_�	extension�source_pathrrr�_get_sourcefile�sr�cCsJ|�tt��r0z
t|�WStk
r,YqFXn|�tt��rB|SdSdSrI)r>�tupler�r�ryr�)r�rrr�_get_cached�s
r�cCs4zt|�j}Wntk
r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.r\�)rPrRrQ)rErSrrr�
_calc_mode�s
r�csDd�fdd�	}z
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_wrappers
��z(_check_name.<locals>._check_name_wrappercSs8dD] }t||�rt||t||��q|j�|j�dS)N)�
__module__�__name__�__qualname__�__doc__)�hasattr�setattr�getattr�__dict__�update)�new�oldrZrrr�_wraps
z_check_name.<locals>._wrap)N)�
_bootstrapr��	NameError)r�r�r�rr�r�_check_name�s

r�cCs<|�|�\}}|dkr8t|�r8d}t�|�|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__r)�find_loaderrrqrrr_�
ImportWarning)r��fullname�loader�portions�msgrrr�_find_module_shims

r�cCs�|dd�}|tkr<d|�d|��}t�d|�t|f|��t|�dkrfd|��}t�d|�t|��t|dd��}|d	@r�d
|�d|��}t|f|��|S)aTPerform basic validity checking of a pyc header and return the flags field,
    which determines how the pyc should be further validated against the source.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required, though.)

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    ImportError is raised when the magic number is incorrect or when the flags
    field is invalid. EOFError is raised when the data is found to be truncated.

    Nr%zbad magic number in z: �{}�z(reached EOF while reading pyc header of ����zinvalid flags z in )�MAGIC_NUMBERr��_verbose_messager�r�EOFErrorr0)r/r��exc_details�magicr�rzrrr�
_classify_pyc)s
r�cCspt|dd��|d@kr:d|��}t�d|�t|f|��|dk	rlt|dd��|d@krltd|��f|��dS)aValidate a pyc against the source last-modified time.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required.)

    *source_mtime* is the last modified timestamp of the source file.

    *source_size* is None or the size of the source file in bytes.

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    An ImportError is raised if the bytecode is stale.

    r��r$zbytecode is stale for r�Nr�)r0r�r�r�)r/�source_mtime�source_sizer�r�r�rrr�_validate_timestamp_pycJs
�r�cCs&|dd�|kr"td|��f|��dS)a�Validate a hash-based pyc by checking the real source hash against the one in
    the pyc header.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required.)

    *source_hash* is the importlib.util.source_hash() of the source file.

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    An ImportError is raised if the bytecode is stale.

    r�r�z.hash in bytecode doesn't match hash of source N)r�)r/�source_hashr�r�rrr�_validate_hash_pycfs��r�cCsPt�|�}t|t�r8t�d|�|dk	r4t�||�|Std�	|�||d��dS)z#Compile bytecode as found in a pyc.zcode object from {!r}NzNon-code object in {!r}�r�rE)
�marshal�loads�
isinstance�
_code_typer�r��_imp�_fix_co_filenamer�r_)r/r�r�r��coderrr�_compile_bytecode~s


�r�cCsFtt�}|�td��|�t|��|�t|��|�t�|��|S)z+Produce the data for a timestamp-based pyc.r)�	bytearrayr��extendr*r��dumps)r��mtimer�r/rrr�_code_to_timestamp_pyc�sr�TcCsPtt�}d|d>B}|�t|��t|�dks2t�|�|�|�t�|��|S)z&Produce the data for a hash-based pyc.rr�)r�r�r�r*rr,r�r�)r�r��checkedr/rzrrr�_code_to_hash_pyc�s
r�cCs>ddl}t�|�j}|�|�}t�dd�}|�|�|d��S)zyDecode bytes representing source code and return the string.

    Universal newline support is used in the decoding.
    rNT)�tokenizere�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�rFz|�|�}WqFtk
r8YqFXn
t�|�}tj|||d�}d|_|dkr�t�D]*\}}|�	t
|��rj|||�}||_q�qjdS|tkr�t|d�r�z|�
|�}Wntk
r�Yq�X|r�g|_n||_|jgk�r|�rt|�d}|j�|�|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_packager)r�r�r�rrur��
ModuleSpec�
_set_fileattr�_get_supported_file_loadersr>r�r��	_POPULATEr�r�rNrA)	r��locationr�r��spec�loader_class�suffixesr��dirnamerrr�spec_from_file_location�s>



rc@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}\DebugFcCs8zt�tj|�WStk
r2t�tj|�YSXdSrI)�_winreg�OpenKey�HKEY_CURRENT_USERrQ�HKEY_LOCAL_MACHINE)�clsrrrr�_open_registrysz$WindowsRegistryFinder._open_registryc	Csr|jr|j}n|j}|j|dtjdd�d�}z&|�|��}t�|d�}W5QRXWnt	k
rlYdSX|S)Nz%d.%dr1)r��sys_versionr)
�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEYr_r�version_inforr�
QueryValuerQ)rr��registry_keyr�hkey�filepathrrr�_search_registrys�z&WindowsRegistryFinder._search_registryNcCsz|�|�}|dkrdSzt|�Wntk
r8YdSXt�D]4\}}|�t|��r@tj||||�|d�}|Sq@dS)Nr�)rrPrQr�r>r�r��spec_from_loader)rr�rE�targetrr�r�r�rrr�	find_specs
�zWindowsRegistryFinder.find_speccCs"|�||�}|dk	r|jSdSdS)zlFind module named in the registry.

        This method is deprecated.  Use exec_module() instead.

        N�rr��rr�rEr�rrr�find_module'sz!WindowsRegistryFinder.find_module)NN)N)r�r�r�r�rrr
�classmethodrrrrrrrrr�s��

rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
_LoaderBasicszSBase class of common code needed by both SourceLoader and
    SourcelessFileLoader.cCs@t|�|��d}|�dd�d}|�d�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'.rrorr1�__init__)rNr�r�rv)r�r�r��
filename_base�	tail_namerrrr�:sz_LoaderBasics.is_packagecCsdS�z*Use default semantics for module creation.Nr�r�r�rrr�
create_moduleBsz_LoaderBasics.create_modulecCs8|�|j�}|dkr$td�|j���t�t||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_moduleEs�z_LoaderBasics.exec_modulecCst�||�S)zThis module is deprecated.)r��_load_module_shim�r�r�rrr�load_moduleMsz_LoaderBasics.load_moduleN)r�r�r�r�r�r r%r(rrrrr5s
rc@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 (a str).

        Raises OSError when the path cannot be handled.
        N)rQ�r�rErrr�
path_mtimeTszSourceLoader.path_mtimecCsd|�|�iS)a�Optional method returning a metadata dict for the specified
        path (a 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 OSError when the path cannot be handled.
        r�)r+r*rrr�
path_stats\szSourceLoader.path_statscCs|�||�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�r��
cache_pathr/rrr�_cache_bytecodejszSourceLoader._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�rEr/rrrr-tszSourceLoader.set_datac
CsR|�|�}z|�|�}Wn0tk
rH}ztd|d�|�W5d}~XYnXt|�S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()r�N)r��get_datarQr�r�)r�r�rEr��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_inheritr{)r�r"�compile)r�r/rEr3rrr�source_to_code�s�zSourceLoader.source_to_codec	Cs"|�|�}d}d}d}d}d}zt|�}Wntk
rDd}Y�n0Xz|�|�}	Wntk
rjY�n
Xt|	d�}z|�|�}
Wntk
r�Yn�X||d�}z�t|
||�}t|
�dd�}
|d@dk}|�r$|d	@dk}t	j
d
k�r8|s�t	j
dk�r8|�|�}t	�t|�}t
|
|||�nt|
||	d||�Wnttfk
�rTYn Xt�d
||�t|
|||d�S|dk�r�|�|�}|�||�}t�d|�tj�s|dk	�r|dk	�r|�r�|dk�r�t	�|�}t|||�}
nt||t|��}
z|�|||
�Wntk
�rYnX|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.

        NFTr�r�r�rrr1�never�always�sizez
{} matches {})r�r�r�zcode object from {})r�r�ryr,rQr'r0r��
memoryviewr��check_hash_based_pycsr��_RAW_MAGIC_NUMBERr�r�r�r�r�r�r�r6r�dont_write_bytecoder�r�rr/)r�r�r�r�r�r��
hash_based�check_sourcer��str/r�rz�
bytes_data�code_objectrrrr!�s�
���
�����

�

�zSourceLoader.get_codeN)
r�r�r�r+r,r/r-r2r6r!rrrrr)Rs

r)cs|eZdZdZdd�Zdd�Zdd�Ze�fdd	��Zed
d��Z	dd
�Z
edd��Zdd�Zdd�Z
dd�Zdd�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.Nr�)r�r�rErrrr�szFileLoader.__init__cCs|j|jko|j|jkSrI��	__class__r��r��otherrrr�__eq__�s
�zFileLoader.__eq__cCst|j�t|j�ASrI��hashr�rE�r�rrr�__hash__�szFileLoader.__hash__cstt|��|�S)zdLoad a module from a file.

        This method is deprecated.  Use exec_module() instead.

        )�superrCr(r'�rErrr(�s
zFileLoader.load_modulecCs|jS�z:Return the path to the source file as found by the finder.rKr'rrrr�szFileLoader.get_filenamec
Csft|ttf�r:t�t|���}|��W5QR�SQRXn(t�|d��}|��W5QR�SQRXdS)z'Return the data from path as raw bytes.�rN)r�r)�ExtensionFileLoaderre�	open_coder|�readrf)r�rErkrrrr0s
zFileLoader.get_datacCs|�|�r|SdSrI)r��r�r$rrr�get_resource_readers
zFileLoader.get_resource_readercCs tt|j�d|�}t�|d�S)NrrP)rGrNrErerf�r��resourcerErrr�
open_resourceszFileLoader.open_resourcecCs&|�|�st�tt|j�d|�}|S�Nr)�is_resource�FileNotFoundErrorrGrNrErVrrr�
resource_paths
zFileLoader.resource_pathcCs(t|krdStt|j�d|�}t|�S)NFr)r?rGrNrErV�r�r�rErrrrZ szFileLoader.is_resourcecCstt�t|j�d��SrY)�iterr�listdirrNrErKrrr�contents&szFileLoader.contents)r�r�r�r�rrHrLr�r(r�r0rUrXr\rZr`�
__classcell__rrrNrrC�s

rCc@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�r9)rP�st_mtime�st_size)r�rEr@rrrr,.szSourceFileLoader.path_statscCst|�}|j|||d�S)N��_mode)r�r-)r�r�r�r/rSrrrr/3sz SourceFileLoader._cache_bytecoder\rec	Cs�t|�\}}g}|r4t|�s4t|�\}}|�|�qt|�D]l}t||�}zt�|�Wq<tk
rpYq<Yq<tk
r�}zt	�
d||�WY�dSd}~XYq<Xq<zt|||�t	�
d|�Wn0tk
r�}zt	�
d||�W5d}~XYnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nzcreated {!r})rNrXrA�reversedrGr�mkdir�FileExistsErrorrQr�r�rl)	r�rEr/rf�parentr�rCrHr1rrrr-8s0
��zSourceFileLoader.set_dataN)r�r�r�r�r,r/r-rrrrrb*srbc@s eZdZdZdd�Zdd�ZdS)�SourcelessFileLoaderz-Loader which handles sourceless file imports.cCsD|�|�}|�|�}||d�}t|||�tt|�dd�||d�S)Nr�r�)r�r�)r�r0r�r�r:)r�r�rEr/r�rrrr![s

��zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nrr'rrrr2kszSourcelessFileLoader.get_sourceN)r�r�r�r�r!r2rrrrrkWsrkc@s\eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zedd��Z
dS)rQz]Loader for extension modules.

    The constructor is designed to work with FileFinder.

    cCs@||_t|�s6ztt��|�}Wntk
r4YnX||_dSrI)r�r[rGrrWrQrEr]rrrr|szExtensionFileLoader.__init__cCs|j|jko|j|jkSrIrDrFrrrrH�s
�zExtensionFileLoader.__eq__cCst|j�t|j�ASrIrIrKrrrrL�szExtensionFileLoader.__hash__cCs$t�tj|�}t�d|j|j�|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})r�r"r��create_dynamicr�r�rE)r�r�r$rrrr �s��z!ExtensionFileLoader.create_modulecCs$t�tj|�t�d|j|j�dS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)r�r"r��exec_dynamicr�r�rErTrrrr%�s
�zExtensionFileLoader.exec_modulecs$t|j�d�t�fdd�tD��S)z1Return True if the extension module is a package.rc3s|]}�d|kVqdS)rNr�r	�suffix��	file_namerrr
�s�z1ExtensionFileLoader.is_package.<locals>.<genexpr>)rNrE�any�EXTENSION_SUFFIXESr'rrprr��s�zExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nrr'rrrr!�szExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nrr'rrrr2�szExtensionFileLoader.get_sourcecCs|jSrOrKr'rrrr��sz ExtensionFileLoader.get_filenameN)r�r�r�r�rrHrLr r%r�r!r2r�r�rrrrrQts	rQc@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�_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|���|_||_dSrI)�_name�_pathr��_get_parent_path�_last_parent_path�_path_finder�r�r�rE�path_finderrrrr�sz_NamespacePath.__init__cCs&|j�d�\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)ror)rrE�__path__)rurv)r�rj�dot�merrr�_find_parent_path_names�sz&_NamespacePath._find_parent_path_namescCs|��\}}ttj||�SrI)rr�r�modules)r��parent_module_name�path_attr_namerrrrw�sz_NamespacePath._get_parent_pathcCsPt|���}||jkrJ|�|j|�}|dk	rD|jdkrD|jrD|j|_||_|jSrI)r�rwrxryrur�r�rv)r��parent_pathr�rrr�_recalculate�s
z_NamespacePath._recalculatecCst|���SrI)r^r�rKrrr�__iter__�sz_NamespacePath.__iter__cCs|��|SrI�r�)r��indexrrr�__getitem__�sz_NamespacePath.__getitem__cCs||j|<dSrI)rv)r�r�rErrr�__setitem__�sz_NamespacePath.__setitem__cCst|���SrI)rr�rKrrr�__len__�sz_NamespacePath.__len__cCsd�|j�S)Nz_NamespacePath({!r}))r_rvrKrrr�__repr__�sz_NamespacePath.__repr__cCs||��kSrIr��r��itemrrr�__contains__�sz_NamespacePath.__contains__cCs|j�|�dSrI)rvrAr�rrrrA�sz_NamespacePath.appendN)r�r�r�r�rrrwr�r�r�r�r�r�r�rArrrrrt�s

rtc@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)�_NamespaceLoadercCst|||�|_dSrI)rtrvrzrrrr�sz_NamespaceLoader.__init__cCsd�|j�S)zsReturn repr for the module.

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

        z<module {!r} (namespace)>)r_r�)rr$rrr�module_repr�sz_NamespaceLoader.module_reprcCsdS)NTrr'rrrr��sz_NamespaceLoader.is_packagecCsdS)Nrrr'rrrr2�sz_NamespaceLoader.get_sourcecCstddddd�S)Nrz<string>r#T)r4)r5r'rrrr!sz_NamespaceLoader.get_codecCsdSrrrrrrr sz_NamespaceLoader.create_modulecCsdSrIrrTrrrr%sz_NamespaceLoader.exec_modulecCst�d|j�t�||�S)zbLoad a namespace module.

        This method is deprecated.  Use exec_module() instead.

        z&namespace module loaded with path {!r})r�r�rvr&r'rrrr(	s�z_NamespaceLoader.load_moduleN)r�r�r�rrr�r�r2r!r r%r(rrrrr��s
r�c@sveZdZdZedd��Zedd��Zedd��Zedd	��Zeddd��Z	edd
d��Z
eddd��Zedd��Zd
S)�
PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs@ttj���D],\}}|dkr(tj|=qt|d�r|��qdS)z}Call the invalidate_caches() method on all path entry finders
        stored in sys.path_importer_caches (where implemented).N�invalidate_caches)�listr�path_importer_cache�itemsr�r�)rr��finderrrrr�s


zPathFinder.invalidate_cachesc	CsTtjdk	rtjst�dt�tjD],}z||�WStk
rLYq"Yq"Xq"dS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r�
path_hooksrqrrr�r�)rrE�hookrrr�_path_hooks%s
zPathFinder._path_hookscCsh|dkr,zt��}Wntk
r*YdSXztj|}Wn(tk
rb|�|�}|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.

        rN)rrWr[rr��KeyErrorr�)rrEr�rrr�_path_importer_cache2s
zPathFinder._path_importer_cachecCsRt|d�r|�|�\}}n|�|�}g}|dk	r<t�||�St�|d�}||_|S)Nr�)r�r�rr�rr�r�)rr�r�r�r�r�rrr�_legacy_get_specHs

zPathFinder._legacy_get_specNc	Cs�g}|D]�}t|ttf�sq|�|�}|dk	rt|d�rF|�||�}n|�||�}|dkr\q|jdk	rn|S|j}|dkr�t	d��|�
|�qt�|d�}||_|S)z?Find the loader or namespace_path for this module/package name.Nrzspec missing loader)
r�r|�bytesr�r�rr�r�r�r�r�r�r�)	rr�rEr�namespace_path�entryr�r�r�rrr�	_get_specWs(


zPathFinder._get_speccCsd|dkrtj}|�|||�}|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)rrEr�r�r�r�rt)rr�rErr�r�rrrrws
zPathFinder.find_speccCs|�||�}|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.

        Nrrrrrr�szPathFinder.find_modulecOsddlm}|j||�S)a 
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching ``context.name``
        (or all names if ``None`` indicated) along the paths in the list
        of directories ``context.path``.
        r)�MetadataPathFinder)�importlib.metadatar��find_distributions)rr�r�r�rrrr��s
zPathFinder.find_distributions)N)NN)N)
r�r�r�r�rr�r�r�r�r�rrr�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.

    cspg}|D] \�}|��fdd�|D��q||_|p6d|_t|j�sVtt��|j�|_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|]}|�fVqdSrIrrn�r�rrr
�sz&FileFinder.__init__.<locals>.<genexpr>ror�N)r��_loadersrEr[rGrrW�_path_mtime�set�_path_cache�_relaxed_path_cache)r�rE�loader_details�loadersr�rr�rr�s

zFileFinder.__init__cCs
d|_dS)zInvalidate the directory mtime.r�N)r�rKrrrr��szFileFinder.invalidate_cachescCs*|�|�}|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)rr�r�)r�r�r�rrrr��s
zFileFinder.find_loadercCs|||�}t||||d�S)Nr�)r)r�r�r�rE�smslrr�rrrr��s
�zFileFinder._get_specNc	Cs�d}|�d�d}zt|jp"t���j}Wntk
rBd}YnX||jkr\|��||_t	�rr|j
}|��}n
|j}|}||kr�t
|j|�}|jD]:\}	}
d|	}t
||�}t|�r�|�|
|||g|�Sq�t|�}|jD]r\}	}
zt
|j||	�}Wntk
�rYdSXtjd|dd�||	|kr�t|�r�|�|
||d|�Sq�|�r~t�d	|�t�|d�}
|g|
_|
SdS)
zoTry to find a spec for the specified module.

        Returns the matching spec, or None if not found.
        Fror1r�rNz	trying {})�	verbosityzpossible namespace for {})rvrPrErrWrcrQr��_fill_cacherr�r�r�rGr�rVr�rXr~r�r�r�r�)r�r�r�is_namespace�tail_moduler��cache�cache_module�	base_pathror��
init_filename�	full_pathr�rrrr�sP





�
zFileFinder.find_specc	
Cs�|j}zt�|pt���}Wntttfk
r:g}YnXtj�	d�sTt
|�|_nJt
�}|D]8}|�d�\}}}|r�d�
||���}n|}|�|�q^||_tj�	t�r�dd�|D�|_dS)zDFill the cache of potential modules and packages for this directory.rror]cSsh|]}|���qSr)r�)r	�fnrrrr*sz)FileFinder._fill_cache.<locals>.<setcomp>N)rErr_rWr[�PermissionError�NotADirectoryErrorrrr r�r�r�r_r��addr!r�)	r�rEr`�lower_suffix_contentsr�r�r}ro�new_namerrrr�
s"
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 supportedrK)rXr�rK�rr�rr�path_hook_for_FileFinder6sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)rr�r�rr�r�	path_hook,s
zFileFinder.path_hookcCsd�|j�S)NzFileFinder({!r}))r_rErKrrrr�>szFileFinder.__repr__)N)r�r�r�r�rr�r�rr�r�rr�rr�r�rrrrr��s
3
r�cCs�|�d�}|�d�}|sB|r$|j}n||kr8t||�}n
t||�}|sTt|||d�}z$||d<||d<||d<||d<Wntk
r�YnXdS)N�
__loader__�__spec__r��__file__�
__cached__)�getr�rkrbr�	Exception)�nsr��pathname�	cpathnamer�r�rrr�_fix_up_moduleDs"


r�cCs&tt��f}ttf}ttf}|||gS)z_Returns a list of file-based module loaders.

    Each item is a tuple (loader, suffixes).
    )rQr��extension_suffixesrbr�rkr�)�
extensions�source�bytecoderrrr�[sr�c	Cs�|atjatjatjt}dD]0}|tjkr8t�|�}n
tj|}t|||�qddgfdddgff}|D]n\}}tdd�|D��s�t�|d}|tjkr�tj|}q�qjzt�|�}Wq�Wqjt	k
r�YqjYqjXqjt	d	��t|d
|�t|d|�t|dd
�
|��t|ddd�|D��t�d�}	t|d|	�t�d�}
t|d|
�|dk�rnt�d�}t|d|�t|dt��t�
t���|dk�r�t�d�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.

    )rerq�builtinsr��posixr�ntrcss|]}t|�dkVqdSrrrrrrr
sz_setup.<locals>.<genexpr>rzimportlib requires posix or ntrr?r6r�_pathseps_with_coloncSsh|]}d|���qSrrrrrrr�sz_setup.<locals>.<setcomp>�_thread�_weakref�winregrrz.pywz_d.pydTN)r�rr�r�r��_builtin_from_namer��allr,r�rBr#rsr�r�r�rArr
)�_bootstrap_module�self_module�builtin_name�builtin_module�
os_details�
builtin_osr6r?�	os_module�
thread_module�weakref_module�
winreg_modulerrr�_setupfsN













r�cCs2t|�t�}tj�tj|�g�tj�t	�dS)z)Install the path-based import components.N)
r�r�rr�r�r�r��	meta_pathrAr�)r��supported_loadersrrr�_install�sr�)r\)N)NNN)rr)T)N)N)Rr�r�rerrqr�r�_MS_WINDOWSr�rr�r�r6r�r,r?r�r=rBr�r"�%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYr!r#r*r0r2rGrNrPrUrVrXr[rl�type�__code__r�r(r�r'r-r<r�rr�r��DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXESr�r�r�r�r�r�r�r�r�r�r�r�r�r��objectr�rrrr)rCrbrkrsrQrtr�r�r�r�r�r�r�rrrr�<module>s�



�

	



G(!



�D@H-:?*
A