a �DOg()�@s�dZddlmZmZmZmZmZmZmZm Z m Z zddlm Z Wne yVdZ Yn0ddl mZmZmZmZddlmZddlmZddlmZddlZddlZddlZddlZddlZddlZejd ed d �dZd Zd Z d Z!dZ"dZ#dZ$dZ%dZ&dZ'dd�Z(dd�Z)dd�Z*d8dd�Z+dd�Z,dd�Z-Gd d!�d!�Z.Gd"d#�d#�Z/Gd$d%�d%e/ej0�Z1d9d&d'�Z2Gd(d)�d)e/e�Z3d:d*d+�Z4d,d-�Z5d.d/�Z6d;d0d1�Z7d2d3�Z8d4d5�Z9e �r�dk�z get_suffixes..cSsg|]}|dtf�qS)�r)� PY_SOURCEr7r!r!r"r:lr;cSsg|]}|dtf�qSr4)� PY_COMPILEDr7r!r!r"r:mr;)r�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXES)� extensions�source�bytecoder!r!r"� get_suffixesisrEc@s eZdZdZdd�Zdd�ZdS)� NullImporterz-**DEPRECATED** Null import object. cCs2|dkrtddd��ntj�|�r.td|d��dS)N�zempty pathnamer2zexisting directory)� ImportError�osr/�isdir)�selfr/r!r!r"�__init__zs zNullImporter.__init__cCsdS)zAlways returns None.Nr!)rK�fullnamer!r!r"� find_module�szNullImporter.find_moduleN)�__name__� __module__� __qualname__�__doc__rLrNr!r!r!r"rFrsrFcs.eZdZdZd�fdd� Z�fdd�Z�ZS)�_HackedGetDatazMCompatibility support for 'file' arguments of various load_*() functions.Ncst��||�||_dS)N)�superrL�file)rKrMr/rU�� __class__r!r"rL�sz_HackedGetData.__init__cs�|jrx||jkrx|jjs0|j}d|jvr0|��|jjrJt|jd�|_}|�|��Wd�S1sl0Yn t��|�SdS)z;Gross hack to contort loader to deal w/ load_*()'s bad API.�br5N) rUr/�closed�mode�close�open�readrT�get_data)rKr/rUrVr!r"r^�s (z_HackedGetData.get_data)N)rOrPrQrRrLr^� __classcell__r!r!rVr"rS�srSc@seZdZdZdS)�_LoadSourceCompatibilityz5Compatibility support for implementing load_source().N�rOrPrQrRr!r!r!r"r`�sr`cCs\t|||�}tj|||d�}|tjvr8t|tj|�}nt|�}t�||�|_ |j |j _ |S)N��loader) r`r�spec_from_file_locationr&�modulesr rr�SourceFileLoader� __loader__�__spec__rc�r �pathnamerUrc�spec�moduler!r!r"� load_source�s   rmc@seZdZdZdS)�_LoadCompiledCompatibilityz7Compatibility support for implementing load_compiled().Nrar!r!r!r"rn�srncCsZt|||�}tj|||d�}|tjvr8t|tj|�}nt|�}t||�|_|j|j _ |S)r3rb) rnrrdr&rer rrrgrhrcrir!r!r"� load_compiled�s    rocCs�tj�|�rftjdd�tjdd�}|D]*}tj�|d|�}tj�|�r,|}qfq,td� |���t j ||gd�}|t j vr�t|t j |�St|�SdS)r3NrLz{!r} is not a package)�submodule_search_locations)rIr/rJrr@rA�join�exists� ValueError�formatrrdr&rer r)r r/rB� extensionZ init_pathrkr!r!r"� load_package�s    � � rvc Cs4|\}}}|r2|�d�r d|vr2td�|����n�|durZ|tthvrZd�|�}t|��n�|tkrnt|||�S|tkr�t|||�S|tkr�tdur�|dur�t |d��}t|||�Wd�S1s�0Yn t|||�SnP|t k�r�t ||�S|t k�rt |�S|tk�rt|�Sd�||�}t||d��dS) z�**DEPRECATED** Load a module, given information returned by find_module(). The module name must include the full package name, if any. )r<�U�+zinvalid file open mode {!r}Nz.file object required for import (type code {})r5z*Don't know how to import {} (type code {})r)� startswithrsrtr=r>rmror6� load_dynamicr\� PKG_DIRECTORYrv� C_BUILTIN� init_builtin� PY_FROZENrrH) r rU�filename�details�suffixrZ�type_�msgZ opened_filer!r!r"� load_module�s.      ,     r�c Cs�t|t�std�t|����n$t|td�tf�sBtd�t|����|dur�t|�rbddddtffSt |�rzddddt ffSt j }|D]�}t j �||�}dtjdfD]>}d|}t j �||�}t j �|�r�d|ddtffSq�t�D]2\}}}||} t j �|| �}t j �|�r��q q�q��q:q�tt�|�|d��d} d |v�r�t|d �� } t�| j�d} Wd�n1�sz0Yt||| d �} | ||||ffS) a,**DEPRECATED** Search for a module. If path is omitted or None, search for a built-in, frozen or special module and continue search in sys.path. The module name cannot contain '.'; to search for a submodule of a package, pass the submodule name and the package's __path__. z'name' must be a str, not {}Nz%'path' must be None or a list, not {}rGz.pyrrLrrXr5)�encoding)� isinstance�str� TypeErrorrt�type�list� RuntimeErrorrr|r r~r&r/rIrqrrA�isfiler{rErHr r\�tokenize�detect_encoding�readline) r r/�entryZpackage_directoryr�Zpackage_file_nameZ file_pathrZr�� file_namer�rUr!r!r"rN�sB �    0rNcCs t�|�S)zw**DEPRECATED** Reload the module and return it. The module must have been successfully imported before. )� importlib�reload)rlr!r!r"r�2sr�cCs$z t|�WStyYdS0dS)zl**DEPRECATED** Load and return a built-in module by name, or None is such module doesn't exist N)rrHrr!r!r"r}=s  r}cCs0ddl}|j�||�}|jj|||d�}t|�S)z:**DEPRECATED** Load an extension module. rN)r rc�origin)�importlib.machineryr�ExtensionFileLoader� ModuleSpecr)r r/rUr�rcrkr!r!r"rzJs �rz)N)N)N)N)N);rR�_imprrrrrrrr r r rHZimportlib._bootstrapr r rrZimportlib._bootstrap_externalrr�rrrIr&r�rr+�warn�DeprecationWarningZ SEARCH_ERRORr=r>r6Z PY_RESOURCEr{r|r~ZPY_CODERESOURCEZIMP_HOOKr#r%r)r.r1rErFrSrfr`rmrnrorvr�rNr�r}rzr!r!r!r"�s`,     �     # 4