Your IP : 3.148.144.139


Current Path : /opt/alt/python310/lib64/python3.10/importlib/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/importlib/__pycache__/_bootstrap_external.cpython-310.pyc

o

6��fR��@s�dZdaddlZddlZddlZddlZddlZejdkZer(ddl	Z
ddlZnddlZ
er3ddgZ
ndgZ
edd�e
D��sAJ�e
dZee
�Zd�e
�Z
d	d
�e
D�ZdZdZeeZd
d�Ze�Zdd�Zdd�Zdd�Zerwdd�Zndd�Zdd�Zdd�Zdd�Zdd�Z d d!�Z!er�d"d#�Z"nd$d#�Z"dpd&d'�Z#e$e#j%�Z&d(�'d)d*�d+Z(e)�*e(d*�Z+d,Z,d-Z-d.gZ.er�e.�/d/�e�0�Z1d0gZ2e2Z3Z4dqdd1�d2d3�Z5d4d5�Z6d6d7�Z7d8d9�Z8d:d;�Z9d<d=�Z:d>d?�Z;d@dA�Z<dBdC�Z=dDdE�Z>drdFdG�Z?dsdHdI�Z@dtdKdL�ZAdMdN�ZBeC�ZDdqdeDdO�dPdQ�ZEGdRdS�dS�ZFGdTdU�dU�ZGGdVdW�dWeG�ZHGdXdY�dY�ZIGdZd[�d[eIeH�ZJGd\d]�d]eIeG�ZKGd^d_�d_eIeG�ZLGd`da�da�ZMGdbdc�dc�ZNGddde�de�ZOGdfdg�dg�ZPdqdhdi�ZQdjdk�ZRdldm�ZSdndo�ZTdS)ua^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.

N�Zwin32�\�/ccs�|]	}t|�dkVqdS)�N)�len)�.0�sep�r�D/opt/alt/python310/lib64/python3.10/importlib/_bootstrap_external.py�	<genexpr>.s�r
�cCsh|]}d|���qS)�:r)r�srrr	�	<setcomp>2sr)�win)�cygwin�darwincs>tj�t�rtj�t�rd�nd��fdd�}|Sdd�}|S)N�PYTHONCASEOKsPYTHONCASEOKcstjjo	�tjvS)z^True if filenames must be checked case-insensitively and ignore environment flags are not set.)�sys�flags�ignore_environment�_os�environr��keyrr	�_relax_caseC�z%_make_relax_case.<locals>._relax_casecS�dS)z5True if filenames must be checked case-insensitively.Frrrrr	rG�)r�platform�
startswith�_CASE_INSENSITIVE_PLATFORMS�#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrrr	�_make_relax_case<s�r"cCst|�d@�dd�S)z*Convert a 32-bit integer to little-endian.�����little)�int�to_bytes)�xrrr	�_pack_uint32Orr)cC�t|�dksJ�t�|d�S)z/Convert 4 bytes in little-endian to an integer.r$r%�rr&�
from_bytes��datarrr	�_unpack_uint32T�r/cCr*)z/Convert 2 bytes in little-endian to an integer.�r%r+r-rrr	�_unpack_uint16Yr0r2cGs�|sdSt|�dkr|dSd}g}ttj|�D]=\}}|�t�s&|�t�r3|�t�p,|}t	|g}q|�d�rL|�
�|�
�krF|}|g}q|�|�q|pO|}|�|�qdd�|D�}t|�dkrk|dsk|t	S|t	�|�S)�Replacement for os.path.join().rrrrcS�g|]	}|r|�t��qSr��rstrip�path_separators�r�prrr	�
<listcomp>ws�_path_join.<locals>.<listcomp>)
r�mapr�_path_splitrootr�path_sep_tuple�endswithr6r7�path_sep�casefold�append�join)�
path_parts�root�pathZnew_root�tailrrr	�
_path_join`s*
rHcGst�dd�|D��S)r3cSr4rr5)r�partrrr	r:�s�r;)r@rC)rDrrr	rH~s
�csBt�fdd�tD��}|dkrd�fS�d|��|dd�fS)z Replacement for os.path.split().c3s�|]}��|�VqdS�N)�rfindr8�rFrr	r
�s�z_path_split.<locals>.<genexpr>rrNr)�maxr7)rF�irrLr	�_path_split�srOcCs
t�|�S)z~Stat the path.

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

    )r�statrLrrr	�
_path_stat�s
rQcCs0zt|�}Wn
tyYdSw|jd@|kS)z1Test whether the path is the specified mode type.Fi�)rQ�OSError�st_mode)rF�mode�	stat_inforrr	�_path_is_mode_type�s�rVcCs
t|d�S)zReplacement for os.path.isfile.i�)rVrLrrr	�_path_isfile��
rWcCs|st��}t|d�S)zReplacement for os.path.isdir.i@)r�getcwdrVrLrrr	�_path_isdir�s
rZcCs>|sdSt�|�d�dd�}t|�dko|�d�p|�d�S)�Replacement for os.path.isabs.Frrrrz\\)rr=�replacerrr?)rFrErrr	�_path_isabs�s r]cCs
|�t�S)r[)rr7rLrrr	r]�rX�cCs�d�|t|��}t�|tjtjBtjB|d@�}z$t�|d��
}|�	|�Wd�n1s/wYt�
||�WdStyTzt�|�W�tySY�ww)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�writer\rR�unlink)rFr.rT�path_tmp�fd�filerrr	�
_write_atomic�s$�����rnio
r1r%s
�__pycache__zopt-z.pyz.pywz.pyc)�optimizationcCsP|durt�dt�|durd}t|��|rdnd}t�|�}t|�\}}|�d�\}}}tj	j
}	|	dur9td��d�|r?|n|||	g�}
|durVtj
jdkrRd}ntj
j}t|�}|dkrp|��sitd	�|���d
�|
t|�}
|
td}tjdur�t|�s�tt��|�}|ddkr�|dtvr�|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{}.{}{}rr1)�	_warnings�warn�DeprecationWarning�	TypeErrorr�fspathrO�
rpartitionr�implementation�	cache_tag�NotImplementedErrorrCr�optimize�str�isalnum�
ValueErrorra�_OPT�BYTECODE_SUFFIXES�pycache_prefixr]rHrYr7�lstrip�_PYCACHE)rF�debug_overriderp�message�headrG�baser�rest�tag�almost_filename�filenamerrr	�cache_from_source|sH�

	�r�c
Cs(tjjdur
td��t�|�}t|�\}}d}tjdur3tj�t	�}|�
|t�r3|t|�d�}d}|sHt|�\}}|t
krHtt
�d|����|�d�}|dvrXtd|����|d	kr�|�dd
�d}|�
t�sptdt����|tt�d�}|��s�td
|�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.

    NrrFTz not bottom-level directory in rq>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)rryrzr{rrwrOr�r6r7rr@rr�r�count�rsplitr�r~�	partitionrH�SOURCE_SUFFIXES)
rFr��pycache_filename�found_in_pycache_prefix�
stripped_path�pycache�	dot_countrp�	opt_level�
base_filenamerrr	�source_from_cache�s<	

�

�r�c	Cs|t|�dkrdS|�d�\}}}|r|��dd�dkr|Szt|�}Wnttfy5|dd�}Ynwt|�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.

    rNrq�������py)rrx�lowerr�r{rrW)�
bytecode_pathr��_�	extension�source_pathrrr	�_get_sourcefile�s�r�cCsD|�tt��rzt|�WStyYdSw|�tt��r |SdSrJ)r?�tupler�r�r{r�)r�rrr	�_get_cached�s
�r�cCs2zt|�j}Wntyd}Ynw|dO}|S)z3Calculate the mode permissions for a bytecode file.r^�)rQrSrR)rFrTrrr	�
_calc_mode
s�r�cs4d�fdd�	}tdurtj}ndd�}||��|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.

    NcsH|dur|j}n|j|krtd|j|f|d���||g|�Ri|��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�oldr\rrr	�_wrap+s

�z_check_name.<locals>._wraprJ)�
_bootstrapr�)r�r�r�rr�r	�_check_names

r�cCsHt�dt�|�|�\}}|dur"t|�r"d}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().

    zZfind_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadNz,Not importing directory {}: missing __init__r)rsrtru�find_loaderrra�
ImportWarning)r��fullname�loader�portions�msgrrr	�_find_module_shim5s�r�cCs�|dd�}|tkr d|�d|��}t�d|�t|fi|���t|�dkr5d|��}t�d|�t|��t|dd��}|d	@rQd
|�d|��}t|fi|���|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�EOFErrorr/)r.r��exc_details�magicr�rrrr	�
_classify_pycIs
r�cCs|t|dd��|d@krd|��}t�d|�t|fi|���|dur:t|dd��|d@kr<td|��fi|���dSdS)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�)r/r�r�r�)r.�source_mtime�source_sizer�r�r�rrr	�_validate_timestamp_pycjs
�r�cCs*|dd�|krtd|��fi|���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_pyc�s���r�cCsLt�|�}t|t�rt�d|�|durt�||�|Std�	|�||d��)z#Compile bytecode as found in a pyc.zcode object from {!r}NzNon-code object in {!r}�r�rF)
�marshal�loads�
isinstance�
_code_typer�r��_imp�_fix_co_filenamer�ra)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|�dksJ�|�|�|�t�|��|S)z&Produce the data for a hash-based pyc.rr�)r�r�r�r)rr�r�)r�r��checkedr.rrrr	�_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)�tokenizerg�BytesIO�readline�detect_encoding�IncrementalNewlineDecoder�decode)�source_bytesr��source_bytes_readline�encoding�newline_decoderrrr	�
decode_source�s

r��r��submodule_search_locationsc	Cs6|durd}t|d�rz|�|�}Wn&tyYnwnt�|�}t|�s9z	tt��|�}Wn	ty8Ynwt	j
|||d�}d|_|durct�D]\}}|�
t|��r`|||�}||_nqKdS|tur�t|d�r�z|�|�}Wn	ty|Yn
w|r�g|_n||_|jgkr�|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�rrwr]rHrYrRr��
ModuleSpec�
_set_fileattr�_get_supported_file_loadersr?r�r��	_POPULATEr�r�rOrB)	r��locationr�r��spec�loader_class�suffixesr��dirnamerrr	�spec_from_file_location�sT
��
�	
�
��
rc@sXeZdZdZdZdZeodevZe	dd��Z
edd��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}\Debugz_d.pydcCs2zt�tj|�WStyt�tj|�YSwrJ)�winreg�OpenKey�HKEY_CURRENT_USERrR�HKEY_LOCAL_MACHINErrrr	�_open_registry&s
�z$WindowsRegistryFinder._open_registrycCs�|jr|j}n|j}|j|dtjdd�d�}z |�|��}t�|d�}Wd�W|S1s1wYW|St	yBYdSw)Nz%d.%dr1)r��sys_versionr)
�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEYrar�version_inforr�
QueryValuerR)�clsr��registry_keyr�hkey�filepathrrr	�_search_registry-s �����z&WindowsRegistryFinder._search_registryNcCsx|�|�}|durdSzt|�Wn
tyYdSwt�D]\}}|�t|��r9tj||||�|d�}|SqdS)Nr�)rrQrRr�r?r�r��spec_from_loader)rr�rF�targetrr�r�r�rrr	�	find_spec<s"
����zWindowsRegistryFinder.find_speccCs*t�dt�|�||�}|dur|jSdS)zjFind module named in the registry.

        This method is deprecated.  Use find_spec() instead.

        zpWindowsRegistryFinder.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadN�rsrtrurr��rr�rFr�rrr	�find_moduleLs�z!WindowsRegistryFinder.find_module�NNrJ)r�r�r�r�rr
�_MS_WINDOWS�EXTENSION_SUFFIXESr	�staticmethodr�classmethodrrrrrrr	rs��

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'.rrqrr1�__init__)rOr�r�rx)r�r�r��
filename_base�	tail_namerrr	r�bsz_LoaderBasics.is_packagecCr�z*Use default semantics for module creation.Nr�r�r�rrr	�
create_modulej�z_LoaderBasics.create_modulecCs8|�|j�}|durtd�|j���t�t||j�dS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)�get_coder�r�rar��_call_with_frames_removed�execr�)r��moduler�rrr	�exec_modulems�z_LoaderBasics.exec_modulecCst�||�S)zThis method is deprecated.)r��_load_module_shim�r�r�rrr	�load_moduleusz_LoaderBasics.load_moduleN)r�r�r�r�r�r$r*r-rrrr	r]src@sJeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�d
d�Zdd�Z	dS)�SourceLoadercCst�)z�Optional method that returns the modification time (an int) for the
        specified path (a str).

        Raises OSError when the path cannot be handled.
        )rR�r�rFrrr	�
path_mtime}szSourceLoader.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�)r0r/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_bytecode�szSourceLoader._cache_bytecodecCr)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�rFr.rrr	r2�r%zSourceLoader.set_datac
CsF|�|�}z
|�|�}Wt|�Sty"}ztd|d�|�d}~ww)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()r�N)r��get_datarRr�r�)r�r�rFr��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.rFr8rrr	�source_to_code�s�zSourceLoader.source_to_codec	Cs|�|�}d}d}d}d}d}zt|�}Wnty d}Yn�wz|�|�}	Wn	ty1Ynwt|	d�}z|�|�}
Wn	tyHYnhw||d�}zGt|
||�}t|
�dd�}
|d@dk}|r�|d	@dk}t	j
d
kr�|swt	j
dkr�|�|�}t	�t|�}t
|
|||�n
t|
||	d||�Wnttfy�Ynwt�d
||�t|
|||d�S|dur�|�|�}|�||�}t�d|�tjs�|dur�|dur�|r�|dur�t	�|�}t|||�}
nt||t|��}
z
|�|||
�W|Sty�Y|Sw|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�r{r1rRr&r5r��
memoryviewr��check_hash_based_pycsr��_RAW_MAGIC_NUMBERr�r�r�r�r�r�r�r;r�dont_write_bytecoder�r�rr4)r�r�r�r�r�r��
hash_based�check_sourcer��str.r�r�
bytes_data�code_objectrrr	r&�s�
����
�

��������

���zSourceLoader.get_codeN)
r�r�r�r0r1r4r2r7r;r&rrrr	r.{s

r.cs\eZdZdZdd�Zdd�Zdd�Ze�fdd	��Zed
d��Z	dd
�Z
edd��Z�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.Nr�)r�r�rFrrr	rs
zFileLoader.__init__cC�|j|jko|j|jkSrJ��	__class__r��r��otherrrr	�__eq__�
�zFileLoader.__eq__cC�t|j�t|j�ASrJ��hashr�rF�r�rrr	�__hash__�zFileLoader.__hash__cstt|��|�S)zdLoad a module from a file.

        This method is deprecated.  Use exec_module() instead.

        )�superrHr-r,�rKrr	r-s
zFileLoader.load_modulecC�|jS�z:Return the path to the source file as found by the finder.rLr,rrr	r�)�zFileLoader.get_filenamecCs�t|ttf�r$t�t|���}|��Wd�S1swYdSt�|d��}|��Wd�S1s9wYdS)z'Return the data from path as raw bytes.N�r)r�r.�ExtensionFileLoaderrg�	open_coder}�readrh)r�rFrmrrr	r5.s$�$�zFileLoader.get_datacCsddlm}||�S)Nr)�
FileReader)�importlib.readersr_)r�r)r_rrr	�get_resource_reader7szFileLoader.get_resource_reader)
r�r�r�r�rrNrTr�r-r�r5ra�
__classcell__rrrWr	rHs
	rHc@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>)rQ�st_mtime�st_size)r�rFrErrr	r1AszSourceFileLoader.path_statscCst|�}|j|||d�S)N��_mode)r�r2)r�r�r�r.rTrrr	r4Fsz SourceFileLoader._cache_bytecoder^rfc	Cs�t|�\}}g}|rt|�st|�\}}|�|�|rt|�rt|�D]1}t||�}zt�|�Wq#ty:Yq#tyT}zt	�
d||�WYd}~dSd}~wwzt|||�t	�
d|�WdSty~}zt	�
d||�WYd}~dSd}~ww)zWrite bytes data to a file.zcould not create {!r}: {!r}Nzcreated {!r})rOrZrB�reversedrHr�mkdir�FileExistsErrorrRr�r�rn)	r�rFr.rg�parentr�rDrIr6rrr	r2Ks8
�
������zSourceFileLoader.set_dataN)r�r�r�r�r1r4r2rrrr	rc=s
rcc@s eZdZdZdd�Zdd�ZdS)�SourcelessFileLoaderz-Loader which handles sourceless file imports.cCsD|�|�}|�|�}||d�}t|||�tt|�dd�||d�S)Nr�r�)r�r�)r�r5r�r�r?)r�r�rFr.r�rrr	r&ns

��zSourcelessFileLoader.get_codecCr)z'Return None as there is no source code.Nrr,rrr	r7~rzSourcelessFileLoader.get_sourceN)r�r�r�r�r&r7rrrr	rljsrlc@s\eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zedd��Z
dS)r\z]Loader for extension modules.

    The constructor is designed to work with FileFinder.

    cCs||_||_dSrJr�)r�r�rFrrr	r�s
zExtensionFileLoader.__init__cCrIrJrJrLrrr	rN�rOzExtensionFileLoader.__eq__cCrPrJrQrSrrr	rT�rUzExtensionFileLoader.__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�rF)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�rF�r�r)rrr	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>)rOrF�anyrr,rrrr	r��s�zExtensionFileLoader.is_packagecCr)z?Return None as an extension module cannot create a code object.Nrr,rrr	r&�rzExtensionFileLoader.get_codecCr)z5Return None as extension modules have no source code.Nrr,rrr	r7�rzExtensionFileLoader.get_sourcecCrXrYrLr,rrr	r��rZz ExtensionFileLoader.get_filenameN)r�r�r�r�rrNrTr$r*r�r&r7r�r�rrrr	r\�sr\c@sleZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�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.rcCs,||_||_t|���|_|j|_||_dSrJ)�_name�_pathr��_get_parent_path�_last_parent_path�_epoch�_last_epoch�_path_finder�r�r�rF�path_finderrrr	r�s

z_NamespacePath.__init__cCs&|j�d�\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rqr)rrF�__path__)rvrx)r�rk�dot�merrr	�_find_parent_path_names�sz&_NamespacePath._find_parent_path_namescCs|��\}}ttj||�SrJ)r�r�r�modules)r��parent_module_name�path_attr_namerrr	rx�sz_NamespacePath._get_parent_pathcCsdt|���}||jks|j|jkr/|�|j|�}|dur(|jdur(|jr(|j|_	||_|j|_|j	SrJ)
r�rxryrzr{r|rvr�r�rw)r��parent_pathr�rrr	�_recalculate�sz_NamespacePath._recalculatecC�t|���SrJ)�iterr�rSrrr	�__iter__��z_NamespacePath.__iter__cCs|��|SrJ�r�)r��indexrrr	�__getitem__�r�z_NamespacePath.__getitem__cCs||j|<dSrJ)rw)r�r�rFrrr	�__setitem__�sz_NamespacePath.__setitem__cCr�rJ)rr�rSrrr	�__len__�r�z_NamespacePath.__len__cC�d�|j�S)Nz_NamespacePath({!r}))rarwrSrrr	�__repr__�r�z_NamespacePath.__repr__cCs||��vSrJr��r��itemrrr	�__contains__�r�z_NamespacePath.__contains__cCs|j�|�dSrJ)rwrBr�rrr	rB��z_NamespacePath.appendN)r�r�r�r�rzrr�rxr�r�r�r�r�r�r�rBrrrr	ru�s
ruc@sXeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)�_NamespaceLoadercCst|||�|_dSrJ)rurwr}rrr	r�sz_NamespaceLoader.__init__cCst�dt�d�|j�S)zsReturn repr for the module.

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

        zR_NamespaceLoader.module_repr() is deprecated and slated for removal in Python 3.12z<module {!r} (namespace)>)rsrtrurar�)r)rrr	�module_reprs�z_NamespaceLoader.module_reprcCr)NTrr,rrr	r��z_NamespaceLoader.is_packagecCr)Nrrr,rrr	r7r�z_NamespaceLoader.get_sourcecCstddddd�S)Nrz<string>r(T)r9)r:r,rrr	r&r�z_NamespaceLoader.get_codecCrr"rr#rrr	r$r%z_NamespaceLoader.create_modulecCsdSrJrrorrr	r*r�z_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�rwr+r,rrr	r-s�z_NamespaceLoader.load_modulecCsddlm}||j�S)Nr)�NamespaceReader)r`r�rw)r�r)r�rrr	ra's
z$_NamespaceLoader.get_resource_readerN)
r�r�r�rrr�r�r7r&r$r*r-rarrrr	r��s

r�c@sveZdZdZedd��Zedd��Zedd��Zedd	��Z	eddd��Z
edd
d��Zeddd��Zedd��Z
d
S)�
PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCsNttj���D]\}}|durtj|=qt|d�r|��qtjd7_dS)z}Call the invalidate_caches() method on all path entry finders
        stored in sys.path_importer_caches (where implemented).N�invalidate_cachesr)�listr�path_importer_cache�itemsr�r�rurz)r��finderrrr	r�2s

�zPathFinder.invalidate_cachesc	CsLtjdurtjst�dt�tjD]}z||�WSty#YqwdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r�
path_hooksrsrtr�r�)rF�hookrrr	�_path_hooks?s
�zPathFinder._path_hookscCsd|dkrzt��}Wn
tyYdSwztj|}W|Sty1|�|�}|tj|<Y|Sw)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)rrY�FileNotFoundErrorrr��KeyErrorr�)rrFr�rrr	�_path_importer_cacheLs��
�zPathFinder._path_importer_cachecCs�t|d�rt�|��d�}t�|t�|�|�\}}nt�|��d�}t�|t�|�|�}g}|dur:t�||�St�	|d�}||_
|S)Nr�z5.find_spec() not found; falling back to find_loader()z5.find_spec() not found; falling back to find_module())r�r��_object_namersrtr�r�rrr�r�)rr�r�r�r�r�r�rrr	�_legacy_get_specbs

zPathFinder._legacy_get_specNc	Cs�g}|D]C}t|ttf�sq|�|�}|durGt|d�r#|�||�}n|�||�}|dur.q|jdur7|S|j}|durBt	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�rFr�namespace_path�entryr�r�r�rrr	�	_get_specws*



�zPathFinder._get_speccCs^|durtj}|�|||�}|durdS|jdur-|j}|r+d|_t|||j�|_|SdS|S)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)rrFr�r�r�r�ru)rr�rFrr�r�rrr	r�s
zPathFinder.find_speccCs*t�dt�|�||�}|durdS|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.

        zePathFinder.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadNrrrrr	r�s�zPathFinder.find_modulecOsddlm}|j|i|��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)r�r�r�rrr	r��s
zPathFinder.find_distributionsrJr)r�r�r�r�rr�r�rr�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||_|pd|_t|j�s+tt��|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�|]}|�fVqdSrJrrp�r�rr	r
�s�z&FileFinder.__init__.<locals>.<genexpr>rqr�N)r��_loadersrFr]rHrrY�_path_mtime�set�_path_cache�_relaxed_path_cache)r�rF�loader_details�loadersr�rr�r	r�s

zFileFinder.__init__cCs
d|_dS)zInvalidate the directory mtime.r�N)r�rSrrr	r��rXzFileFinder.invalidate_cachescCs6t�dt�|�|�}|durdgfS|j|jpgfS)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.

        zeFileFinder.find_loader() is deprecated and slated for removal in Python 3.12; use find_spec() insteadN)rsrtrurr�r�)r�r�r�rrr	r��s�
zFileFinder.find_loadercCs|||�}t||||d�S)Nr�)r)r�r�r�rF�smslrr�rrr	r��s
�zFileFinder._get_specNc	Cszd}|�d�d}zt|jpt���j}Wnty d}Ynw||jkr-|��||_t	�r8|j
}|��}n|j}|}||vrlt
|j|�}|jD]\}	}
d|	}t
||�}t|�rg|�|
|||g|�SqJt|�}|jD]7\}	}
z
t
|j||	�}Wnty�YdSwtjd|dd�||	|vr�t|�r�|�|
||d|�Sqo|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.
        Frqr1r�rNz	trying {})�	verbosityzpossible namespace for {})rxrQrFrrYrdrRr��_fill_cacherr�r�r�rHr�rWr�rZrr�r�r�r�)r�r�r�is_namespace�tail_moduler��cache�cache_module�	base_pathrqr��
init_filename�	full_pathr�rrr	rsV�


��
��zFileFinder.find_specc	
Cs�|j}zt�|pt���}Wntttfyg}Ynwtj�	d�s)t
|�|_n%t
�}|D]}|�d�\}}}|rCd�
||���}n|}|�|�q.||_tj�	t�r^dd�|D�|_dSdS)zDFill the cache of potential modules and packages for this directory.rrqr_cSsh|]}|���qSr)r�)r�fnrrr	rPsz)FileFinder._fill_cache.<locals>.<setcomp>N)rFr�listdirrYr��PermissionError�NotADirectoryErrorrrrr�r�r�rar��addr r�)	r�rF�contents�lower_suffix_contentsr�r�r�rq�new_namerrr	r�3s&��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|�s
td|d���|g��R�S)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedrL)rZr�rL�rr�rr	�path_hook_for_FileFinder\sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)rr�r�rr�r	�	path_hookRs
zFileFinder.path_hookcCr�)NzFileFinder({!r}))rarFrSrrr	r�dr�zFileFinder.__repr__rJ)r�r�r�r�rr�r�rr�r�rr�rr�r�rrrr	r��s
3
r�cCs�|�d�}|�d�}|s!|r|j}n||krt||�}nt||�}|s*t|||d�}z||d<||d<||d<||d<WdStyGYdSw)N�
__loader__�__spec__r��__file__�
__cached__)�getr�rlrcr�	Exception)�nsr��pathname�	cpathnamer�r�rrr	�_fix_up_modulejs$

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

    Each item is a tuple (loader, suffixes).
    )r\r��extension_suffixesrcr�rlr�)�
extensions�source�bytecoderrr	r��s
r�cCs|adSrJ)r�)�_bootstrap_modulerrr	�_set_bootstrap_module�sr�cCs2t|�t�}tj�tj|�g�tj�t	�dS)z)Install the path-based import components.N)
r�r�rr�r�r�r��	meta_pathrBr�)r��supported_loadersrrr	�_install�sr�)r^rJ)NNN)rr)T)Ur�r�r�rgrrsr�rr�ntrr�posixr7�allr@r�r>rC�_pathseps_with_colonr!�%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYr r"rr)r/r2rHrOrQrVrWrZr]rn�type�__code__r�r'r�r&r,rAr�r�r�rBr�rr��DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXESr�r�r�r�r�r�r�r�r�r�r�r�r�r��objectr�rrrr.rHrcrlr\rur�r�r�r�r�r�r�rrrr	�<module>s�



�

	



G(!



�IC2-5E1 


?>