Files
intellecton/venv/lib/python3.12/site-packages/packaging/__pycache__/utils.cpython-312.pyc
T

162 lines
11 KiB
Plaintext
Raw Normal View History

Ë
jx&ãóòddlmZddlZddlmZmZmZmZddlm Z m
Z
m Z ddl m
Z
mZmZgd¢ZddZeed eeeffZed
e«Z Gd d e«ZGd
de«ZGdde«Zej4dej6ej8z«Zej4dej8«Zej4dej8«ZddœddZ d dZ!ddœ d!dZ"ddœ d"dZ#d#dZ$y)$é)Ú 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ótS)N)Ú__all__©óúR/home/antigravity/intellecton/venv/lib/python3.12/site-packages/packaging/utils.pyÚ__dir__rsÜ €NrrrcóeZdZdZy)rzW
An invalid distribution name; users should refer to the packaging user guide.
Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrrr'óòrrcóeZdZdZy)rzM
An invalid wheel filename was found, users should refer to PEP 427.
Nr rrrrr-r%rrcóeZdZdZy)rz^
An invalid sdist filename was found, users should refer to the packaging user guide.
Nr rrrrr3r%rrz%[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óú|r#tj|«std|«|j«j dd«j dd«}d|vr|j dd«}d|vrŒt d|«S)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'
zname is invalid: Ú.z--r)Ú_validate_regexÚ fullmatchrÚlowerÚreplacer)Únamer(Úvalues rrrBs|ñ2œ×1°$ÔÐ-¨d¨XÐ
J‰J‹L× Ñ    *× 2°3¸Ó <€Eà
%‰-Ø
˜d CÓð %Š-ä Ð  %Ó (rcó0tj|«duS)a7
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_regexr.)r1s rrrgsô × &  ,°DÐ 8rT)Ústrip_trailing_zerocó¦t|t«r t|«}t|rt |««S|«S#t$rt|«cYSwxYw)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)Úversionr5s rrrwsUô<'œ3Ôð ܘ&ˆ Ñ+>Œ˜ LÀGÓ Løôò Üw“<Ò ð ús 9¹AÁA©Úvalidate_ordercóä|jd«std|«|dd}|jd«}|dvrtd|«|jd|dz
«}|d }d
|vs%t j
d |tj «td |«t|«} t|d
«}|dk(rc|d}tj |«} | €td|d|«tdt| jd
««| jd«f«}
nd}
|d} t| |¬«} |||
| fS#t$r}td|«|d}~wwxYw#t$rtd|«dwxYw)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'): Néüÿÿÿr+)ééz0Invalid wheel filename (wrong number of parts): érÚ__z ^[\w\d._]*$zInvalid project name: rz*Invalid wheel filename (invalid version): r?zInvalid build number: z in rréÿÿÿÿr:z\Invalid wheel filename (compressed tag set components must be in sorted order per PEP 425): )ÚendswithrÚcountÚsplitÚreÚmatchÚUNICODErr
r Ú_build_tag_regexrÚintÚgroupr r
)
Úfilenamer;ÚdashesÚpartsÚ name_partr1r9Ú
build_partÚ build_matchÚbuildÚtag_strÚtagss
rrrðZ × Ñ ˜VÔ AÀ(ÀÐ 
ð
𘘈}€HØ
^‰^˜
€FØ
Ü>¸x¸ 
ð
ð
N‰N˜3 ¨¡
Ó +€EØa‘€Ià ˆyÑœBŸH™H ^°YÄÇ
Á
Ó"Ð%;¸H¸<Ð#HÓ ˜ '€Dðܘ% ™(Óð ‚{ؘ1‘Xˆ
Ü,¨ZÓ8ˆ Ø Ð Ü¨ °D¸¸ Ðð
ôZ¤# k×&7Ñ&7¸Ó&:Ó";¸[×=NÑ=NÈqÓ=QÐ!RÓS‰àˆØB‰i€Gðܘ°Ôð
'˜5  'øô/ òÜ8¸¸ Ð 
àð ûðûô$ òÜ*Ø*2¨ð

ðð ðús$Â%D6Ä#
EÄ6 EÄ?EÅEÅE/cób|jd«r|dtd« }n/|jd«r|dtd« }ntd|«|jd«\}}}|std|«t |«} t |«}||fS#t $r}td|«|d}~wwxYw)a
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.