Your IP : 3.149.27.153
a
R�fPL � @ s� d Z ddlmZmZ ddlmZ ddlmZ ddlZddl Z ddl
Z
dZdZdd � Z
ed
g d��Zde_ e
jd
kr�dej_ dej_ dej_ dej_ G dd� de�ZG dd� ded�ZG dd� de�ZG dd� de�ZG dd� de�Zee d�r�G dd� de�Zee d ��rG d!d"� d"e�Zee d#��r6G d$d%� d%e�Zee d&��rRG d'd(� d(e�Zd)d*� Zed&��rjeZn4ed ��rzeZn$ed#��r�eZned��r�eZneZdS )+z|Selectors module.
This module allows high-level and efficient I/O multiplexing, built upon the
`select` module primitives.
� )�ABCMeta�abstractmethod)�
namedtuple)�MappingN� � c
C sd t | t�r| }n:zt| �� �}W n( tttfyH td�| ��d�Y n0 |dk r`td�|���|S )z�Return a file descriptor from a file object.
Parameters:
fileobj -- file object or file descriptor
Returns:
corresponding file descriptor
Raises:
ValueError if the object is invalid
zInvalid file object: {!r}Nr zInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError� TypeError�
ValueError�format)�fileobj�fd� r �./opt/alt/python39/lib64/python3.9/selectors.py�_fileobj_to_fd s
��r �SelectorKey)r r �events�dataz�SelectorKey(fileobj, fd, events, data)
Object used to associate a file object to its backing
file descriptor, selected event mask, and attached data.
)� � zFile object registered.zUnderlying file descriptor.z3Events that must be waited for on this file object.zzOptional opaque data associated to this file object.
For example, this could be used to store a per-client session ID.c @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
S )�_SelectorMappingz)Mapping of file objects to selector keys.c C s
|| _ d S �N)� _selector)�self�selectorr r r �__init__@ s z_SelectorMapping.__init__c C s t | jj�S r )�lenr �
_fd_to_key�r r r r �__len__C s z_SelectorMapping.__len__c C sB z| j �|�}| j j| W S ty< td�|��d �Y n0 d S �N�{!r} is not registered)r �_fileobj_lookupr �KeyErrorr )r r r r r r �__getitem__F s
z_SelectorMapping.__getitem__c C s t | jj�S r )�iterr r r! r r r �__iter__M s z_SelectorMapping.__iter__N)�__name__�
__module__�__qualname__�__doc__r r"