ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python39/lib64/python3.9/__pycache__/runpy.cpython-39.pyc

a

���e3�@sdZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddgZGdd�de�Z
Gdd	�d	e�Zd d
d�Zd!dd
�Zefdd�ZGdd�de�Zd"dd�Zd#dd�Zefdd�Zdd�Zd$dd�Zedk�reej�dk�r�edejd�nejd=eejd�dS)%aZrunpy.py - locating and running Python code using the module namespace

Provides support for locating and running Python scripts using the Python
module namespace instead of the native filesystem.

This allows Python code to play nicely with non-filesystem based PEP 302
importers when locating support scripts as well as when importing modules.
�N)�	read_code�get_importer�
run_module�run_pathc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_TempModulezCTemporarily replace a module in sys.modules with an empty namespacecCs||_t�|�|_g|_dS�N)�mod_name�types�
ModuleType�module�
_saved_module��selfr�r�*/opt/alt/python39/lib64/python3.9/runpy.py�__init__sz_TempModule.__init__cCs@|j}z|j�tj|�Wnty.Yn0|jtj|<|Sr)rr�append�sys�modules�KeyErrorrr
rrr�	__enter__ sz_TempModule.__enter__cGs.|jr|jdtj|j<n
tj|j=g|_dS�Nr)rrrr�r�argsrrr�__exit__)s
z_TempModule.__exit__N)�__name__�
__module__�__qualname__�__doc__rrrrrrrrs	rc@s$eZdZdd�Zdd�Zdd�ZdS)�_ModifiedArgv0cCs||_t�|_|_dSr)�value�object�_saved_value�	_sentinel)rr rrrr1sz_ModifiedArgv0.__init__cCs0|j|jurtd��tjd|_|jtjd<dS)NzAlready preserving saved valuer)r"r#�RuntimeErrorr�argvr )rrrrr5sz_ModifiedArgv0.__enter__cGs|j|_|jtjd<dSr)r#r r"rr%rrrrr;sz_ModifiedArgv0.__exit__N)rrrrrrrrrrr0src
	Csn|dur|�|�|dur(d}|}d}	n |j}|j}|j}	|durH|j}|j|||	d|||d�t||�|S)z)Helper to run code in nominated namespaceN)r�__file__�
__cached__r�
__loader__�__package__�__spec__)�update�loader�origin�cached�parent�exec)
�codeZrun_globals�init_globalsr�mod_spec�pkg_name�script_namer,�fnamer.rrr�	_run_code@s*
�
r7c	
Cs�|dur|n|j}t|��T}t|��,|jj}t|||||||�Wd�n1sV0YWd�n1st0Y|��S)z5Helper to run code in new namespace with sys modifiedN)r-rrr�__dict__r7�copy)	r1r2rr3r4r5r6�temp_module�mod_globalsrrr�_run_module_codeZs�@r<c
Csd|�d�r|d��|�d�\}}}|r�zt|�WnJty|}z2|jdusf|j|krh|�|jd�sh�WYd}~n
d}~00tj�|�}|dur�t|d�s�ddl	m
}dj||d�}|t|��zt
j�|�}Wnvttttf�yH}	zTd}|�d	��r|d
|dd��d|�d
�7}||�|t|	�j|	��|	�WYd}	~	n
d}	~	00|du�r`|d|��|jdu�r�|dk�s�|�d��r�|d��z|d}
t|
|�WS|�y�}z*|tjv�r��|d||f��WYd}~n
d}~00|j}|du�r|d|��z|�|�}Wn4t�yB}z|t|��|�WYd}~n
d}~00|du�rZ|d|��|||fS)N�.z#Relative module names not supported�__path__r)�warnz�{mod_name!r} found in sys.modules after import of package {pkg_name!r}, but prior to execution of {mod_name!r}; this may result in unpredictable behaviour)rr4z:Error while finding module specification for {!r} ({}: {})z.pyz
. Try using '���z' instead of 'z' as the module name.zNo module named %s�__main__z	.__main__z%Cannot use package as __main__ modulez3%s; %r is a package and cannot be directly executedz0%r is a namespace package and cannot be executedzNo code object available for %s)�
startswith�
rpartition�
__import__�ImportError�namerr�get�hasattr�warningsr?�format�RuntimeWarning�	importlib�util�	find_spec�AttributeError�	TypeError�
ValueError�endswith�typer�submodule_search_locations�_get_module_detailsr,�get_code)
r�errorr4�_�eZexistingr?�msg�specZexZ
pkg_main_namer,r1rrrrUhsj
���
0
�
�$
rUc@seZdZdZdS)�_ErrorzBError that _run_module_as_main() should report without a tracebackN)rrrrrrrrr\�sr\Tc
Cs�z0|s|dkr t|t�\}}}ntt�\}}}Wn<tyl}z$dtj|f}t�|�WYd}~n
d}~00tjdj}|r�|jtj	d<t
||dd|�S)a�Runs the designated module in the __main__ namespace

       Note that the executed module will have full access to the
       __main__ namespace. If this is not desirable, the run_module()
       function should be used to run the module code in a fresh namespace.

       At the very least, these variables in __main__ will be overwritten:
           __name__
           __file__
           __cached__
           __loader__
           __package__
    rAz%s: %sNr)rUr\�_get_main_module_detailsr�
executable�exitrr8r-r%r7)rZ
alter_argvr3r1�excrZZmain_globalsrrr�_run_module_as_main�s �raFcCs@t|�\}}}|dur|}|r,t||||�St|i|||�SdS)u"Execute a module's code without importing it.

       mod_name -- an absolute module name or package name.

       Optional arguments:
       init_globals -- dictionary used to pre-populate the module’s
       globals dictionary before the code is executed.

       run_name -- if not None, this will be used for setting __name__;
       otherwise, __name__ will be set to mod_name + '__main__' if the
       named module is a package and to just mod_name otherwise.

       alter_sys -- if True, sys.argv[0] is updated with the value of
       __file__ and sys.modules[__name__] is updated with a temporary
       module object for the module being executed. Both are
       restored to their original values before the function returns.

       Returns the resulting module globals dictionary.
    N)rUr<r7)rr2�run_nameZ	alter_sysr3r1rrrr�sc
Cs�d}tj|}tj|=zpzt|�WW|tj|<Styx}z2|t|�vrb|d|tjdf�|��WYd}~n
d}~00W|tj|<n|tj|<0dS)NrAzcan't find %r module in %rr)rrrUrE�str�path)rWZ	main_nameZ
saved_mainr`rrrr]�s 


���r]cCs�tj�t�|��}t�|��}t|�}Wd�n1s:0Y|dur�t�|�� }t|��|d�}Wd�n1s|0Y||fS)Nr0)	�osrd�abspath�fsdecode�io�	open_coder�compile�read)rbr6Zdecoded_path�fr1rrr�_get_code_from_file�s&.rmcCs�|durd}|�d�d}t|�}d}t|�jdkrFt|�jdkrFd}t|td��sX|rxt||�\}}t|||||d	�Stj	�
d|�z�t�\}}	}t|���}
t
|��d|
jj}t|||||	|���Wd�Wd�Wztj	�|�WSt�yYS0S1�s0YWd�n1�s20YWztj	�|�Wnt�ybYn0n(ztj	�|�Wnt�y�Yn00dS)
uExecute code located at the specified filesystem location.

       path_name -- filesystem location of a Python script, zipfile,
       or directory containing a top level __main__.py script.

       Optional arguments:
       init_globals -- dictionary used to pre-populate the module’s
       globals dictionary before the code is executed.

       run_name -- if not None, this will be used to set __name__;
       otherwise, '<run_path>' will be used for __name__.

       Returns the resulting module globals dictionary.
    Nz
<run_path>r=rFZimpZNullImporterT)r4r5)rCrrSrr�
isinstancermr<rrd�insertr]rrrr8r7r9�removerQ)Z	path_namer2rbr4ZimporterZis_NullImporterr1r6rr3r:r;rrrrsH�
��$�6�rA�z!No module specified for execution)�file)NNNNN)NNNNN)T)NNF)NN)rr�importlib.machineryrL�importlib.utilrhr	reZpkgutilrr�__all__r!rrr7r<rErU�	Exceptionr\rarr]rmrr�lenr%�print�stderrrrrr�<module>sB��
�
=
�

6


Zerion Mini Shell 1.0