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

162 lines
11 KiB
Text
Raw Normal View History

<EFBFBD>
K<>jx&<00><01><><00>ddlmZddlZddlmZmZmZmZddlm Z m
Z
m Z ddl m Z mZmZgd<07>Zdd<08>Zeed eeeffZed
e<13>Z Gd <0B>d e<16>ZGd <0A>de<16>ZGd<0F>de<16>Zej4dej6ej8z<00>Zej4dej8<00>Zej4dej8<00>Zdd<15>dd<16>Z d d<17>Z!dd<19> d!d<1A>Z"dd<1B> d"d<1C>Z#d#d<1D>Z$y)$<24>)<01> annotationsN)<04>NewType<70>Tuple<6C>Union<6F>cast<73>)<03>Tag<61>UnsortedTagsError<6F> parse_tag)<03>InvalidVersion<6F>Version<6F>_TrimmedRelease)
<EFBFBD>BuildTag<61> InvalidName<6D>InvalidSdistFilename<6D>InvalidWheelFilename<6D>NormalizedName<6D>canonicalize_name<6D>canonicalize_version<6F>is_normalized_name<6D>parse_sdist_filename<6D>parse_wheel_filenamec<01><00>tS)N)<01>__all__<5F><00><00>R/home/antigravity/intellecton/venv/lib/python3.12/site-packages/packaging/utils.py<70>__dir__rs<00><00> <12>Nrrrc<01><00>eZdZdZy)rzW
An invalid distribution name; users should refer to the packaging user guide.
N<><04>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rrrrr'<00><00><00>rrc<01><00>eZdZdZy)rzM
An invalid wheel filename was found, users should refer to PEP 427.
Nr rrrrr-r%rrc<01><00>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)<01>validatec<01><><00>|r#tj|<00>std|<00><02><02><00>|j<00>j dd<03>j dd<03>}d|vr|j dd<03>}d|vr<01>t d|<02>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: <20>_<>-<2D>.z--r)<06>_validate_regex<65> fullmatchr<00>lower<65>replacer)<03>namer(<00>values rrrBs|<00><00>2<10><0F>1<>1<>$<24>7<><19>-<2D>d<EFBFBD>X<EFBFBD>6<>7<>7<> <11>J<EFBFBD>J<EFBFBD>L<EFBFBD> <20> <20><13>c<EFBFBD> *<2A> 2<> 2<>3<EFBFBD><03> <<3C>E<EFBFBD>
<0E>%<25>-<2D><15> <0A> <0A>d<EFBFBD>C<EFBFBD>(<28><05> <0F>%<25>-<2D> <0F> <20>%<25> (<28>(rc<01>0<00>tj|<00>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)<02>_normalized_regexr.)r1s rrrgs<00><00> <1D> &<26> &<26>t<EFBFBD> ,<2C>D<EFBFBD> 8<>8rT)<01>strip_trailing_zeroc<01><><00>t|t<00>r t|<00>}t|rt |<00><00>S|<00>S#t$rt|<00>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'
)<05>
isinstance<EFBFBD>strr r r)<02>versionr5s rrrwsU<00><00><<12>'<27>3<EFBFBD><1F> <20><1D>g<EFBFBD>&<26>G<EFBFBD> <0F>+><3E><EFBFBD>w<EFBFBD>'<27> L<>L<>G<EFBFBD> L<>L<><4C><1E> <20><16>w<EFBFBD><<3C> <1F> <20>s<00> 9<00>A<03>A<03><01>validate_orderc<01><><00>|jd<01>std|<00><02><02><00>|dd}|jd<05>}|dvrtd|<00><02><02><00>|jd|dz
<00>}|d }d
|vs%t j
d |tj <00><00>td |<00><02><02><00>t|<04>} t|d <00>}|dk(rc|d}tj |<08>} | <09>td|<08>d|<00><02><04><00>tdt| jd <0A><00>| jd<08>f<02>}
nd}
|d} t| |<01><15>} |||
| fS#t$r}td|<00><02><02>|<07>d}~wwxYw#t$rtd|<00><02><02>d<03>wxYw)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<><4E><EFBFBD><EFBFBD><EFBFBD>r+)<02><00>z0Invalid wheel filename (wrong number of parts): <20>r<00>__z ^[\w\d._]*$zInvalid project name: rz*Invalid wheel filename (invalid version): r?zInvalid build number: z in rr<00><><EFBFBD><EFBFBD><EFBFBD>r:z\Invalid wheel filename (compressed tag set components must be in sorted order per PEP 425): )<10>endswithr<00>count<6E>split<69>re<72>match<63>UNICODErr r <00>_build_tag_regexr<00>int<6E>groupr r
) <0A>filenamer;<00>dashes<65>parts<74> name_partr1r9<00>e<>
build_part<EFBFBD> build_match<63>build<6C>tag_str<74>tagss rrr<00>s<><00><00>Z <14> <1C> <1C>V<EFBFBD> $<24>"<22>A<>(<28><1C> N<>
<EFBFBD>
<EFBFBD><18><03><12>}<7D>H<EFBFBD> <15>^<5E>^<5E>C<EFBFBD> <20>F<EFBFBD> <0A>V<EFBFBD><1B>"<22>><3E>x<EFBFBD>l<EFBFBD> K<>
<EFBFBD>
<EFBFBD> <15>N<EFBFBD>N<EFBFBD>3<EFBFBD><06><11>
<EFBFBD> +<2B>E<EFBFBD><15>a<EFBFBD><08>I<EFBFBD> <0B>y<EFBFBD><18>B<EFBFBD>H<EFBFBD>H<EFBFBD>^<5E>Y<EFBFBD><02>
<EFBFBD>
<EFBFBD>K<>S<>"<22>%;<3B>H<EFBFBD><<3C>#H<>I<>I<> <1C>Y<EFBFBD> '<27>D<EFBFBD><11><19>%<25><01>(<28>#<23><07> <0E><11>{<7B><1A>1<EFBFBD>X<EFBFBD>
<EFBFBD>&<26>,<2C>,<2C>Z<EFBFBD>8<> <0B> <16> <1E>&<26>(<28><1A> <0C>D<EFBFBD><18> <0C>E<><0E> <0E><15>Z<EFBFBD>#<23>k<EFBFBD>&7<>&7<><01>&:<3A>";<3B>[<5B>=N<>=N<>q<EFBFBD>=Q<>!R<>S<><05><12><05><13>B<EFBFBD>i<EFBFBD>G<EFBFBD><14><18><17><1E>@<40><04> <11>'<27>5<EFBFBD>$<24> '<27>'<27><>/ <1A><11>"<22>8<><18> <0C> E<>
<EFBFBD><10> <11><><11><>$ <1D><14>"<22>*<2A>*2<><1C> 7<>
<EFBFBD><14> <14><14>s$<00>%D6<00># E<00>6 E<03>?E<03>E<03>E/c<01>b<00>|jd<01>r|dtd<01> }n/|jd<03>r|dtd<03> }ntd|<00><02><02><00>|jd<05>\}}}|std|<00><02><02><00>t |<02>} t |<04>}||fS#t $r}td|<00><02><02>|<07>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.
>>> 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'): r+zInvalid sdist filename: z*Invalid sdist filename (invalid version): )rC<00>lenr<00>
rpartitionrr r )rL<00> file_stemrO<00>sep<65> version_partr1r9rPs rrr<00>s<><00><00>,<10><18><18><19>#<23><1C>.<2E><03>I<EFBFBD><0E><EFBFBD>/<2F> <09> <11> <1A> <1A>6<EFBFBD> "<22><1C>^<5E><03>F<EFBFBD> <0B>|<7C>,<2C> <09>"<22><10><18>|<7C> <1D>
<EFBFBD>
<EFBFBD>$-<2D>#7<>#7<><03>#<<3C> <20>I<EFBFBD>s<EFBFBD>L<EFBFBD> <0E>"<22>%=<3D>h<EFBFBD>\<5C>#J<>K<>K<> <1C>Y<EFBFBD> '<27>D<EFBFBD><11><19>,<2C>'<27><07> <11>'<27>?<3F><1A><> <1A><11>"<22>8<><18> <0C> E<>
<EFBFBD><10> <11><><11>s<00> B<00> B.<03>B)<03>)B.)<02>returnz list[str])r1r8r(<00>boolr\r)r1r8r\r])r9z Version | strr5r]r\r8)rLr8r;r]r\z8tuple[NormalizedName, Version, BuildTag, frozenset[Tag]])rLr8r\ztuple[NormalizedName, Version])%<25>
__future__rrF<00>typingrrrrrUr r
r r9r r rrrrJr8rr<00>
ValueErrorrrr<00>compile<6C>
IGNORECASE<EFBFBD>ASCIIr-r4rIrrrrrrrr<00><module>rds;<00><01>
#<23> <09>.<2E>.<2E>3<>3<>=<3D>=<3D> <02><07><13> <11><15>r<EFBFBD><19>E<EFBFBD>#<23>s<EFBFBD>(<28>O<EFBFBD>+<2B> ,<2C><08><18>)<29>3<EFBFBD>/<2F><0E><04>
<08>*<2A><08> <08>:<3A><08> <08>:<3A><08><1D>"<22>*<2A>*<2A>,<2C>b<EFBFBD>m<EFBFBD>m<EFBFBD>b<EFBFBD>h<EFBFBD>h<EFBFBD>.F<><02><0F><1F>B<EFBFBD>J<EFBFBD>J<EFBFBD>M<>r<EFBFBD>x<EFBFBD>x<EFBFBD>X<><11><1D>2<EFBFBD>:<3A>:<3A>l<EFBFBD>B<EFBFBD>H<EFBFBD>H<EFBFBD>5<><10>6;<3B>")<29>J 9<>"<@<01>#M<01> <1A>#M<01>48<34>#M<01><08>#M<01>R!<21>Y(<28><11>Y(<28><19>Y(<28>><3E> Y(<28>x/r