Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/IPython/utils/__pycache__/_process_win32.cpython-39.pyc
Ðазад
a o�h� � @ s" d Z ddlZddlZddlZddlZddlmZmZ ddlmZm Z ddl mZmZ ddl mZ ddlmZmZmZ dd lmZ dd lmZ G dd� de�Zd d� Zdd� Zdd� ZzHejjjZeee�ge_ ee�e_!ejj"j#Z#e e#_$e ge#_ ddd�ZW n e%�y eZY n0 dd� Z&dS )zWindows-specific implementation of process utilities. This file is only meant to be imported by process.py, not by end-users. � N)�c_int�POINTER)�LPCWSTR�HLOCAL)�STDOUT�TimeoutExpired)�Thread� )�read_no_interrupt�process_handler� arg_split)� py3compat)�DEFAULT_ENCODINGc @ s e Zd ZdZdd� Zdd� ZdS )�AvoidUNCPatha� A context manager to protect command execution from UNC paths. In the Win32 API, commands can't be invoked with the cwd being a UNC path. This context manager temporarily changes directory to the 'C:' drive on entering, and restores the original working directory on exit. The context manager returns the starting working directory *if* it made a change and None otherwise, so that users can apply the necessary adjustment to their system calls in the event of a change. Examples -------- :: cmd = 'dir' with AvoidUNCPath() as path: if path is not None: cmd = '"pushd %s &&"%s' % (path, cmd) os.system(cmd) c C s6 t �� | _| j�d�| _| jr.t �d� | jS d S d S )Nz\\zC:)�os�getcwd�path� startswith�is_unc_path�chdir)�self� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/IPython/utils/_process_win32.py� __enter__9 s zAvoidUNCPath.__enter__c C s | j rt�| j� d S )N)r r r r )r �exc_type� exc_value� tracebackr r r �__exit__E s zAvoidUNCPath.__exit__N)�__name__� __module__�__qualname__�__doc__r r r r r r r % s r c sb t � � �fdd�}� �fdd�}t|d��� t|d��� ��� }|du rXt�d� q<|S q<dS )zCallback for _system.c s2 t �j��� D ]} | �� d�} t| tjd� qd S �N�replace)�file)r �stdout� splitlines�decode�print�sys��line��enc�pr r �stdout_readN s z!_system_body.<locals>.stdout_readc s2 t �j��� D ]} | �� d�} t| tjd� qd S r"