U '�7`O � @ s d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl mZmZ ddl mZ ddlmZmZmZmZmZmZmZmZ ddl mZ ddlmZmZ ddlmZ ddlZdd lm Z m!Z!m"Z" d dl#m$Z$m%Z% d dl m&Z& d d l'm Z d dl(m)Z) d dl*m+Z+ d dl,m-Z-m.Z. d dl/m0Z0 d dl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9 d dl:m;Z; e�rxddl<m=Z= ndZ=ej>dk�o�ej?dkZ@eAejd�dd�ZBeAeCejd�dd�ZDeCd�dd�ZEG d d!� d!e�ZFG d"d#� d#eF�ZGG d$d%� d%eF�ZHG d&d'� d'�ZIG d(d)� d)e jJ�ZKeeeed*�d+d,�ZLeg ejMf ZNejOejPd-feNeQeejM d.�d/d0��ZRejPfeNejMd1�d2d3�ZSdEejMeQdd4�d5d6�ZTejUd�d7d8�ZVdFee= ejWd9�d:d;�ZXdGe+e-d d �d-de+e+e+e+dd<d=d>�eAeAeee-eQeeeeeee= eCee5d?�d@dA�ZYe+e+feeedB�dCdD�ZZdS )HzUtilities shared by tests.� N)�ABC�abstractmethod)� TracebackType)� TYPE_CHECKING�Any�Callable�Iterator�List�Optional�Type�Union)�mock)�CIMultiDict�CIMultiDictProxy)�URL)�ClientResponse�_RequestContextManager�_WSRequestContextManager� )� ClientSession�hdrs)�AbstractCookieJar)r )�ClientWebSocketResponse)�sentinel)�HttpVersion�RawRequestMessage)�Signal)�Application� AppRunner� BaseRunner�Request�Server�ServerRunner�SockSite�UrlMappingMatchInfo)�_RequestHandler)� SSLContext�posix�cygwin)�host�returnc C s t | d�S )Nr )�get_port_socket)r) � r, �E/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/test_utils.py�get_unused_port_socket7 s r. )r) �portr* c C s8 t � t jt j�}tr&|�t jt jd� |�| |f� |S )Nr )�socket�AF_INET�SOCK_STREAM� REUSE_ADDRESSZ setsockoptZ SOL_SOCKETZSO_REUSEADDR�bind)r) r/ �sr, r, r- r+ ; s r+ �r* c C s>