관리-도구
편집 파일: utils.cpython-38.pyc
U ��.eau � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlZddlmZ ddl mZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z" dd l#m$Z$ dd l%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+ dZ,e�-� Z.d dd�Z/ej0dk�r2dd� Z1dd� Zdd� Z2dd� Z3dhdd�Z4dd� Z5dd� Z6d d!� Z7d"d#� Z8d$d%� Z9d&d'� Z:did(d)�Z;d*d+� Z<d,d-� Z=d.d/� Z>d0d1� Z?d2d3� Z@d4d5� ZAd6d7� ZBd8d9� ZCeDd:�ZEd;d<� ZFd=d>� ZGd?d@� ZHdAdB� ZIdCdD� ZJdEdF� ZKejLdGdH� �ZMdIdJ� ZNdjdKdL�ZOdMdN� ZPdkdPdQ�ZQdRdS� ZRdTdU� ZSdV�TdW�ZUeUdX ZVeUdY ZWdZd[� ZXd\d]� ZYd^d_� ZZe�[d`�Z\e�[da�Z]dbdc� Z^ddde� Z_dfdg� Z`dS )lz� requests.utils ~~~~~~~~~~~~~~ This module provides utility functions that are used within Requests that are also useful for external consumption. � N� ��__version__)�certs)�to_native_string)�parse_http_list)�quote�urlparse�bytes�str�OrderedDict�unquote� getproxies�proxy_bypass� urlunparse� basestring� integer_types�is_py3�proxy_bypass_environment�getproxies_environment�Mapping��cookiejar_from_dict)�CaseInsensitiveDict)� InvalidURL� InvalidHeader�FileModeWarning�UnrewindableBodyError)z.netrc�_netrc�P i� )ZhttpZhttpsZwin32c C s� zt rdd l}ndd l}W n tk r0 Y dS X z6|�|jd�}t|�|d�d �}|�|d�d }W n tk r~ Y dS X |r�|s�dS |� d�}|D ]T}|dkr�d| kr� d S |� dd �}|� dd�}|� d d�}t�|| tj �r� d S q�dS )Nr Fz;Software\Microsoft\Windows\CurrentVersion\Internet SettingsZProxyEnableZ ProxyOverride�;z<local>�.Tz\.�*z.*�?)r �winreg�_winreg�ImportError�OpenKey�HKEY_CURRENT_USER�intZQueryValueEx�OSError�split�replace�re�match�I)�hostr$ ZinternetSettingsZproxyEnableZ proxyOverrideZtest� r1 �>/usr/lib/python3.8/site-packages/pip/_vendor/requests/utils.py�proxy_bypass_registry/ sF ����� r3 c C s t � rt| �S t| �S dS )z�Return True, if the host should be bypassed. Checks proxy settings gathered from the environment, if specified, or the registry. N)r r r3 )r0 r1 r1 r2 r V s r c C s t | d�r| �� } | S )z/Returns an internal sequence dictionary update.�items)�hasattrr4 )�dr1 r1 r2 �dict_to_sequenceb s r7 c C s4 d }d}t | d�rt| �}nbt | d�r.| j}nPt | d�r~z| �� }W n tjk rZ Y n$X t�|�j}d| jkr~t � dt� t | d��rz| �� }W n$ t tfk r� |d k r�|}Y n^X t | d��r|d k�rz&| �dd � | �� }| �|p�d� W n t tfk �r d}Y nX |d k�r&d}td|| �S ) Nr �__len__�len�fileno�ba% Requests has determined the content-length for this request using the binary size of the file: however, the file has been opened in text mode (i.e. without the 'b' flag in the mode). This may lead to an incorrect content-length. In Requests 3.0, support will be removed for files in text mode.�tell�seek� )r5 r9 r: �io�UnsupportedOperation�os�fstat�st_size�mode�warnings�warnr r<