AlkantarClanX12

Your IP : 3.133.108.172


Current Path : /opt/alt/python35/lib64/python3.5/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/asyncio/__pycache__/windows_utils.cpython-35.pyc



��Yf��@sJdZddlZejdkr-ed��ddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddddd	gZd
Z
e	jZe	jZej�Zeed�r�ejZnejejddd�Zdd
ddde
dd�ZGdd	�d	�ZGdd�de	j�ZdS)z*
Various Windows specific bits and pieces
�N�win32z
win32 only�
socketpair�pipe�Popen�PIPE�
PipeHandlei c
Csk|tjkrd}n$|tjkr0d}ntd��|tjkrWtd��|dkrotd��tj|||�}z�|j|df�|jd�|j�dd	�\}}tj|||�}yb|jd
�y|j	||f�Wnt
tfk
rYnX|jd�|j�\}}	Wn|j
��YnXWd|j
�X||fS)z�A socket pair usable as a self-pipe, for Windows.

        Origin: https://gist.github.com/4325783, by Geert Jansen.
        Public domain.
        z	127.0.0.1z::1z?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supported�N�FT)�socket�AF_INETZAF_INET6�
ValueError�SOCK_STREAMZbindZlistenZgetsocknameZsetblockingZconnect�BlockingIOError�InterruptedErrorZaccept�close)
Zfamily�type�proto�hostZlsockZaddrZportZcsockZssock�_�r�:/opt/alt/python35/lib64/python3.5/asyncio/windows_utils.pyr%s8		



�duplexF�
overlappedT�bufsizecCs�tjddtj�tt�f�}|rWtj}tjtj	B}||}}ntj
}tj	}d|}}|tjO}|dr�|tjO}|dr�tj}nd}d}	}
y�tj
||tjd||tjtj�}	tj||dtjtj|tj�}
tj|	dd�}|jd�|	|
fSWn=|	dk	rftj|	�|
dk	rtj|
��YnXdS)zELike os.pipe() but with overlapped support and using handles not fds.�prefixz\\.\pipe\python-pipe-%d-%d-rrNrT)�tempfileZmktemp�os�getpid�next�
_mmap_counter�_winapiZPIPE_ACCESS_DUPLEXZGENERIC_READZ
GENERIC_WRITEZPIPE_ACCESS_INBOUNDZFILE_FLAG_FIRST_PIPE_INSTANCEZFILE_FLAG_OVERLAPPEDZCreateNamedPipeZ	PIPE_WAITZNMPWAIT_WAIT_FOREVERZNULLZ
CreateFileZ
OPEN_EXISTINGZConnectNamedPipeZGetOverlappedResult�CloseHandle)rrrZaddressZopenmode�accessZobsizeZibsizeZflags_and_attribsZh1Zh2ZovrrrrSs@			








c@s�eZdZdZdd�Zdd�Zedd��Zdd	�Zd
e	j
dd�Zd
d�Zdd�Z
dd�ZdS)rz�Wrapper for an overlapped pipe handle which is vaguely file-object like.

    The IOCP event loop can use these instead of socket objects.
    cCs
||_dS)N)�_handle)�self�handlerrr�__init__�szPipeHandle.__init__cCs9|jdk	rd|j}nd}d|jj|fS)Nz	handle=%r�closedz<%s %s>)r#�	__class__�__name__)r$r%rrr�__repr__�szPipeHandle.__repr__cCs|jS)N)r#)r$rrrr%�szPipeHandle.handlecCs"|jdkrtd��|jS)NzI/O operatioon on closed pipe)r#r)r$rrr�fileno�szPipeHandle.filenor!cCs)|jdk	r%||j�d|_dS)N)r#)r$r!rrrr�s
zPipeHandle.closecCs1|jdk	r-tjd|t�|j�dS)Nzunclosed %r)r#�warnings�warn�ResourceWarningr)r$rrr�__del__�szPipeHandle.__del__cCs|S)Nr)r$rrr�	__enter__�szPipeHandle.__enter__cCs|j�dS)N)r)r$�t�v�tbrrr�__exit__�szPipeHandle.__exit__N)r)�
__module__�__qualname__�__doc__r&r*�propertyr%r+r r!rr/r0r4rrrrr�scs1eZdZdZddd�fdd�Z�S)rz�Replacement for subprocess.Popen using overlapped pipe handles.

    The stdin, stdout, stderr are None or instances of PipeHandle.
    Ncs4|jd�st�|jdd�dks4t�d}}}d}	}
}|tkr�tdddd�\}}	tj|tj�}n|}|tkr�tdd�\}
}
tj|
d�}n|}|tkrtdd
�\}}tj|d�}n|tkr|}n|}z�y)t	�j
|d|d	|d
||�Wn>x0|	|
|fD]}|dk	rdtj|�qdW�YnRX|	dk	r�t
|	�|_|
dk	r�t
|
�|_|dk	r�t
|�|_Wd|tkr�tj|�|tkrtj|�|tkr/tj|�XdS)NZuniversal_newlinesrrrFTr�stdin�stdout�stderr)FT)TF)TF)�get�AssertionErrorrr�msvcrtZopen_osfhandler�O_RDONLY�STDOUT�superr&r r!rr9r:r;r)r$�argsr9r:r;�kwdsZ	stdin_rfdZ
stdout_wfdZ
stderr_wfdZstdin_whZ	stdout_rhZ	stderr_rhZstdin_rhZ	stdout_whZ	stderr_wh�h)r(rrr&�sL	

zPopen.__init__)r)r5r6r7r&rr)r(rr�s)TT)r7�sys�platform�ImportErrorr �	itertoolsr>rr
�
subprocessrr,�__all__ZBUFSIZErr@�countr�hasattrrrr
rrrrrrr�<module>s,		.0,