File: //lib/python3/dist-packages/dockerpty/__pycache__/io.cpython-310.pyc
o
    ~ vU"+  �                   @   sx   d dl Z d dlZd dlZd dlZd dlZd dlZd
dd�Zddd�ZG dd� de�Z	G d	d
� d
e�Z
G dd� de�ZdS )�    NTc                 C   sJ   t � | t j�}|r|tj @ }n|tjB }t � | t j|� t|tj@ � S )zl
    Set the given file-descriptor blocking or non-blocking.
    Returns the original blocking status.
    )�fcntl�F_GETFL�os�
O_NONBLOCK�F_SETFL�bool)�fd�blocking�old_flag�new_flag� r   �./usr/lib/python3/dist-packages/dockerpty/io.py�set_blocking   s   
r   c              
   C   sp   g }z
t �| |||�dd� W S  t jy7 } ztjr|jn|d }|tjkr1g g fW  Y d}~S |�d}~ww )z�
    Select the streams from `read_streams` that are ready for reading, and
    streams from `write_streams` ready for writing.
    Uses `select.select()` internally but only returns two lists of ready streams.
    r   �   N)�builtin_select�select�error�six�PY3�errno�EINTR)�read_streams�
write_streams�timeout�exception_streams�e�nor   r   r
   r   ,   s"