관리-도구
편집 파일: wait.cpython-37.pyc
B ��` � @ s� d dl Z d dlZd dlZd dlmZ yd dlmZ W n ek rT d dlmZ Y nX dddgZG dd� de �Z ejd kr�d d� Zndd� Zddd�Z ddd�Zdd� Zdd� Zdd� addd�Zddd�ZdS )� N)�partial)� monotonic)�time�NoWayToWaitForSocketError� wait_for_read�wait_for_writec @ s e Zd ZdS )r N)�__name__� __module__�__qualname__� r r �B/opt/alt/python37/lib/python3.7/site-packages/urllib3/util/wait.pyr s )� � c C s | |�S )Nr )�fn�timeoutr r r �_retry_on_intr* s r c C s� |d krt d�}n t� | }xry| |�S ttjfk r� } z@|jd tjkrR� n(|t� }|dk rhd}|t d�krxd }wW d d }~X Y qX qW d S )N�infr )�floatr �OSError�select�error�args�errnoZEINTR)r r Zdeadline�er r r r 0 s Fc C sd |s|st d��g }g }|r&|�| � |r4|�| � ttj|||�}t||�\}}} t|p`|p`| �S )Nz2must specify at least one of read=True, write=True)�RuntimeError�appendr r r �bool) �sock�read�writer ZrcheckZwcheckr ZrreadyZwreadyZxreadyr r r �select_wait_for_socketG s r c s^ |s|st d��d}|r"|tjO }|r0|tjO }t�� � � �| |� � fdd�}tt||��S )Nz2must specify at least one of read=True, write=Truer c s | d k r| d9 } � � | �S )Ni� )�poll)�t)�poll_objr r �do_pollf s z%poll_wait_for_socket.<locals>.do_poll)r r �POLLIN�POLLOUTr! �registerr r )r r r r �maskr$ r )r# r �poll_wait_for_socketZ s r) c O s t d��d S )Nzno select-equivalent available)r )r �kwargsr r r �null_wait_for_socketn s r+ c C s: yt �� } t| jd� W n ttfk r0 dS X dS d S )Nr FT)r r! r �AttributeErrorr )r# r r r �_have_working_pollr s r- c O s* t � rtanttd�rtantat| |�S )Nr )r- r) �wait_for_socket�hasattrr r r+ )r r* r r r r. s r. c C s t | d|d�S )z�Waits 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. )r r r r r r � s c C s t | d|d�S )z�Waits 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 r r r r r � s )FFN)FFN)N)N)r r �sys� functoolsr r r �ImportError�__all__� Exceptionr �version_infor r r) r+ r- r. r r r r r r �<module> s&