U cf@s.ddlmZddlZddlmZmZmZmZddlm Z m Z ddl m Z m Z eedeeeffZedeZGd d d eZGd d d eZGd ddeZedejZedZedZedZddddddddZdddddZdddddd d!d"Zdd#d$d%d&Zdd'd$d(d)Z dS)*) annotationsN)NewTypeTupleUnioncast)Tag parse_tag)InvalidVersionVersionNormalizedNamec@seZdZdZdS) InvalidNamezW An invalid distribution name; users should refer to the packaging user guide. N__name__ __module__ __qualname____doc__r r r I/opt/hc_python/lib/python3.8/site-packages/pip/_vendor/packaging/utils.pyrsrc@seZdZdZdS)InvalidWheelFilenamezM An invalid wheel filename was found, users should refer to PEP 427. Nrr r r rrsrc@seZdZdZdS)InvalidSdistFilenamez^ An invalid sdist filename was found, users should refer to the packaging user guide. Nrr r r rrsrz)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$z[-_.]+z/^([a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9])$z (\d+)(.*)F)validatestrbool)namerreturncCs6|rt|std|td|}tt|S)Nzname is invalid: -)_validate_regexmatchr_canonicalize_regexsublowerrr )rrvaluer r rcanonicalize_name-sr#)rrcCst|dk SN)_normalized_regexr)rr r ris_normalized_name5sr&T)strip_trailing_zeroz Version | str)versionr'rcCst|tr2z t|}Wq6tk r.|YSXn|}g}|jdkrV||jdddd|jD}|r~t dd|}|||j dk r|dd d|j D|j dk r|d |j |j dk r|d |j |j dk r|d |j d|S) z This is very similar to Version.__str__, but has one subtle difference with the way it handles the release segment. r!.css|]}t|VqdSr$r.0xr r r Psz'canonicalize_version..z(\.0)+$Ncss|]}t|VqdSr$r+r,r r rr/Xsz.postz.dev+) isinstancerr r epochappendjoinreleaserer prepostdevlocal)r(r'parsedpartsZrelease_segmentr r rcanonicalize_version9s,         r>z8tuple[NormalizedName, Version, BuildTag, frozenset[Tag]])filenamerc CsJ|dstd||dd}|d}|dkrDtd||d|d}|d}d |ksxtd |tjdkrtd |t|}zt|d }Wn2t k r}ztd ||W5d}~XYnX|dkr.|d}t |}|dkrtd|d|dt t t |d |df} nd} t|d} ||| | fS)Nz.whlz3Invalid wheel filename (extension must be '.whl'): r)z0Invalid wheel filename (wrong number of parts): r__z ^[\w\d._]*$zInvalid project name: rz*Invalid wheel filename (invalid version): rBzInvalid build number: z in ''r )endswithrcountsplitr7rUNICODEr#r r _build_tag_regexrBuildTagintgroupr ) r?dashesr= name_partrr(e build_part build_matchbuildtagsr r rparse_wheel_filenameisD        rVztuple[NormalizedName, Version]c Cs|dr|dtd }n,|dr<|dtd }ntd||d\}}}|sltd|t|}z t|}Wn2tk r}ztd||W5d}~XYnX||fS)Nz.tar.gzz.zipz@Invalid sdist filename (extension must be '.tar.gz' or '.zip'): rzInvalid sdist filename: z*Invalid sdist filename (invalid version): )rGlenr rpartitionr#r r )r? file_stemrPsep version_partrr(rQr r rparse_sdist_filenames(   r\)! __future__rr7typingrrrrrUrr r(r r rMrrLr ValueErrorrrrcompile IGNORECASErrr%rKr#r&r>rVr\r r r rs,     0+