File: //lib64/python3.9/asyncio/__pycache__/base_events.cpython-39.pyc
a
    �DOg�! �                   @   s�  d Z ddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZzddlZW n ey�   dZY n0 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddl m!Z! dZ"dZ#dZ$e%e	d�Z&dZ'e(� Z)dd� Z*dd� Z+dd� Z,d-dd�Z-d.dd�Z.dd � Z/e%e	d!��r�d"d#� Z0nd$d#� Z0d%d&� Z1G d'd(� d(ej2�Z3G d)d*� d*ej4�Z5G d+d,� d,ej6�Z7dS )/a�  Base implementation of event loop.
The event loop can be broken up into a multiplexer (the part
responsible for notifying us of I/O events) and the event loop proper,
which wraps a multiplexer with functionality for scheduling callbacks,
immediately or at a given time in the future.
Whenever a public API takes a callback, subsequent positional
arguments will be passed to the callback if/when it is called.  This
avoids the proliferation of trivial lambdas implementing closures.
Keyword arguments for the callback are not supported; this is a
conscious design decision, leaving the door open for keyword arguments
to modify the meaning of the API call itself.
�    N�   )�	constants)�
coroutines)�events)�
exceptions)�futures)�	protocols)�sslproto)�	staggered)�tasks)�
transports)�trsock)�logger)�
BaseEventLoop�Server�d   g      �?�AF_INET6i�Q c                 C   s0   | j }tt|dd �tj�r$t|j�S t| �S d S )N�__self__)�	_callback�
isinstance�getattrr   �Task�reprr   �str)�handle�cb� r   �+/usr/lib64/python3.9/asyncio/base_events.py�_format_handleJ   s    
r   c                 C   s(   | t jkrdS | t jkrdS t| �S d S )Nz<pipe>z<stdout>)�
subprocess�PIPE�STDOUTr   )�fdr   r   r   �_format_pipeS   s
    
r#   c                 C   sJ   t td�std��n2z| �tjtjd� W n tyD   td��Y n0 d S )N�SO_REUSEPORTz)reuse_port not supported by socket moduler   zTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)�hasattr�socket�
ValueError�
setsockopt�
SOL_SOCKETr$   �OSError��sockr   r   r   �_set_reuseport\   s    
r-   c           	   	   C   s�  t td�sd S |dtjtjhvs(| d u r,d S |tjkr>tj}n|tjkrPtj}nd S |d u rbd}nVt|t�rz|dkrzd}n>t|t�r�|dkr�d}n&zt	|�}W n t
tfy�   Y d S 0 |tjkr�tj
g}tr�|�tj� n|g}t| t�r�| �d�} d| v �rd S |D ]r}zVt�|| � t�rH|tjk�rH|||d| |||ffW   S |||d| |ffW   S W n t�yv   Y n0 �qd S )N�	inet_ptonr   �    � Zidna�%)r%   r&