
    E#iH                        S r SSKrSSKrSSKrSSKrSSKrS r " S S5      rS r " S S\	5      r
0 r0 rS	 r  SS
 jrS r\" SS5      S 5       r\" SS5      S 5       r\" SS5      \4S j5       rS rS rS rS rS rS rS rS rS rg)z"Git implementation of _version.py.    Nc                      Sn SnSnXUS.nU$ )z;Get the keywords needed to look up the version information.z$Format:%d$z$Format:%H$z$Format:%ci$)refnamesfulldate )git_refnamesgit_fullgit_datekeywordss       a/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/static_dependencies/toolz/_version.pyget_keywordsr      s"     !LHH(HMHO    c                       \ rS rSrSrSrg)VersioneerConfig!   z2Container for Versioneer configuration parameters.r   N__name__
__module____qualname____firstlineno____doc____static_attributes__r   r   r   r   r   !   s    <r   r   c                  n    [        5       n SU l        SU l        SU l        SU l        SU l        SU l        U $ )z:Create, populate and return the VersioneerConfig() object.gitpep440 ztoolz-ztoolz/_version.pyF)r   VCSstyle
tag_prefixparentdir_prefixversionfile_sourceverbose)cfgs    r   
get_configr$   %   s=     
CCGCICN#C0CCKJr   c                       \ rS rSrSrSrg)NotThisMethod3   zCException raised if a method is not valid for the current scenario.r   Nr   r   r   r   r&   r&   3   s    Mr   r&   c                    ^ ^ UU 4S jnU$ )z?Decorator to mark a method as the handler for a particular VCS.c                 F   > T[         ;  a	  0 [         T'   U [         T   T'   U $ )z!Store f in HANDLERS[vcs][method].)HANDLERS)fmethodvcss    r   decorate&register_vcs_handler.<locals>.decorate=   s'    hHSM !fr   r   )r-   r,   r.   s   `` r   register_vcs_handlerr0   ;   s     Or   c           	         [        U [        5      (       d   eSnU  HS  n [        U/U-   5      n[        R                  " U/U-   X%[        R
                  U(       a  [        R
                  OSS9n  O   U(       a  [        SU < 35        gUR                  5       S   R                  5       n
[        R                  S   S:  a  U
R                  5       n
UR                   S:w  a1  U(       a  [        S	U-  5        [        S
U
-  5        SUR                   4$ XR                   4$ ! [         a^    [        R                  " 5       S   n	U	R                  [        R                  :X  a   GMH  U(       a  [        SW-  5        [        U	5           gf = f)zCall the given command(s).N)cwdenvstdoutstderr   zunable to run %s)NNzunable to find command, tried r      zunable to run %s (error)zstdout was %s)
isinstanceliststr
subprocessPopenPIPEEnvironmentErrorsysexc_infoerrnoENOENTprintcommunicatestripversion_infodecode
returncode)commandsargsr2   r"   hide_stderrr3   pcdispcmder4   s              r   run_commandrP   F   sK    h%%%%A	1#*oG  !t(2<G.25A  $ BC]]_Q%%'F
a||q,w67/F*+Q\\!!<<)   	q!Aww%,,&(723a	s   AD  A F$ FFc                 |   / n[        S5       H~  n[        R                  R                  U5      nUR	                  U 5      (       a  U[        U 5      S SSSSS.s  $ UR                  U5        [        R                  R                  U5      nM     U(       a  [        S[        U5      < SU < 35        [        S5      e)a  Try to determine the version from the parent directory name.

Source tarballs conventionally unpack into a directory that includes both
the project name and a version string. We will also support searching up
two directory levels for an appropriately named parent directory
r7   NFversionzfull-revisioniddirtyerrorr   zTried directories z but none started with prefix z+rootdir doesn't start with parentdir_prefix)rangeospathbasename
startswithlenappenddirnamerC   r:   r&   )r    rootr"   rootdirsir]   s         r   versions_from_parentdirra   k   s     H1X''""4(.//&s+;'<'=>'+"T4A A OOD!77??4(D  8}.0 	1
E
FFr   r   r   c                    0 n [        U S5      nUR                  5        GH
  nUR                  5       R                  S5      (       a2  [        R
                  " SU5      nU(       a  UR                  S5      US'   UR                  5       R                  S5      (       a2  [        R
                  " SU5      nU(       a  UR                  S5      US'   UR                  5       R                  S5      (       d  M  [        R
                  " SU5      nU(       d  M  UR                  S5      US	'   GM     UR                  5         U$ ! [         a     U$ f = f)
z0Extract version information from the given file.rzgit_refnames =z
=\s*"(.*)"r6   r   z
git_full =r   z
git_date =r   )	open	readlinesrE   rZ   researchgroupcloser>   )versionfile_absr   r+   linemos        r   git_get_keywordsrm      s    H#&KKMDzz|&&'788YY}d3+-88A;HZ(zz|&&|44YY}d3')xx{HV$zz|&&|44YY}d32')xx{HV$ " 	
	 O  Os   C.E 6E )E 
EEr   c           	         U (       d  [        S5      eU R                  S5      nUb2  UR                  5       R                  SSS5      R                  SSS5      nU S   R                  5       nUR	                  S	5      (       a  U(       a  [        S
5        [        S5      e[        UR                  S5      R                  S5       Vs/ s H  oUR                  5       PM     sn5      nSn[        U Vs/ s H(  oUR	                  U5      (       d  M  U[        U5      S PM*     sn5      nU(       d`  [        U Vs/ s H#  n[        R                  " SU5      (       d  M!  UPM%     sn5      nU(       a  [        SSR                  Xh-
  5      -  5        U(       a&  [        SSR                  [        U5      5      -  5        [        U5       HW  n	U	R	                  U5      (       d  M  U	[        U5      S nU(       a  [        SU-  5        UU S   R                  5       SSUS.s  $    U(       a  [        S5        SU S   R                  5       SSSS.$ s  snf s  snf s  snf )z*Get version information from git keywords.zno keywords at all, weirdr   N Tr6   r   r   z$Formatz"keywords are unexpanded, not usingz.unexpanded keywords, not a git-archive tarballz(),ztag: z\dzdiscarding '%s', no digitszlikely tags: %sz
picking %sr   FrR   z2no suitable tags, using unknown + full revision id	0+unknownzno suitable tags)r&   getrE   replacerZ   rC   setsplitr[   rf   rg   joinsorted)
r   r   r"   r   r   rc   refsTAGtagsrefs
             r   git_versions_from_keywordsr}      s    788<<D zz|##Ca088b!D
#))+H9%%67LMM8>>$#7#=#=c#BC#Ba	#BCDD Cd@dll3.?#c()d@AD t;t!ryy':At;<.$+1FFG#((6$<"889d|>>*%%C
O$%AlQ&' '/'7'='='?"T " "  BC"'/557%7G G? D A <s   I1II7 IIpieces_from_vcsc                 B   S/n[         R                  S:X  a  SS/nU" USS/USS9u  pVUS	:w  a   U(       a  [        S
U-  5        [        S5      eU" USSSSSSSU -  /US9u  pvUc  [        S5      eUR	                  5       nU" USS/US9u  pUc  [        S5      eUR	                  5       n0 n	XS'   USS U	S'   SU	S'   Un
U
R                  S5      nXS'   U(       a  U
SU
R                  S5       n
SU
;   a  [        R                  " SU
5      nU(       d
  S U-  U	S'   U	$ UR                  S!5      nUR                  U 5      (       d(  U(       a  S"n[        XU 4-  5        S#U< S$U < S%3U	S'   U	$ U[        U 5      S U	S&'   [        UR                  S'5      5      U	S('   UR                  S)5      U	S'   OSU	S&'   U" U/ S*QUS9u  p[        U5      U	S('   U" U/ S+QUS9S	   R	                  5       nUR	                  5       R                  S,S-S!5      R                  S,S.S!5      U	S/'   U	$ )0a  Get version from 'git describe' in the root of the source tree.

This only gets called if the git-archive 'subst' keywords were *not*
expanded, and _version.py hasn't already been rewritten with a short
version string, meaning we're inside a checked out source tree.
r   win32zgit.cmdzgit.exez	rev-parsez	--git-dirT)r2   rK   r   z"Directory %s not under git controlz('git rev-parse --git-dir' returned errordescribez--tagsz--dirtyz--alwaysz--longz--matchz%s*)r2   Nz'git describe' failedHEADz'git rev-parse' failedlong   shortrU   -dirtyrT   -z^(.+)-(\d+)-g([0-9a-f]+)$z)unable to parse git-describe output: '%s'r6   z'tag '%s' doesn't start with prefix '%s'ztag 'z' doesn't start with prefix ''closest-tag   distancer7   )zrev-listr   z--count)showz-sz--format=%cir   ro   rp   r   r   )r?   platformrC   r&   rE   endswithrindexrf   rg   rh   rZ   r[   intrt   )r   r^   r"   rP   GITSoutrcdescribe_outfull_outpiecesgit_describerT   rl   full_tagfmt	count_outr   s                    r   git_pieces_from_vcsr      s    7D
||w9%$k :&*,GC	Qw6=>FGG #4*h	*4h*3UZ5G*I (,-L
 344%%'Ltk6%:ELH455~~HF6NrlF7OF7O  L !!(+E7O#$B\%8%8%BC lYY3\BJ!- .F7OM 88A;"":..?cz223"*J 8F7OM (Z)9 :} !!-z ((1+w !%}#D*I(,.	 ^z tC!!"$$)EG 	ZZ\))#sA6>>sBJF6NMr   c                 2    SU R                  SS5      ;   a  gg)z8Return a + if we don't already have one, else return a .+r   r   .)rs   )r   s    r   plus_or_dotr   4  s    
fjj++r   c                     U S   (       aH  U S   nU S   (       d
  U S   (       a-  U[        U 5      -  nUSU S   U S   4-  -  nU S   (       a  US-  nU$ SU S   U S   4-  nU S   (       a  US-  nU$ )a  Build up version string, with post-release "local version identifier".

Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty

Exceptions:
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
r   r   rT   z%d.g%sr   z.dirtyz0+untagged.%d.g%sr   r   rendereds     r   render_pep440r   ;  s     m-(*F++HF:$6w#HHHHgH$ O	 '&*<*0/*; ;'? HOr   c                 b    U S   (       a  U S   nU S   (       a  USU S   -  -  nU$ SU S   -  nU$ )zQTAG[.post.devDISTANCE] -- No -dirty.

Exceptions:
1: no tags. 0.post.devDISTANCE
r   r   z.post.dev%dz0.post.dev%dr   r   s     r   render_pep440_prer   T  sO     m-(*z(:::H O "F:$66Or   c                     U S   (       aN  U S   nU S   (       d
  U S   (       a3  USU S   -  -  nU S   (       a  US-  nU[        U 5      -  nUSU S   -  -  nU$ SU S   -  nU S   (       a  US-  nUS	U S   -  -  nU$ )
a  TAG[.postDISTANCE[.dev0]+gHEX] .

The ".dev0" means dirty. Note that .dev0 sorts backwards
(a dirty tree will appear "older" than the corresponding clean one),
but you shouldn't be releasing software with -dirty anyways.

Exceptions:
1: no tags. 0.postDISTANCE[.dev0]
r   r   rT   .post%d.dev0zg%sr   0.post%dz+g%sr   r   s     r   render_pep440_postr   d  s     m-(*	F:$666HgG#F++Hw//H O	 z 22'?HFVG_,,Or   c                     U S   (       a5  U S   nU S   (       d
  U S   (       a  USU S   -  -  nU S   (       a  US-  nU$ SU S   -  nU S   (       a  US-  nU$ )zfTAG[.postDISTANCE[.dev0]] .

The ".dev0" means dirty.

Eexceptions:
1: no tags. 0.postDISTANCE[.dev0]
r   r   rT   r   r   r   r   r   s     r   render_pep440_oldr     sw     m-(*	F:$666HgG# O z 22'?HOr   c                     U S   (       a   U S   nU S   (       a  USU S   U S   4-  -  nOU S   nU S   (       a  US-  nU$ )zTAG[-DISTANCE-gHEX][-dirty].

Like 'git describe --tags --dirty --always'.

Exceptions:
1: no tags. HEX[-dirty]  (note: no 'g' prefix)
r   r   -%d-g%sr   rT   r   r   r   s     r   render_git_describer     s]     m-(*	VJ%7$IIIH '?gHOr   c                 n    U S   (       a  U S   nUSU S   U S   4-  -  nOU S   nU S   (       a  US-  nU$ )zTAG-DISTANCE-gHEX[-dirty].

Like 'git describe --tags --dirty --always -long'.
The distance/hash is unconditional.

Exceptions:
1: no tags. HEX[-dirty]  (note: no 'g' prefix)
r   r   r   r   rT   r   r   r   s     r   render_git_describe_longr     sT     m-(I
!3VG_ EEE '?gHOr   c                    U S   (       a  SU R                  S5      SU S   SS.$ U(       a  US:X  a  SnUS:X  a  [        U 5      nOhUS:X  a  [        U 5      nOVUS	:X  a  [        U 5      nODUS
:X  a  [	        U 5      nO2US:X  a  [        U 5      nO US:X  a  [        U 5      nO[        SU-  5      eX S   U S   SU R                  S5      S.$ )z9Render the given version pieces into the requested style.rU   unknownr   NrR   defaultr   z
pep440-prezpep440-postz
pep440-oldzgit-describezgit-describe-longzunknown style '%s'rT   r   )rs   r   r   r   r   r   r   
ValueError)r   r   r   s      r   renderr     s    g$#)::f#5	 	 EY& (	,	$V,	-	%f-	,	$V,	.	 &v.	%	%+F3-5666NG_tJJv&( (r   c                     [        5       n U R                  n [        [        5       U R                  U5      $ ! [
         a     Of = f [        R                  R                  [        5      nU R                  R                  S5       H"  n[        R                  R                  U5      nM$     O! [         a    SSSSSS.s $ f = f [        U R                  X!5      n[        X@R                   5      $ ! [
         a     Of = f U R"                  (       a  [%        U R"                  X!5      $ O! [
         a     Of = fSSSSSS.$ )z=Get version information or return default if unable to do so./rr   Nz"unable to find root of source treerR   zunable to compute version)r$   r"   r}   r   r   r&   rW   rX   realpath__file__r!   rv   r]   	NameErrorr   r   r   r    ra   )r#   r"   r^   r`   r   s        r   get_versionsr     s=    ,CkkG),.#..*13 	3 ww) ''--c2A77??4(D 3 &4= 	$S^^TCfii(( *3+?+?OO    #t0$@ @sF   7 
AAA$B- -CC*C1 1
C>=C>&D* *
D76D7)NFFN)r   rA   rW   rf   r;   r?   r   r   r$   	Exceptionr&   LONG_VERSION_PYr*   r0   rP   ra   rm   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s    )  	 	  

= =NI N  FK" JG2 e^, -8 eZ(3G )3Gl e./?J X 0Xv2 6,(((@+@r   