MINI MINI MANI MO

Path : /usr/lib64/python3.6/asyncio/__pycache__/
File Upload :
Current File : //usr/lib64/python3.6/asyncio/__pycache__/windows_utils.cpython-36.opt-1.pyc

3


 \@sdZddlZejdkredddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddddd	gZd
Z
e	jZe	jZejZeedrejZnejejdfddZdde
dddZGdd	d	ZGddde	jZdS)z*
Various Windows specific bits and pieces
NZwin32z
win32 only
socketpairpipePopenPIPE
PipeHandlei c
Cs|tjkrd}n|tjkr d}ntd|tjkr:td|dkrJtdtj|||}z|j|df|jd|jdd	\}}tj|||}yP|jd
y|j	||fWnt
tfk
rYnX|jd|j\}}	Wn|j
YnXWd|j
X||fS)zA 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 supportedNFT)socketAF_INETZAF_INET6
ValueErrorSOCK_STREAMZbindZlistenZgetsocknameZsetblockingZconnectBlockingIOErrorInterruptedErrorZacceptclose)
ZfamilytypeprotohostZlsockZaddrZportZcsockZssock_r-/usr/lib64/python3.6/asyncio/windows_utils.pyr%s8






FT)duplex
overlappedbufsizecCs"tjdtjttfd}|r>tj}tjtj	B}||}}ntj
}tj	}d|}}|tjO}|drp|tjO}|drtj}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)tempfileZmktemposgetpidnext
_mmap_counter_winapiZPIPE_ACCESS_DUPLEXZGENERIC_READZ
GENERIC_WRITEZPIPE_ACCESS_INBOUNDZFILE_FLAG_FIRST_PIPE_INSTANCEZFILE_FLAG_OVERLAPPEDZCreateNamedPipeZ	PIPE_WAITZNMPWAIT_WAIT_FOREVERZNULLZ
CreateFileZ
OPEN_EXISTINGZConnectNamedPipeZGetOverlappedResultCloseHandle)rrrZaddressZopenmodeaccessZobsizeZibsizeZflags_and_attribsZh1Zh2ZovrrrrSs@








c@s\eZdZdZddZddZeddZdd	Ze	j
d
ddZd
dZddZ
ddZdS)rzWrapper 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)selfhandlerrr__init__szPipeHandle.__init__cCs*|jdk	rd|j}nd}d|jj|fS)Nz	handle=%rclosedz<%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#rrrfilenos
zPipeHandle.fileno)r cCs|jdk	r||jd|_dS)N)r")r#r rrrrs

zPipeHandle.closecCs*|jdk	r&tjd|t|d|jdS)Nzunclosed %r)source)r"warningswarnResourceWarningr)r#rrr__del__s
zPipeHandle.__del__cCs|S)Nr)r#rrr	__enter__szPipeHandle.__enter__cCs|jdS)N)r)r#tvtbrrr__exit__szPipeHandle.__exit__N)r(
__module____qualname____doc__r%r)propertyr$r*rr rr/r0r4rrrrrscs"eZdZdZdfdd	ZZS)rzReplacement 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|}|tkrtd	d\}}tj|d}n|tkr|}n|}zy tj|f|||d|Wn4x$|	|
|fD]}|dk	rt	j
|qWYn>X|	dk	rt|	|_|
dk	r"t|
|_
|dk	r6t||_Wd|tkrNtj||tkrbtj||tkrvtj|XdS)
NFT)rr)rr)stdinstdoutstderr)FT)TF)TF)rrmsvcrtZopen_osfhandlerO_RDONLYSTDOUTsuperr%rr rr9r:r;r)r#argsr9r:r;kwdsZ	stdin_rfdZ
stdout_wfdZ
stderr_wfdZstdin_whZ	stdout_rhZ	stderr_rhZstdin_rhZ	stdout_whZ	stderr_whh)r'rrr%sH









zPopen.__init__)NNN)r(r5r6r7r%
__classcell__rr)r'rrs)TT)r7sysplatformImportErrorr	itertoolsr<rr	
subprocessrr,__all__ZBUFSIZErr>countrhasattrrr
rrrrrrrr<module>s,

.0-

OHA YOOOO