Hacked By AnonymousFox
U
e5d�H � @ s� d Z ddlmZmZ ddlmZ ddlmZ ddlZddl Z ddl
Z
dZdZdd � Z
ed
ddd
dg�Zde_ e
jdkr�dej_ dej_ dej_ dej_ G dd� de�ZG dd� ded�ZG dd� de�ZG dd� de�ZG dd� de�Zee d ��rG d!d"� d"e�Zee d#��r G d$d%� d%e�Zee d&��r<G d'd(� d(e�Zee d)��rXG d*d+� d+e�Zd+e� k�rjeZn:d%e� k�r|eZn(d(e� k�r�eZnd"e� k�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 sf t | t�r| }n<zt| �� �}W n* tttfk
rJ td�| ��d�Y nX |dk rbtd�|���|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 �!/usr/lib64/python3.8/selectors.py�_fileobj_to_fd s
��r �SelectorKeyr 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)�selfZselectorr r r �__init__? s z_SelectorMapping.__init__c C s t | jj�S r )�lenr �
_fd_to_key�r r r r �__len__B s z_SelectorMapping.__len__c C sD z| j �|�}| j j| W S tk
r> td�|��d �Y nX d S �N�{!r} is not registered)r �_fileobj_lookupr �KeyErrorr )r r r r r r �__getitem__E s
z_SelectorMapping.__getitem__c C s t | jj�S r )�iterr r r r r r �__iter__L s z_SelectorMapping.__iter__N)�__name__�
__module__�__qualname__�__doc__r r! r&