U eG@sddlmZddlZddlZddlmZddgZddddd dd d d Zddddd dd d dZddddZ ddddd dd dda ddd ddddZ ddd ddddZ dS)) annotationsN)partial wait_for_readwait_for_writeFz socket.socketbool float | None)sockreadwritetimeoutreturnc Csb|s|stdg}g}|r&|||r4||ttj|||}||\}}} t|p^|p^| S)N2must specify at least one of read=True, write=True) RuntimeErrorappendrselectr) rr r r rcheckwcheckfnrreadywreadyxreadyr?/opt/hc_python/lib/python3.8/site-packages/urllib3/util/wait.pyselect_wait_for_socket!s  rcsd|s|stdd}|r"|tjO}|r0|tjO}t||dddfdd }t||S)Nr rrzlist[tuple[int, int]])tr cs|dk r|d9}|S)Ni)poll)rpoll_objrrdo_pollJsz%poll_wait_for_socket..do_poll)rrPOLLINPOLLOUTrregisterr)rr r r maskrrrrpoll_wait_for_socket9s   r#)r c Cs:zt}|dWnttfk r0YdSXdSdS)NrFT)rrAttributeErrorOSErrorrrrr_have_working_pollRs r&cCs(tr tanttdrtat||||S)Nr)r&r#wait_for_sockethasattrrr)rr r r rrrr'_s  r')rr r cCst|d|dS)zWaits for reading to be available on a given socket. Returns True if the socket is readable, or False if the timeout expired. T)r r r'rr rrrrqscCst|d|dS)zWaits for writing to be available on a given socket. Returns True if the socket is readable, or False if the timeout expired. T)r r r)r*rrrrxs)FFN)FFN)FFN)N)N) __future__rrsocket functoolsr__all__rr#r&r'rrrrrrs&