Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/pip/_vendor/urllib3/__pycache__/connectionpool.cpython-37.pyc
Назад
B �5�g6� � @ s d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dlm Z ddlm Z mZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z" ddl#m$Z$ dd l%m&Z& dd l'm(Z( ddl)m*Z* ddl+m,Z, dd l-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z<m=Z= ddl;m>Z? ddl;m@Z@mAZA yd dlBZBeBjCZDW n" eEk �r� ddlFmDZD Y nX e$jGjHZHe�IeJ�ZKeL� ZMG dd� deL�ZNejOejPhZQG dd� deNe(�ZRG dd� deR�ZSdd� ZTd d!� Z>d"d#� ZUdS )$� )�absolute_importN)�error)�timeout� )�BaseSSLError�BrokenPipeError�DummyConnection�HTTPConnection� HTTPException�HTTPSConnection�VerifiedHTTPSConnection�port_by_scheme) �ClosedPoolError�EmptyPoolError�HeaderParsingError�HostChangedError�InsecureRequestWarning�LocationValueError� MaxRetryError�NewConnectionError� ProtocolError� ProxyError�ReadTimeoutError�SSLError�TimeoutError)�six)�queue)�RequestMethods)�HTTPResponse)�is_connection_dropped)�connection_requires_http_tunnel)� LifoQueue)�set_file_position)�assert_header_parsing)�Retry)�CertificateError)�Timeout)�Url�_encode_target)�_normalize_host)�get_host� parse_url)�weakref_finalizec @ sB e Zd ZdZdZeZd dd�Zdd� Zdd� Z d d � Z dd� ZdS )�ConnectionPoola; Base class for all connection pools, such as :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. .. note:: ConnectionPool.urlopen() does not normalize or percent-encode target URIs which is useful if your target server doesn't support percent-encoded target URIs. Nc C s0 |st d��t|| jd�| _|�� | _|| _d S )NzNo host specified.)�scheme)r r) r. �host�lower�_proxy_host�port)�selfr/ r2 � r4 �C/tmp/pip-install-251nq386/pip/pip/_vendor/urllib3/connectionpool.py�__init__R s zConnectionPool.__init__c C s dt | �j| j| jf S )Nz%s(host=%r, port=%r))�type�__name__r/ r2 )r3 r4 r4 r5 �__str__Z s zConnectionPool.__str__c C s | S )Nr4 )r3 r4 r4 r5 � __enter__] s zConnectionPool.__enter__c C s | � � dS )NF)�close)r3 �exc_type�exc_val�exc_tbr4 r4 r5 �__exit__` s zConnectionPool.__exit__c C s dS )zD Close all pooled connections and disable the pool. Nr4 )r3 r4 r4 r5 r; e s zConnectionPool.close)N)r8 � __module__�__qualname__�__doc__r. r! �QueueClsr6 r9 r: r? r; r4 r4 r4 r5 r- D s r- c @ s� e Zd ZdZdZeZeZdde j dddddddf dd�Zdd � Zd!d d�Z dd � Zdd� Zdd� Zdd� Zdd� Zedfdd�Zdd� Zdd� Zdd� Zdddddeddddf dd �ZdS )"�HTTPConnectionPoola: Thread-safe connection pool for one host. :param host: Host used for this HTTP Connection (e.g. "localhost"), passed into :class:`http.client.HTTPConnection`. :param port: Port used for this HTTP Connection (None is equivalent to 80), passed into :class:`http.client.HTTPConnection`. :param strict: Causes BadStatusLine to be raised if the status line can't be parsed as a valid HTTP/1.0 or 1.1 status line, passed into :class:`http.client.HTTPConnection`. .. note:: Only works in Python 2. This parameter is ignored in Python 3. :param timeout: Socket timeout in seconds for each individual connection. This can be a float or integer, which sets the timeout for the HTTP request, or an instance of :class:`urllib3.util.Timeout` which gives you more fine-grained control over request timeouts. After the constructor has been parsed, this is always a `urllib3.util.Timeout` object. :param maxsize: Number of connections to save that can be reused. More than 1 is useful in multithreaded situations. If ``block`` is set to False, more connections will be created but they will not be saved once they've been used. :param block: If set to True, no more than ``maxsize`` connections will be used at a time. When no free connections are available, the call will block until a connection has been released. This is a useful side effect for particular multithreaded situations where one does not want to use more than maxsize connections per host to prevent flooding. :param headers: Headers to include with all requests, unless other headers are given explicitly. :param retries: Retry configuration to use by default with requests in this pool. :param _proxy: Parsed proxy URL, should not be used directly, instead, see :class:`urllib3.ProxyManager` :param _proxy_headers: A dictionary with proxy headers, should not be used directly, instead, see :class:`urllib3.ProxyManager` :param \**conn_kw: Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`, :class:`urllib3.connection.HTTPSConnection` instances. �httpNFr c K s� t �| ||� t�| |� || _t|t�s4t�|�}|d krBtj}|| _ || _ | �|�| _|| _ | | _| pli | _|| _xt|�D ]} | j�d � q�W d| _d| _|| _| jr�| j�dg � | j| jd<