3 \@sddlZejdkredddlZddlZddlZddlZddlZddlZddl Z ddl Z dddddgZ d Z ej Z ejZejZeedrejZnejejdfd dZd de d ddZGdddZGdddejZdS)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 t fk 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 supportedFT)socketAF_INETZAF_INET6 ValueError SOCK_STREAMZbindZlistenZ getsocknameZ setblockingZconnectBlockingIOErrorInterruptedErrorZacceptclose) ZfamilytypeprotohostZlsockZaddrZportZcsockZssock_r-/usr/lib64/python3.6/asyncio/windows_utils.pyr%s8        FT)duplex overlappedbufsizec Cs"tjdtjttfd}|r>tj}tjtj B}||}}ntj }tj }d|}}|tj O}|drp|tj O}|drtj }nd}d} } yZtj ||tjd||tjtj} tj||dtjtj|tj} tj| dd} | jd| | fS| dk rtj| | dk rtj| YnXdS)Nz\\.\pipe\python-pipe-%d-%d-)prefixrrT)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_EXISTINGZConnectNamedPipeZGetOverlappedResult CloseHandle) rrrZaddressZopenmodeaccessZobsizeZibsizeZflags_and_attribsZh1Zh2ZovrrrrSs@           c@sXeZdZddZddZeddZddZej d d d Z d d Z ddZ ddZ dS)rcCs ||_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)Nz unclosed %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__r%r)propertyr$r*rr rr/r0r4rrrrrs cseZdZdfdd ZZS)rNc s|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 rr8r9r:r)r#argsr8r9r:kwdsZ stdin_rfdZ stdout_wfdZ stderr_wfdZstdin_whZ stdout_rhZ stderr_rhZstdin_rhZ stdout_whZ stderr_whh)r'rrr%sH            zPopen.__init__)NNN)r(r5r6r% __classcell__rr)r'rrs)TT)sysplatform ImportErrorr itertoolsr;rr subprocessrr,__all__ZBUFSIZErr=countrhasattrrr r rrrrrrrs*  .0-