관리-도구
편집 파일: compat.cpython-37.pyc
B :��a+� � @ s� d dl mZ d dlZd dlZd dlZyd dlZW n ek rH dZY nX ejd dk �rfd dlmZ e fZ eZd dl mZ d dlZd dlZd dlmZmZmZmZmZ d dlmZmZmZmZmZm Z m!Z! dd � Zd dl"Z"d d l"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ e�rd dl"m,Z, d dl-Z-d dl.Z.d dl/Z0d dl1m1Z1 d dl2Z2e3Z3d d l4m5Z6 d dl4m7Z8 �nd dl9mZ e:fZ e:Zd dl9m;Z d dlZd dlZd dl<Z<d dl=mZmZmZmZmZmZmZm!Z! d dl>m$Z$mZm#Z#mZmZm'Z'm(Z(m)Z)m*Z*m+Z+ e�r d dl>m,Z, d dl?m&Z&m%Z%m Z d dl@mAZ- d dl>mBZ" d dlCmAZ. d dl0Z0d dlDm1Z1 d dlEmFZ2 eGZ3d dl4m8Z8 e6Z6yd dlmHZHmIZI W n8 ek �r� G dd� deJ�ZId`dd�ZKdd� ZHY nX yd dl mLZM W n& ek �r� G dd� deN�ZMY nX yd dl<mOZO W n, ek �r8 ejPejQB dfd d!�ZOY nX d d"lRmSZT eUeTd#��rXeTZSn,d d$lRmVZW G d%d&� d&eW�ZVG d'd(� d(eT�ZSyd d)lXmYZY W n ek �r� d*d+� ZYY nX d dl<Z<d dlZZZye[Z[W n* e\k �r� d d,l]m^Z^ d-d.� Z[Y nX yej_Z_ej`Z`W nH eak �rP e�b� �p&d/Zcecd0k�r8d1Zdnd2Zdd3d4� Z_d5d6� Z`Y nX yd d7lemfZf W nH ek �r� d d8lgmhZhmiZi d dlZe�jd9�Zkd:d;� Zld<d=� ZfY nX yd d>lmmnZn W n" ek �r� d d>lomnZn Y nX ejdd?� d@k �r�e1� jpZpnd dAlmmpZp yd dBlqmrZr W nd ek �r~ d dClqmsZs yd dDltmuZv W n ek �rh dadFdG�ZvY nX G dHdI� dIes�ZrY nX yd dJlwmxZx W n ek �r� dbdKdL�ZxY nX yd dMlqmyZy W n� ek �rL yd dNlzm{Z| W n" ek �r d dNl}m{Z| Y nX yd dOl~mZm�Z�m�Z� W n ek �r6 Y nX G dPdQ� dQe��ZyY nX yd dRl�m�Z�m�Z� W nv ek �r� e�jdSej��Z�dTdU� Z�G dVdW� dWe��Z�dcdXdY�Z�G dZd[� d[e��Z�G d\d]� d]e��Z�G d^d_� d_eN�Z�Y nX dS )d� )�absolute_importN� )�StringIO)�FileType)�urlparse� urlunparse�urljoin�urlsplit� urlunsplit)�urlretrieve�quote�unquote�url2pathname�pathname2url�ContentTooShortError� splittypec C s t | t�r| �d�} t| �S )Nzutf-8)� isinstance�unicode�encode�_quote)�s� r �?/opt/alt/python37/lib/python3.7/site-packages/distlib/compat.pyr s r ) �Request�urlopen�URLError� HTTPError�HTTPBasicAuthHandler�HTTPPasswordMgr�HTTPHandler�HTTPRedirectHandler�build_opener)�HTTPSHandler)� HTMLParser)�ifilter)�ifilterfalse)� TextIOWrapper)r r r r r r r r ) r r r r r r r r r r! )r r r )�filterfalse)�match_hostname�CertificateErrorc @ s e Zd ZdS )r) N)�__name__� __module__�__qualname__r r r r r) _ s r) � c C s� g }| sdS | � d�}|d |dd� }}|�d�}||krNtdt| � ��|sb| �� |�� kS |dkrv|�d� n>|�d �s�|�d �r�|�t�|�� n|�t�|�� d d�� x|D ]}|�t�|�� q�W t� dd �|� d tj�} | � |�S )zpMatching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 F�.r r- N�*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)�split�countr) �repr�lower�append� startswith�re�escape�replace�compile�join� IGNORECASE�match) Zdn�hostnameZ max_wildcardsZpats�partsZleftmost� remainderZ wildcards�frag�patr r r �_dnsname_matchc s( rB c C s� | st d��g }| �dd�}x0|D ](\}}|dkr"t||�r@dS |�|� q"W |s�xF| �dd�D ]6}x0|D ](\}}|dkrjt||�r�dS |�|� qjW q`W t|�dkr�td |d �tt|��f ��n*t|�dkr�td||d f ��ntd ��dS )a= Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDZsubjectAltNamer ZDNSNZsubjectZ commonNamer- z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rr z=no appropriate commonName or subjectAltName fields were found) � ValueError�getrB r4 �lenr) r: �mapr2 )Zcertr= ZdnsnamesZsan�key�value�subr r r r( � s. r( )�SimpleNamespacec @ s e Zd ZdZdd� ZdS )� ContainerzR A generic container for when multiple values need to be returned c K s | j �|� d S )N)�__dict__�update)�self�kwargsr r r �__init__� s zContainer.__init__N)r* r+ r, �__doc__rP r r r r rK � s rK )�whichc s" dd� }t j�� �r&|� |�r"� S dS |dkr>t j�dt j�}|sFdS |�t j�}tj dkr�t j |krt|�dt j � t j�dd��t j�}t� fd d �|D ��r�� g}q fdd�|D �}n� g}t � }xT|D ]L}t j�|�}||kr�|�|� x(|D ] } t j�|| �} || |�r�| S q�W q�W dS ) aK Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. c S s&