
    Xix&                       S SK Jr  S SKrS SKJrJrJrJr  SSKJ	r	J
r
Jr  SSKJrJrJr  / SQrSS jr\\S	   \\\4   4   r\" S
\5      r  " S S\5      r " S S\5      r " S S\5      r\R4                  " S\R6                  \R8                  -  5      r\R4                  " S\R8                  5      r\R4                  " S\R8                  5      rSS.SS jjr S S jr!SS.     S!S jjr"SS.     S"S jjr#S#S jr$g)$    )annotationsN)NewTypeTupleUnioncast   )TagUnsortedTagsError	parse_tag)InvalidVersionVersion_TrimmedRelease)
BuildTagInvalidNameInvalidSdistFilenameInvalidWheelFilenameNormalizedNamecanonicalize_namecanonicalize_versionis_normalized_nameparse_sdist_filenameparse_wheel_filenamec                     [         $ )N)__all__     B/var/www/html/venv/lib/python3.13/site-packages/packaging/utils.py__dir__r      s    Nr   r   r   c                      \ rS rSrSrSrg)r   '   zO
An invalid distribution name; users should refer to the packaging user guide.
r   N__name__
__module____qualname____firstlineno____doc____static_attributes__r   r   r   r   r   '       r   r   c                      \ rS rSrSrSrg)r   -   zE
An invalid wheel filename was found, users should refer to PEP 427.
r   Nr!   r   r   r   r   r   -   r(   r   r   c                      \ rS rSrSrSrg)r   3   zV
An invalid sdist filename was found, users should refer to the packaging user guide.
r   Nr!   r   r   r   r   r   3   r(   r   r   z%[a-z0-9]|[a-z0-9][a-z0-9._-]*[a-z0-9]z+[a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9]z	(\d+)(.*)F)validatec                  U(       a)  [         R                  U 5      (       d  [        SU < 35      eU R                  5       R	                  SS5      R	                  SS5      nSU;   a  UR	                  SS5      nSU;   a  M  [        SU5      $ )a  
This function takes a valid Python package or extra name, and returns the
normalized form of it.

The return type is typed as :class:`NormalizedName`. This allows type
checkers to help require that a string has passed through this function
before use.

If **validate** is true, then the function will check if **name** is a valid
distribution name before normalizing.

:param str name: The name to normalize.
:param bool validate: Check whether the name is a valid distribution name.
:raises InvalidName: If **validate** is true and the name is not an
    acceptable distribution name.

>>> from packaging.utils import canonicalize_name
>>> canonicalize_name("Django")
'django'
>>> canonicalize_name("oslo.concurrency")
'oslo-concurrency'
>>> canonicalize_name("requests")
'requests'
zname is invalid: _-.z--r   )_validate_regex	fullmatchr   lowerreplacer   )namer-   values      r   r   r   B   s    2 11$77-dX677 JJL  c*223<E
%-dC( %- %((r   c                0    [         R                  U 5      SL$ )a  
Check if a name is already normalized (i.e. :func:`canonicalize_name` would
roundtrip to the same value).

:param str name: The name to check.

>>> from packaging.utils import is_normalized_name
>>> is_normalized_name("requests")
True
>>> is_normalized_name("Django")
False
N)_normalized_regexr3   )r6   s    r   r   r   g   s     &&t,D88r   T)strip_trailing_zeroc                   [        U [        5      (       a   [        U 5      n [        U(       a  [	        U 5      5      $ U 5      $ ! [         a    [        U 5      s $ f = f)a  Return a canonical form of a version as a string.

This function takes a string representing a package version (or a
:class:`~packaging.version.Version` instance), and returns the
normalized form of it. By default, it strips trailing zeros from
the release segment.

>>> from packaging.utils import canonicalize_version
>>> canonicalize_version('1.0.1')
'1.0.1'

Per PEP 625, versions may have multiple canonical forms, differing
only by trailing zeros.

>>> canonicalize_version('1.0.0')
'1'
>>> canonicalize_version('1.0.0', strip_trailing_zero=False)
'1.0.0'

Invalid versions are returned unaltered.

>>> canonicalize_version('foo bar baz')
'foo bar baz'

>>> canonicalize_version('1.4.0.0.0')
'1.4'
)
isinstancestrr   r   r   )versionr:   s     r   r   r   w   sX    < '3	 g&G +>w'LLGLL  	 w<	 s   A AAvalidate_orderc                  U R                  S5      (       d  [        SU < 35      eU SS n U R                  S5      nUS;  a  [        SU < 35      eU R                  SUS-
  5      nUS	   nS
U;   d'  [        R
                  " SU[        R                  5      c  [        SU < 35      e[        U5      n [        US   5      nUS:X  ae  US   n[        R                  U5      n	U	c  [        SU SU < 35      e[        S[        U	R                  S5      5      U	R                  S5      45      n
OSn
US   n [        XS9nXVX4$ ! [         a  n[        SU < 35      UeSnAff = f! [         a    [        SU < 35      Sef = f)a  
This function takes the filename of a wheel file, and parses it,
returning a tuple of name, version, build number, and tags.

The name part of the tuple is normalized and typed as
:class:`NormalizedName`. The version portion is an instance of
:class:`~packaging.version.Version`. The build number is ``()`` if
there is no build number in the wheel filename, otherwise a
two-item tuple of an integer for the leading digits and
a string for the rest of the build number. The tags portion is a
frozen set of :class:`~packaging.tags.Tag` instances (as the tag
string format allows multiple tags to be combined into a single
string).

If **validate_order** is true, compressed tag set components are
checked to be in sorted order as required by PEP 425.

:param str filename: The name of the wheel file.
:param bool validate_order: Check whether compressed tag set components
    are in sorted order.
:raises InvalidWheelFilename: If the filename in question
    does not follow the :ref:`wheel specification
    <pypug:binary-distribution-format>`.

>>> from packaging.utils import parse_wheel_filename
>>> from packaging.tags import Tag
>>> from packaging.version import Version
>>> name, ver, build, tags = parse_wheel_filename("foo-1.0-py3-none-any.whl")
>>> name
'foo'
>>> ver == Version('1.0')
True
>>> tags == {Tag("py3", "none", "any")}
True
>>> not build
True

.. versionadded:: 26.1
   The *validate_order* parameter.
z.whlz3Invalid wheel filename (extension must be '.whl'): Nr0   )      z0Invalid wheel filename (wrong number of parts):    r   __z^[\w\d._]*$zInvalid project name: r   z*Invalid wheel filename (invalid version): rD   zInvalid build number: z in r   r   r?   z\Invalid wheel filename (compressed tag set components must be in sorted order per PEP 425): )endswithr   countsplitrematchUNICODEr   r   r   _build_tag_regexr   intgroupr   r
   )filenamer@   dashesparts	name_partr6   r>   e
build_partbuild_matchbuildtag_strtagss                r   r   r      s   Z V$$"A(N
 	
 }H^^C FV">xlK
 	
 NN3
+EaIyBHH^Y

KS"%;H<#HIIY'D%(# {1X
&,,Z8&(DE  Z#k&7&7&:";[=N=Nq=Q!RSBiG@ 5''/  "8E
	$  "**27
 	s$   3E 4	E# 
E EE #E>c                   U R                  S5      (       a  U S[        S5      *  nO5U R                  S5      (       a  U S[        S5      *  nO[        SU < 35      eUR                  S5      u  p#nU(       d  [        SU < 35      e[	        U5      n [        U5      nXV4$ ! [         a  n[        SU < 35      UeSnAff = f)aM  
This function takes the filename of a sdist file (as specified
in the `Source distribution format`_ documentation), and parses
it, returning a tuple of the normalized name and version as
represented by an instance of :class:`~packaging.version.Version`.

:param str filename: The name of the sdist file.
:raises InvalidSdistFilename: If the filename does not end
    with an sdist extension (``.zip`` or ``.tar.gz``), or if it does not
    contain a dash separating the name and the version of the distribution.

>>> from packaging.utils import parse_sdist_filename
>>> from packaging.version import Version
>>> name, ver = parse_sdist_filename("foo-1.0.tar.gz")
>>> name
'foo'
>>> ver == Version('1.0')
True

.. _Source distribution format: https://packaging.python.org/specifications/source-distribution-format/#source-distribution-file-name
z.tar.gzNz.zipz@Invalid sdist filename (extension must be '.tar.gz' or '.zip'): r0   zInvalid sdist filename: z*Invalid sdist filename (invalid version): )rH   lenr   
rpartitionr   r   r   )rQ   	file_stemrT   sepversion_partr6   r>   rU   s           r   r   r      s    , ##.I/				6	"	"^F|,	"|
 	
 $-#7#7#< IL"%=h\#JKKY'D,' ?  "8E
	s   B   
B?*B::B?)returnz	list[str])r6   r=   r-   boolra   r   )r6   r=   ra   rb   )r>   zVersion | strr:   rb   ra   r=   )rQ   r=   r@   rb   ra   z8tuple[NormalizedName, Version, BuildTag, frozenset[Tag]])rQ   r=   ra   ztuple[NormalizedName, Version])%
__future__r   rK   typingr   r   r   r   rZ   r	   r
   r   r>   r   r   r   r   r   rO   r=   r   r   
ValueErrorr   r   r   compile
IGNORECASEASCIIr2   r9   rN   r   r   r   r   r   r   r   r   <module>ri      s5  
 # 	 . . 3 3 = = rE#s(O+,)3/
* : :  **,bmmbhh.F JJMrxxX ::lBHH5  6; ")J9" <@#M#M48#M#MR !Y(Y( Y( >	Y(x/r   