Your IP : 18.226.180.253


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.opt-2.pyc



���]��@sDddlZejdkr'ed��ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
dddddgZd	Zej
Z
ejZej�Zeed�r�ejZnejejdd
d�Zddd
ddedd�ZGdd�d�ZGdd�dej�ZdS)�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)Nz	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��FT)�socket�AF_INET�AF_INET6�
ValueError�SOCK_STREAM�bind�listen�getsockname�setblocking�connect�BlockingIOError�InterruptedError�accept�close)
�family�type�proto�hostZlsock�addr�portZcsockZssock�_�r�2/opt/alt/python35/lib64/python3.5/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)N�prefixz\\.\pipe\python-pipe-%d-%d-rrr"T)�tempfile�mktemp�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)r!r"r#�addressZopenmode�accessZobsizeZibsizeZflags_and_attribsZh1Zh2Zovrrr rSs@			








c@seZdZdd�Zdd�Zedd��Zdd�Zd	ej	d
d�Z
dd
�Zdd�Zdd�Z
dS)rcCs
||_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__)r0r1rrr �__repr__�szPipeHandle.__repr__cCs|jS)N)r/)r0rrr r1�szPipeHandle.handlecCs"|jdkrtd��|jS)NzI/O operatioon on closed pipe)r/r
)r0rrr �fileno�szPipeHandle.filenor,cCs)|jdk	r%||j�d|_dS)N)r/)r0r,rrr r�s
zPipeHandle.closecCs1|jdk	r-tjd|t�|j�dS)Nzunclosed %r)r/�warnings�warn�ResourceWarningr)r0rrr �__del__�szPipeHandle.__del__cCs|S)Nr)r0rrr �	__enter__�szPipeHandle.__enter__cCs|j�dS)N)r)r0�t�v�tbrrr �__exit__�szPipeHandle.__exit__N)r5�
__module__�__qualname__r2r6�propertyr1r7r+r,rr;r<r@rrrr r�scs+eZdZddd�fdd�Z�S)rNcsd}}}d}	}
}|tkr[tdd	dd�\}}	tj|tj�}n|}|tkr�tdd
�\}
}
tj|
d�}n|}|tkr�tdd�\}}tj|d�}n|tkr�|}n|}z�y)t�j|d|d|d||�Wn>x0|	|
|fD]}|dk	r0t	j
|�q0W�YnRX|	dk	rvt|	�|_|
dk	r�t|
�|_
|dk	r�t|�|_Wd|tkr�tj|�|tkr�tj|�|tkr�tj|�XdS)Nr"FTr!r�stdin�stdout�stderr)FT)TF)TF)rr�msvcrt�open_osfhandler'�O_RDONLY�STDOUT�superr2r+r,rrDrErFr)r0�argsrDrErF�kwdsZ	stdin_rfdZ
stdout_wfdZ
stderr_wfdZstdin_whZ	stdout_rhZ	stderr_rhZstdin_rhZ	stdout_whZ	stderr_wh�h)r4rr r2�sH	

zPopen.__init__)r5rArBr2rr)r4r r�s)TT)�sys�platform�ImportErrorr+�	itertoolsrGr'r
�
subprocessr%r8�__all__�BUFSIZErrJ�countr*�hasattrrrrrrrrrrr �<module>s*		.0,

?>