관리-도구
편집 파일: direct_url.cpython-39.pyc
a ����[��f�����������������������@���s<��d�Z�ddlZddlZddlZddlmZmZmZm Z m Z mZmZ�g�d�Z ed�ZdZe�d�ZG�dd ��d e�Zdeeef�e e�ee e�e e�d �dd�Zdeeef�e e�ee e�ed �d d�Zee d��dd�dd�Zeeeef�d�dd�ZG�dd��d�ZG�dd��d�ZG�dd��d�Zeeeef�ZG�dd��d�ZdS�) z PEP 610 �����N)�Any�Dict�Iterable�Optional�Type�TypeVar�Union)� DirectUrl�DirectUrlValidationError�DirInfo�ArchiveInfo�VcsInfo�Tzdirect_url.jsonz.^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$c�������������������@���s���e�Zd�ZdS�)r ���N)�__name__� __module__�__qualname__��r���r����C/usr/lib/python3.9/site-packages/pip/_internal/models/direct_url.pyr ������s���r ���)�d� expected_type�key�default�returnc�����������������C���s4���||�vr|S�|�|�}t�||�s0td�|||���|S�)z3Get value from dictionary and verify expected type.z-{!r} has unexpected type for {} (expected {}))� isinstancer ����format�r���r���r���r����valuer���r���r����_get���s���� ��r���c�����������������C���s(���t�|�|||�}|d�u�r$t|��d���|S�)Nz must have a value)r���r ���r���r���r���r���� _get_required)���s����r����InfoType)�infosr���c�����������������C���sF���dd��|�D��}�|�st�d��t|��dkr.t�d��|�d�d�us>J��|�d�S�)Nc�����������������S���s���g�|�]}|d�ur|�qS��Nr���)�.0�infor���r���r���� <listcomp>3��������z#_exactly_one_of.<locals>.<listcomp>z/missing one of archive_info, dir_info, vcs_info����z1more than one of archive_info, dir_info, vcs_infor���)r ����len)r ���r���r���r����_exactly_one_of2���s������r(���)�kwargsr���c������������������K���s���dd��|�����D��S�)z Make dict excluding None values.c�����������������S���s���i�|�]\}}|d�ur||�qS�r!���r���)r"����k�vr���r���r���� <dictcomp>B���r%���z _filter_none.<locals>.<dictcomp>)�items)r)���r���r���r����_filter_none@���s����r.���c�������������������@���sp���e�Zd�ZdZdeeee�ee�ee�dd�dd�Zeeeee f��ed��d�dd��Z eee f�d �d d�ZdS�) r ����vcs_infoN)�vcs� commit_id�requested_revision�resolved_revision�resolved_revision_typer���c�����������������C���s"���||�_�||�_||�_||�_||�_d�S�r!����r0���r2���r1���r3���r4���)�selfr0���r1���r2���r3���r4���r���r���r����__init__H���s ����zVcsInfo.__init__�r���r���c�������������� ���C���sF���|d�u�rd�S�|�t�|td�t�|td�t|td�t|td�t|td�d�S�)Nr0���r1���r2���r3���r4���)r0���r1���r2���r3���r4���)r����strr�����clsr���r���r���r���� _from_dictV���s���� �zVcsInfo._from_dict�r���c�����������������C���s���t�|�j|�j|�j|�j|�jd�S�)Nr5���)r.���r0���r2���r1���r3���r4����r6���r���r���r����_to_dictb���s�����zVcsInfo._to_dict)NNN)r���r���r����namer9���r���r7����classmethodr���r���r<���r?���r���r���r���r���r ���E���s��������"r ���c�������������������@���s`���e�Zd�ZdZdee�dd�dd�Zeeeee f��ed��d�dd��Z eee f�d �d d�ZdS�) r����archive_infoN)�hashr���c�����������������C���s ���||�_�d�S�r!����rC���)r6���rC���r���r���r���r7���o���s����zArchiveInfo.__init__r8���c�����������������C���s���|d�u�rd�S�|�t�|td�d�S�)NrC���rD���)r���r9���r:���r���r���r���r<���u���s����zArchiveInfo._from_dictr=���c�����������������C���s���t�|�jd�S�)NrD���)r.���rC���r>���r���r���r���r?���{���s����zArchiveInfo._to_dict)N)r���r���r���r@���r���r9���r7���rA���r���r���r<���r?���r���r���r���r���r���l���s������"r���c�������������������@���s\���e�Zd�ZdZd edd�dd�Zeeee e f��ed��d�dd ��Zee e f�d �dd�ZdS�)r����dir_infoFN)�editabler���c�����������������C���s ���||�_�d�S�r!����rF���)r6���rF���r���r���r���r7�������s����zDirInfo.__init__r8���c�����������������C���s"���|d�u�rd�S�|�t�|tddd�d�S�)NrF���F)r���rG���)r����boolr:���r���r���r���r<�������s����zDirInfo._from_dictr=���c�����������������C���s���t�|�jp d�d�S�)NrG���)r.���rF���r>���r���r���r���r?�������s����zDirInfo._to_dict)F) r���r���r���r@���rH���r7���rA���r���r���r9���r���r<���r?���r���r���r���r���r������s������"r���c�������������������@���s����e�Zd�Zdeeee�dd�dd�Zeed�dd�Zeed�d d ��Z dd�dd�Z eeee f�d�d �dd��Zeee f�d�dd�Zeed�d�dd��Zed�dd�Zed�dd�ZdS�)r ���N)�urlr#����subdirectoryr���c�����������������C���s���||�_�||�_||�_d�S�r!���)rI���r#���rJ���)r6���rI���r#���rJ���r���r���r���r7�������s����zDirectUrl.__init__)�netlocr���c�����������������C���sR���d|vr|S�|��dd�\}}t|�jt�r@|�jjdkr@|dkr@|S�t�|�rN|S�|S�)N�@r&����git)�splitr���r#���r ���r0���� ENV_VAR_RE�match)r6���rK���Z user_passZnetloc_no_user_passr���r���r����_remove_auth_from_netloc����s���� � �� z"DirectUrl._remove_auth_from_netlocr=���c�����������������C���s<���t�j�|�j�}|��|j�}t�j�|j||j|j |j f�}|S�)z�url with user:password part removed unless it is formed with environment variables as specified in PEP 610, or it is ``git`` in the case of a git URL. )�urllib�parse�urlsplitrI���rQ���rK���� urlunsplit�scheme�path�query�fragment)r6���ZpurlrK���Zsurlr���r���r����redacted_url����s�����zDirectUrl.redacted_urlc�����������������C���s���|���|������d�S�r!���)� from_dict�to_dictr>���r���r���r����validate����s����zDirectUrl.validater8���c�����������������C���sR���t�t|td�t|td�tt�t|td��t�t|td��t �t|td��g�d�S�)NrI���rJ���rB���rE���r/���)rI���rJ���r#���) r ���r���r9���r���r(���r���r<����dictr���r ���r:���r���r���r���r[�������s���� ���zDirectUrl.from_dictc�����������������C���s&���t�|�j|�jd�}|�j���||�jj<�|S�)N)rI���rJ���)r.���rZ���rJ���r#���r?���r@���)r6����resr���r���r���r\�������s�����zDirectUrl.to_dict)�sr���c�����������������C���s���|���t�|��S�r!���)r[����json�loads)r;���r`���r���r���r���� from_json����s����zDirectUrl.from_jsonc�����������������C���s���t�j|����dd�S�)NT)Z sort_keys)ra����dumpsr\���r>���r���r���r����to_json����s����zDirectUrl.to_jsonc�����������������C���s���t�|�jt�o|�jjS�r!���)r���r#���r���rF���r>���r���r���r����is_local_editable����s����zDirectUrl.is_local_editable)N)r���r���r���r9���r���r���r7���rQ����propertyrZ���r]���rA���r���r���r[���r\���rc���re���rH���rf���r���r���r���r���r �������s$������ r ���)N)N)�__doc__ra����re�urllib.parserR����typingr���r���r���r���r���r���r����__all__r���ZDIRECT_URL_METADATA_NAME�compilerO���� Exceptionr ���r9���r���r���r(���r.���r ���r���r���r���r ���r���r���r���r����<module>���s4���$ ������ '