R`i d Z ddlZddlZddlZddlmZmZmZm Z m Z mZmZ g dZ ed ZdZ ej d Z G d d e Z dd eeef de e ded e e de e f dZ dd eeef de e ded e e def dZdee d ddfdZdedeeef fdZ G d d Z G d d Z G d d Zeeeef Z G d d Zy)z PEP 610 N)AnyDictIterableOptionalTypeTypeVarUnion) DirectUrlDirectUrlValidationErrorDirInfoArchiveInfoVcsInfoTzdirect_url.jsonz.^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$c e Zd Zy)r N)__name__ __module____qualname__ /builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_internal/models/direct_url.pyr r s r r d expected_typekeydefaultreturnc l || vr|S | | }t || st dj ||| |S )z3Get value from dictionary and verify expected type.z-{!r} has unexpected type for {} (expected {})) isinstancer formatr r r r values r _getr! sL !| cFEe]+&;BBsM Lr c B t | ||| }|t | d |S )Nz must have a value)r! r r s r _get_requiredr# ) s1 M30E}.@'ABBLr infosInfoTypec | D cg c] }|| } }| st d t | dkD rt d | d J | d S c c}w )Nz/missing one of archive_info, dir_info, vcs_info z1more than one of archive_info, dir_info, vcs_infor )r len)r$ infos r _exactly_one_ofr* 2 sk #8edt'7TeE8&= 5zA~&? 88O 9s AAkwargsc \ | j D ci c] \ }}| || c}}S c c}}w )z Make dict excluding None values.)items)r+ kvs r _filter_noner0 @ s, #\\^=^TQq}AqD^===s ((c x e Zd ZdZ ddededee ddfdZedeeee f ded fd Z deee f fd Zy)r vcs_infoNvcs commit_idrequested_revisionr c . || _ || _ || _ y Nr3 r5 r4 )selfr3 r4 r5 s r __init__zVcsInfo.__init__H s "4"r r c x |y | t |t d t |t d t |t d S )Nr3 r4 r5 )r3 r4 r5 )r# strr! clsr s r _from_dictzVcsInfo._from_dictR s<