관리-도구
편집 파일: download.cpython-38.pyc
U ��.eEQ � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl m Z d dlmZm Z d dlmZ d dlmZ d dlmZmZ d dlmZ d d lmZ d d lmZ d dlmZ d dlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z' d d l(m)Z) d dl*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1 d dl2m3Z3 e+�r�d dl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z: d dl;m<Z< d dl=m>Z> d dl?m@Z@ d dlAmBZB e�r�e<de6eCe7eC ge7eC f eDd�dd�ZEn8e<de6eCeCgdf e6eCe7eC ge7eC f eDeDd�dd�ZEdddd d!d"d#gZFe�GeH�ZId=d$d�ZJe�Kd%ejL�ZMd&d� ZNd'd(� ZOd)d*� ZPd+d,� ZQd-d.� ZRd>d0d �ZSd1d2� ZTd3d4� ZUd?d5d�ZVd@d6d!�ZWd7d#� ZXd8d"� ZYd9d:� ZZd;d<� Z[dS )A� )�absolute_importN)�requests)�CONTENT_CHUNK_SIZE�Response)�PY2)�parse)�HashMismatch�InstallationError)�PyPI)� PipSession)�auto_decode)�copy2_fixed) �ask_path_exists� backup_dir�consume�display_path�format_size�hide_url�path_to_display�rmtree�splitext)� TempDirectory)�MYPY_CHECK_RUNNING)�DownloadProgressProvider)�unpack_file)�get_url_scheme)�vcs)�IO�Callable�List�Optional�Text�Tuple)� TypedDict)�Link)�Hashes)�VersionControl�CopytreeKwargs��ignore�symlinksF)Ztotal)� copy_functionr) Zignore_dangling_symlinksr* �get_file_content�unpack_vcs_link�unpack_file_url�unpack_http_url� unpack_url�parse_content_disposition�sanitize_content_filenamec C s6 |dkrt d��t| �}|dkr>|�| �}|�� |j|jfS |dkr�|rd|�d�rdtd|| f ��| �dd�d }|� d d �}t �|�}|r�|�d�d |�dd�d }t �|�}|�d �r�d |�d � }|} z&t| d��}t|�� �}W 5 Q R X W n4 tk �r, } ztd t| � ��W 5 d} ~ X Y nX | |fS )a* Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. :param url: File path or url. :param comes_from: Origin description of requirements. :param session: Instance of pip.download.PipSession. NzAget_file_content() missing 1 required keyword argument: 'session')�httpZhttps�filer3 z6Requirements file %s references URL %s, which is local�:� �\�/�|�rbz$Could not open requirements file: %s)� TypeErrorr �get�raise_for_status�url�text� startswithr �split�replace�_url_slash_drive_re�match�group�urllib_parseZunquote�lstrip�openr �read�IOError�str) r>