
    hy?                     T   S r SSKJrJr  SSKrSSKrSSKrSSKJrJ	r	J
r
JrJrJrJr  SSKJr  \(       a  SSKrSSKJr  SSKJr  S r " S	 S
\5      r\" 5       r " S S\5      r " S S\5      rS rS rS r S r!S r"S r#\" SS9 " S S5      5       r$S r%S r&SSK'J(r(  S r)/ SQr*g)z0
Versions for Python packages.

See L{Version}.
    )divisionabsolute_importN)TYPE_CHECKINGAnyTypeVarUnionOptionalDictBinaryIO)	dataclass)Literal)Distributionc                     X:  a  gX:X  a  gg)zy
Compare two objects.

Returns a negative number if C{a < b}, zero if they are equal, and a
positive number if C{a > b}.
r       )abs     [/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/incremental/__init__.py_cmpr      s     	u	
    c                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
_Inf2   z2
An object that is bigger than all other objects.
c                     U[         L a  gg)zi
@param other: Another object.
@type other: any

@return: 0 if other is inf, 1 otherwise.
@rtype: C{int}
r   r   )_infselfothers     r   __cmp___Inf.__cmp__7   s     D=r   c                 *    U R                  U5      S:  $ Nr   r    r   s     r   __lt___Inf.__lt__C       ||E"Q&&r   c                 *    U R                  U5      S:*  $ r#   r$   r   s     r   __le___Inf.__le__F       ||E"a''r   c                 *    U R                  U5      S:  $ r#   r$   r   s     r   __gt___Inf.__gt__I   r'   r   c                 *    U R                  U5      S:  $ r#   r$   r   s     r   __ge___Inf.__ge__L   r+   r   r   N)__name__
__module____qualname____firstlineno____doc__r    r%   r)   r-   r0   __static_attributes__r   r   r   r   r   2   s     
'('(r   r   c                       \ rS rSrSrSrg)IncomparableVersionsS   z%
Two versions could not be compared.
r   N)r2   r3   r4   r5   r6   r7   r   r   r   r9   r9   S   s    r   r9   c                       \ rS rSrSr    SS jr\S 5       rS r\r	\r
\rS rS rS	 rS
 rS rS rS rS rS rSrg)VersionY   z
An encapsulation of a version for a project, with support for outputting
PEP-440 compatible version strings.

This class supports the standard major.minor.micro[rcN] scheme of
versioning.
Nc	                 F   U(       a  U(       a  [        S5      eU(       a#  U(       d  Un[        R                  " S[        SS9  US:X  a.  U(       d  U(       d  U(       d  U(       d  U(       a  [        S5      eXl        X l        X0l        X@l        XPl        Xpl	        Xl
        g)aJ  
@param package: Name of the package that this is a version of.
@type package: C{str}
@param major: The major version number.
@type major: C{int} or C{str} (for the "NEXT" symbol)
@param minor: The minor version number.
@type minor: C{int}
@param micro: The micro version number.
@type micro: C{int}
@param release_candidate: The release candidate number.
@type release_candidate: C{int}
@param prerelease: The prerelease number. (Deprecated)
@type prerelease: C{int}
@param post: The postrelease number.
@type post: C{int}
@param dev: The development release number.
@type dev: C{int}
z Please only return one of these.zvPassing prerelease to incremental.Version was deprecated in Incremental 16.9.0. Please pass release_candidate instead.   
stacklevelNEXTz;When using NEXT, all other values except Package must be 0.N)
ValueErrorwarningswarnDeprecationWarningpackagemajorminormicrorelease_candidatepostdev)	r   rG   rH   rI   rJ   rK   
prereleaserL   rM   s	            r   __init__Version.__init__b   s    : ?@@ 1 *MM- # F?!2dc Q  


!2	r   c                 N    [         R                  " S[        SS9  U R                  $ )NzuAccessing incremental.Version.prerelease was deprecated in Incremental 16.9.0. Use Version.release_candidate instead.r?   r@   )rD   rE   rF   rK   r   s    r   rN   Version.prerelease   s)    1 	
 %%%r   c                 J   U R                   S:X  a  U R                   $ U R                  c  SnOSU R                  < 3nU R                  c  SnOSU R                  < 3nU R                  c  SnOSU R                  < 3nSU R                   U R                  U R
                  XU4-  $ )z
Return a PEP440-compatible "public" representation of this L{Version}.

Examples:

  - 14.4.0
  - 1.2.3rc1
  - 14.2.1rc1dev9
  - 16.04.0dev0
rB    rcz.postz.devz%r.%d.%d%s%s%s)rH   rK   rL   rM   rI   rJ   )r   rV   rL   rM   s       r   publicVersion.public   s     ::::!!)B *  113B99D  !%		+D88C  #hh(C4::tzz4::rQT"UUUr   c           	      T   U R                   c  SnOSU R                   < 3nU R                  c  SnOSU R                  < 3nU R                  c  SnOSU R                  < 3nSU R                  R                  U R
                  U R                  U R                  U R                  UUU4-  $ )NrU   z, release_candidate=z, post=z, dev=z%s(%r, %r, %d, %d%s%s%s))	rK   rL   rM   	__class__r2   rG   rH   rI   rJ   )r   rK   rL   rM   s       r   __repr__Version.__repr__   s    !!) " * =A<R<R T99D  #'))-D88C  !%*C)NN##LLJJJJJJ	-
 	
 		
r   c                 H    SU R                   < SU R                  5       < S3$ )N[z
, version ]rG   shortrR   s    r   __str__Version.__str__   s    %)\\4::<@@r   c           	      r   [        XR                  5      (       d  [        $ U R                  R	                  5       UR                  R	                  5       :w  a&  [        U R                  < SUR                  < 35      eU R                  S:X  a  [        nOU R                  nU R                  c  [        nOU R                  nU R                  c  SnOU R                  nU R                  c  [        nOU R                  nUR                  S:X  a  [        nOUR                  nUR                  c  [        nOUR                  nUR                  c  SnOUR                  nUR                  c  [        n	OUR                  n	[        X R                  U R                  X4U4XaR                  UR                  XxU	45      n
U
$ )a  
Compare two versions, considering major versions, minor versions, micro
versions, then release candidates, then postreleases, then dev
releases. Package names are case insensitive.

A version with a release candidate is always less than a version
without a release candidate. If both versions have release candidates,
they will be included in the comparison.

Likewise, a version with a dev release is always less than a version
without a dev release. If both versions have dev releases, they will
be included in the comparison.

@param other: Another version.
@type other: L{Version}

@return: NotImplemented when the other object is not a Version, or one
    of -1, 0, or 1.

@raise IncomparableVersions: when the package names of the versions
    differ.
z != rB   r   )
isinstancerZ   NotImplementedrG   lowerr9   rH   r   rK   rL   rM   r   rI   rJ   )r   r   rH   rK   rL   rM   
othermajorotherrc	otherpostotherdevxs              r   r    Version.__cmp__   s[   . %00!!<<5==#6#6#88&T\\5=='QRR::EJJE!!) $ $ 6 699D99D88C((C;;& JJ""*G--G::I

I99HyyHJJ

,=SIekk7xP
 r   c                 D    U R                  U5      nU[        L a  U$ US:H  $ r#   r    rf   r   r   cs      r   __eq__Version.__eq__/  &    LLHAvr   c                 D    U R                  U5      nU[        L a  U$ US:g  $ r#   ro   rp   s      r   __ne__Version.__ne__5  rt   r   c                 D    U R                  U5      nU[        L a  U$ US:  $ r#   ro   rp   s      r   r%   Version.__lt__;  &    LLH1ur   c                 D    U R                  U5      nU[        L a  U$ US:*  $ r#   ro   rp   s      r   r)   Version.__le__A  rt   r   c                 D    U R                  U5      nU[        L a  U$ US:  $ r#   ro   rp   s      r   r-   Version.__gt__G  rz   r   c                 D    U R                  U5      nU[        L a  U$ US:  $ r#   ro   rp   s      r   r0   Version.__ge__M  rt   r   )rM   rH   rJ   rI   rG   rL   rK   )NNNN)r2   r3   r4   r5   r6   rO   propertyrN   rW   basera   localr[   rb   r    rr   rv   r%   r)   r-   r0   r7   r   r   r   r<   r<   Y   sv     5n & &V> DEE
6AHTr   r<   c                 H    U R                   < SU R                  5       < 3nU$ )z
Get a friendly string for the given version object.

@param version: A L{Version} object.
@return: A string containing the package and short version number.
 r`   )versionresults     r   getVersionStringr   T  s      9FMr   c                    [         R                  R                  U SUR                  5       5      n[         R                  R                  XR                  5       5      n[         R                  R	                  U5      (       a  U$ [         R                  R	                  U5      (       a  U$ [        SR                  XU5      5      e)z
Determine the package root directory.

The result is one of:

    - src/{package}
    - {package}

Where {package} is downcased.
srcz=Can't find the directory of project {}: I looked in {} and {})ospathjoinrg   isdirrC   format)r   rG   src_dircurrent_dirs       r   	_findPathr   _  s     ggll48G'',,t]]_5K	ww}}W	{	#	#KRR+
 	
r   c                     0 n[        U S5       n[        UR                  5       U5        SSS5        US   $ ! , (       d  f       US   $ = f)z7
Load the current version from a ``_version.py`` file.
rN__version__)openexecread)version_pathversion_infofs      r   _existing_versionr   y  sM     L	lC	 AQVVX|$ 
! && 
!	  &&s	   7
A	c                      [        S5      nUR                  (       d  g [        UR                  5      nUR                  5       U R                  l        g! [         a     gf = f! [
         a     gf = f)af  
Setuptools integration: load the version from the working directory

This function is registered as a setuptools.finalize_distribution_options
entry point [1]. Consequently, it is called in all sorts of weird
contexts. In setuptools, silent failure is the law.

[1]: https://setuptools.pypa.io/en/latest/userguide/extension.html#customizing-distribution-options

@param dist:
    A (possibly) empty C{setuptools.Distribution} instance to mutate.
    There may be some metadata here if a `setup.py` called `setup()`,
    but this hook is always called before setuptools loads anything
    from ``pyproject.toml``.
z./pyproject.tomlN)	_load_pyproject_toml	Exceptionopt_inr   r   FileNotFoundErrorrW   metadatar   )distconfigr   s      r   _get_setuptools_versionr     sq      &&89 ==#F$7$78 $NN,DMM    s"   A A% 
A"!A"%
A21A2c                    U(       d  gSSK Jn  UR                  U 5      nUR                  5         UR                  5        Hv  nUS   S:X  d  M  [        R
                  R                  [        R
                  R                  US   5      S5      n[        U5      R                  5       U R                  l          g   [        S5      e)	z
Distutils integration: get the version from the package listed in the Distribution.

This function is invoked when a C{setup.py} calls C{setup(use_incremental=True)}.

@see: https://setuptools.pypa.io/en/latest/userguide/extension.html#adding-arguments
Nr   )build_pyr   _versionr?   _version.pyzNo _version.py found.)setuptools.commandr   finalize_optionsfind_all_modulesr   r   r   dirnamer   rW   r   r   r   )r   keywordvaluer   
sp_commanditemr   s          r   _get_distutils_versionr     s     +""4(J!++-7j 77<<Q(@-PL$5l$C$J$J$LDMM!	 . +
,,r   c                 ^    [         R                  S:  a  SSKnOSSKnUR	                  U 5      $ )z"
Read the content of a TOML file.
)      r   N)sysr   tomllibtomliload)r   r   s     r   
_load_tomlr     s&     '!<<?r   T)frozenc                   N    \ rS rSr% Sr\\S'    \\S'    \\S'    \S 5       r	Sr
g)	_IncrementalConfigi  z6
Configuration loaded from a ``pyproject.toml`` file.
r   rG   r   c                 V    [         R                  R                  U R                  S5      $ )z0Path of the ``_version.py`` file. May not exist.r   )r   r   r   rR   s    r   r   _IncrementalConfig.version_path  s     ww||DII}55r   r   N)r2   r3   r4   r5   r6   bool__annotations__strr   r   r7   r   r   r   r   r     s7     L LC
I"6 6r   r   c           	         [        U S5       n[        U5      nSSS5        [        W5      nSnUb  SU;   a  US   nUc	   US   S   nUc  [	        S5      e[        U[        5      (       d#  [        SR                  [        U5      5      5      e[        USLU[        [        R                  R                  U 5      U5      S9$ ! , (       d  f       N= f! [         a     Nf = f)ac  
Load Incremental configuration from a ``pyproject.toml``

If the [tool.incremental] section is empty we take the project name
from the [project] section. Otherwise we require only a C{name} key
specifying the project name. Other keys are forbidden to allow future
extension and catch typos.

@param toml_path:
    Path to the ``pyproject.toml`` to load.
rbNnameprojectzIncremental failed to extract the project name from pyproject.toml. Specify it like:

    [project]
    name = "Foo"

Or:

    [tool.incremental]
    name = "Foo"

z/The project name must be a string, but found {})r   rG   r   )r   r   _extract_tool_incrementalKeyErrorrC   re   r   	TypeErrorr   typer   r   r   r   r   )	toml_pathr   datatool_incrementalrG   s        r   r   r     s     
i	!!} 
 16 G#2B(B"6*	9of-G    	 gs##=DDT']S
 	
 t+rwwy17; E 
	  		s   C C 
C
C C c                    SU ;  a  g [        U S   [        5      (       d  [        S5      eSU S   ;  a  g U S   S   n[        U[        5      (       d  [        S5      eS1R                  UR	                  5       5      (       d  [        S5      eU$ )Ntoolz[tool] must be a tableincrementalz"[tool.incremental] must be a tabler   z'Unexpected key(s) in [tool.incremental])re   dictrC   
issupersetkeys)r   r   s     r   r   r     s    Td6lD))122DL(F|M2&--=>>8/44677BCCr   r   )r   c                  ,    [         R                  " 5       $ )N)r   rW   r   r   r   _setuptools_versionr   1  s    r   )r   r<   r   )+r6   
__future__r   r   r   r   rD   typingr   r   r   r   r	   r
   r   dataclassesr   iotyping_extensionsr   distutils.distr   _Distributionr   objectr   r   r   r9   r<   r   r   r   r   r   r   r   r   r   r   r   r   __all__r   r   r   <module>r      s    1 	 
  O O O ! )<((6 (< v9 xf xv
4	' -F-2 $6 6 602j" "  9r   