????
Your IP : 3.135.192.183
3
\��@s�dZddlZejdkred��ddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddddd gZd
Z
e jZe jZej�Zeed�r�ejZnejejdfdd�Zdde
d�dd�ZGdd �d �ZGdd�de j�ZdS)z*
Various Windows specific bits and pieces
�NZwin32z
win32 only�
socketpair�pipe�Popen�PIPE�
PipeHandlei c
Cs|tjkrd}n|tjkr d}ntd��|tjkr:td��|dkrJtd��tj|||�}z�|j|df�|jd�|j�dd �\}}tj|||�}yP|jd
�y|j ||f�Wnt
tfk
r�YnX|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�-/usr/lib64/python3.6/asyncio/windows_utils.pyr%s8
FT)�duplex�
overlapped�bufsizecCs"tjdtj�tt�fd�}|r>tj}tjtj B}||}}ntj
}tj }d|}}|tjO}|drp|tjO}|dr�tj}nd}d} }
yZtj
||tjd||tjtj�} tj||dtjtj|tj�}
tj| dd�}|jd�| |
fS| dk �rtj| �|
dk �rtj|
��YnXdS)zELike os.pipe() but with overlapped support and using handles not fds.z\\.\pipe\python-pipe-%d-%d-)�prefixrrNT)r)�tempfileZmktemp�os�getpid�next�
_mmap_counter�_winapiZPIPE_ACCESS_DUPLEXZGENERIC_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 �Ze j
d
�dd�Zd
d�Zdd�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__cCs*|jdk rd|j}nd}d|jj|fS)Nz handle=%r�closedz<%s %s>)r"� __class__�__name__)r#r$rrr�__repr__�s
zPipeHandle.__repr__cCs|jS)N)r")r#rrrr$�szPipeHandle.handlecCs|jdkrtd��|jS)NzI/O operatioon on closed pipe)r"r)r#rrr�fileno�s
zPipeHandle.fileno)r cCs|jdk r||j�d|_dS)N)r")r#r rrrr�s
zPipeHandle.closecCs*|jdk r&tjd|t|d�|j�dS)Nzunclosed %r)�source)r"�warnings�warn�ResourceWarningr)r#rrr�__del__�s
zPipeHandle.__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*rr rr/r0r4rrrrr�scs"eZdZdZd�fdd� Z�ZS)rz�Replacement for subprocess.Popen using overlapped pipe handles.
The stdin, stdout, stderr are None or instances of PipeHandle.
Ncs|d}}}d} }
}|tkr@tddd�\}} tj|tj�}n|}|tkrhtdd�\}
}
tj|
d�}n|}|tkr�td d�\}}tj|d�}n|tkr�|}n|}z�y t�j|f|||d�|��Wn4x$| |
|fD]}|dk r�t j
|�q�W�Yn>X| dk �rt| �|_|
dk �r"t|
�|_
|dk �r6t|�|_Wd|tk�rNtj|�|tk�rbtj|�|tk�rvtj|�XdS)
NFT)rr)rr)�stdin�stdout�stderr)FT)TF)TF)rr�msvcrtZopen_osfhandler�O_RDONLY�STDOUT�superr%rr 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%�sH
zPopen.__init__)NNN)r(r5r6r7r%�
__classcell__rr)r'rr�s)TT)r7�sys�platform�ImportErrorr� itertoolsr<rr �
subprocessrr,�__all__ZBUFSIZErr>�countr�hasattrrr
rrrrrrrr�<module>s,
.0-