
    eiH                     L   d Z ddlZddlZddlZddlZddlZd Z G d d          Zd Z G d de	          Z
i Zi Zd	 Z	 	 ddZd Z edd          d             Z edd          d             Z edd          efd            Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdS )z"Git implementation of _version.py.    Nc                      d} d}d}| ||d}|S )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       e/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/static_dependencies/toolz/_version.pyget_keywordsr      s'     !LHH((HMMHO    c                       e Zd ZdZdS )VersioneerConfigz2Container for Versioneer configuration parameters.N__name__
__module____qualname____doc__r   r   r   r   r   !   s        <<<<r   r   c                  v    t                      } d| _        d| _        d| _        d| _        d| _        d| _        | S )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                       e Zd ZdZdS )NotThisMethodzCException raised if a method is not valid for the current scenario.Nr   r   r   r   r#   r#   3   s        MMMMr   r#   c                       fd}|S )z?Decorator to mark a method as the handler for a particular VCS.c                 N    t           vr
i t           <   | t                    <   | S )z!Store f in HANDLERS[vcs][method].)HANDLERS)fmethodvcss    r   decoratez&register_vcs_handler.<locals>.decorate=   s*    hHSM !fr   r   )r)   r(   r*   s   `` r   register_vcs_handlerr+   ;   s)          Or   Fc                    t          | t                    sJ d}| D ]}	 t          |g|z             }t          j        |g|z   ||t          j        |rt          j        nd          } n{# t          $ rX t          j                    d         }	|	j	        t          j
        k    rY |r!t          d|z             t          |	           Y  dS w xY w|rt          d|            dS |                                d                                         }
t          j        d         dk    r|
                                }
|j        dk    r/|r$t          d	|z             t          d
|
z             d|j        fS |
|j        fS )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argsr-   r   hide_stderrr.   pcdispcmder/   s              r   run_commandrK   F   s    h%%%%%A  	1#*ooG !t#(2<G *3.25 5 5A E 	 	 	q!Aw%,&& (72333a:::	  	DEBCCCz]]__Q%%''F
a|q 	,,w6777/F*+++Q\!!1<s   AA))8C##C
Cc                    g }t          d          D ]}t          j                            |          }|                    |           r|t          |           d         dddddc S |                    |           t          j                            |          }|r"t          dt          |          d|            t          d          )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
    r2   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dirnamer>   r5   r#   )r   rootr   rootdirsirX   s         r   versions_from_parentdirr\   k   s     H1XX ) )'""4((.// 	)&s+;'<'<'='=>'+"T4A A A A A OOD!!!7??4((DD 18}}}}..0 	1 	1 	1
E
F
FFr   r   r   c                    i }	 t          | d          }|                                D ]}|                                                    d          r/t	          j        d|          }|r|                    d          |d<   |                                                    d          r/t	          j        d|          }|r|                    d          |d<   |                                                    d          r/t	          j        d|          }|r|                    d          |d	<   |                                 n# t          $ r Y nw xY w|S )
z0Extract version information from the given file.rzgit_refnames =z
=\s*"(.*)"r1   r   z
git_full =r   z
git_date =r   )	open	readlinesr@   rU   researchgroupcloser9   )versionfile_absr   r'   linemos        r   git_get_keywordsrh      sK    H#&&KKMM 	3 	3Dzz||&&'788 7Y}d33 7+-88A;;HZ(zz||&&|44 3Y}d33 3')xx{{HV$zz||&&|44 3Y}d33 3')xx{{HV$					   Os   D?E 
EEr   c                 b  	 | st          d          |                     d          }|>|                                                    ddd                              ddd          }| d                                         }|                    d	          r |rt          d
           t          d          t          d |                    d                              d          D                       }d	t          	fd|D                       }|sCt          d |D                       }|r(t          dd                    ||z
            z             |r2t          dd                    t          |                    z             t          |          D ]d}|                    |          rM|t          |          d         }|rt          d|z             || d                                         dd|dc S e|rt          d           d| d                                         ddddS )z*Get version information from git keywords.zno keywords at all, weirdr   N Tr1   r   r   z$Formatz"keywords are unexpanded, not usingz.unexpanded keywords, not a git-archive tarballc                 6    g | ]}|                                 S r   )r@   .0r^   s     r   
<listcomp>z.git_versions_from_keywords.<locals>.<listcomp>   s     CCCa		CCCr   z(),ztag: c                 h    g | ].}|                               |t                    d          /S )N)rU   rV   )rn   r^   TAGs     r   ro   z.git_versions_from_keywords.<locals>.<listcomp>   s8    @@@all3.?.?@#c(())@@@r   c                 <    g | ]}t          j        d |          |S )z\d)ra   rb   rm   s     r   ro   z.git_versions_from_keywords.<locals>.<listcomp>   s)    ;;;!ry':':;A;;;r   zdiscarding '%s', no digitszlikely tags: %sz
picking %sr   FrM   z2no suitable tags, using unknown + full revision id	0+unknownzno suitable tags)r#   getr@   replacerU   r>   setsplitjoinsortedrV   )
r   r   r   r   r   refstagsrefr^   rr   s
            @r   git_versions_from_keywordsr~      s|     97888<<D zz||##Ca0088b!DD
#))++H9%% N 	86777LMMMCC8>>$#7#7#=#=c#B#BCCCDDD C@@@@d@@@AAD 
H ;;t;;;<< 	H.$+1F1FFGGG :#((6$<<"8"88999d|| 	" 	">>*%% 	"C
OO$$%A (lQ&''' '/'7'='='?'?"T " " " " "		"  DBCCC"'/5577%7G G Gr   pieces_from_vcsc                    dg}t           j        dk    rddg} ||ddg|d          \  }}|d	k    r#|rt          d
|z             t          d           ||ddddddd| z  g|          \  }}|t          d          |                                } ||ddg|          \  }}|t          d          |                                }i }	||	d<   |dd         |	d<   d|	d<   |}
|
                    d          }||	d<   |r|
d|
                    d                   }
d|
v rt          j        d|
          }|s
d |z  |	d<   |	S |	                    d!          }|
                    |           s&|rd"}t          ||| fz             d#|d$| d%|	d<   |	S |t          |           d         |	d&<   t          |	                    d'                    |	d(<   |	                    d)          |	d<   n*d|	d&<    ||g d*|          \  }}t          |          |	d(<    ||g d+|          d	                                         }|                                                    d,d-d!                              d,d.d!          |	d/<   |	S )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)r-   rF   r   z"Directory %s not under git controlz('git rev-parse --git-dir' returned errordescribez--tagsz--dirtyz--alwaysz--longz--matchz%s*)r-   Nz'git describe' failedHEADz'git rev-parse' failedlong   shortrP   -dirtyrO   -z^(.+)-(\d+)-g([0-9a-f]+)$z)unable to parse git-describe output: '%s'r1   z'tag '%s' doesn't start with prefix '%s'ztag 'z' doesn't start with prefix ''closest-tag   distancer2   )zrev-listr   z--count)showz-sz--format=%cir   rj   rk   r   r   )r:   platformr>   r#   r@   endswithrindexra   rb   rc   rU   rV   intrv   )r   rY   r   rK   GITSoutrcdescribe_outfull_outpiecesgit_describerO   rg   full_tagfmt	count_outr   s                    r   git_pieces_from_vcsr      sK    7D
|w9%k$k :&*, , ,GC	Qww 	?6=>>>FGGG #{4*h	*4h*3UZ5G*I (,- - -L"
 3444%%''L;tk6%:EEELHb4555~~HFF6NrrlF7OF7O  L !!(++EF7O D#$B\%8%8%B%B$BC lY3\BB 	J!- .F7OM 88A;;"":.. 	 4?cXz22333"*((JJJ 8F7OM (Z)9)9 :} !!--z ((1++w !%}#D*I*I*I(,. . .	2 ^^z ;tCCC! ! !!"$$)EGG 	ZZ\\))#sA66>>sBJJF6NMr   c                 :    d|                      dd          v rdS dS )z8Return a + if we don't already have one, else return a .+r   r   .)ru   )r   s    r   plus_or_dotr   4  s%    
fjj++++s3r   c                     | d         rN| d         }| d         s| d         r5|t          |           z  }|d| d         | d         fz  z  }| d         r|dz  }n d| d         | d         fz  }| d         r|dz  }|S )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   rO   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$ '&*<*0/*; ;'? 	! HOr   c                 j    | d         r| d         }| d         r|d| d         z  z  }nd| d         z  }|S )z]TAG[.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  sS     m 7-(* 	;z(:::H "F:$66Or   c                 
   | d         rT| d         }| d         s| d         r;|d| d         z  z  }| d         r|dz  }|t          |           z  }|d| d         z  z  }n&d| d         z  }| d         r|dz  }|d	| d         z  z  }|S )
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   rO   .post%d.dev0zg%sr   0.post%dz+g%sr   r   s     r   render_pep440_postr   d  s     m --(* 	0 	0	F:$666Hg $G#F+++Hw//H z 22'? 	 HFVG_,,Or   c                     | d         r4| d         }| d         s| d         r|d| d         z  z  }| d         r|dz  }nd| d         z  }| d         r|dz  }|S )zvTAG[.postDISTANCE[.dev0]] .

    The ".dev0" means dirty.

    Eexceptions:
    1: no tags. 0.postDISTANCE[.dev0]
    r   r   rO   r   r   r   r   r   s     r   render_pep440_oldr     s     m 
 -(* 	$ 	$	F:$666Hg $G# z 22'? 	 HOr   c                     | d         r'| d         }| d         r|d| d         | d         fz  z  }n| d         }| d         r|dz  }|S )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   rO   r   r   r   s     r   render_git_describer     sm     m #-(* 	J	VJ%7$IIIH '?g HOr   c                 ~    | d         r| d         }|d| d         | d         fz  z  }n| d         }| d         r|dz  }|S )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   rO   r   r   r   s     r   render_git_describe_longr     s`     m #-(I
!3VG_ EEE '?g HOr   c                    | d         r!d|                      d          d| d         ddS |r|dk    rd}|dk    rt          |           }n|dk    rt          |           }nj|d	k    rt          |           }nT|d
k    rt	          |           }n>|dk    rt          |           }n(|dk    rt          |           }nt          d|z            || d         | d         d|                      d          dS )z9Render the given version pieces into the requested style.rP   unknownr   NrM   defaultr   z
pep440-prezpep440-postz
pep440-oldzgit-describezgit-describe-longzunknown style '%s'rO   r   )ru   r   r   r   r   r   r   
ValueError)r   r   r   s      r   renderr     s6   g $#)::f#5#5	  	  EY&& ((	,		$V,,	-		%f--	,		$V,,	.	 	 &v..	%	%	%+F33-5666F6NG_tJJv&&( ( (r   c                  l   t                      } | j        }	 t          t                      | j        |          S # t
          $ r Y nw xY w	 t          j                            t                    }| j
                            d          D ]!}t          j                            |          }"n# t          $ r ddddddcY S w xY w	 t          | j        ||          }t          || j                  S # t
          $ r Y nw xY w	 | j        rt%          | j        ||          S n# t
          $ r Y nw xY wddddddS )z=Get version information or return default if unable to do so./rt   Nz"unable to find root of source treerM   zunable to compute version)r!   r   r~   r   r   r#   rR   rS   realpath__file__r   rx   rX   	NameErrorr   r   r   r   r\   )r    r   rY   r[   r   s        r   get_versionsr     s    ,,CkG),..#.*13 3 	3   w)) '--c22 	) 	)A7??4((DD	)   &4=  	 	 	$S^T7CCfci(((    	P*3+?wOOO	P    #t0$@ @ @sF   !9 
AA
A B+ +C ?C *C/ /
C<;C< D 
D+*D+)NFFN)r   r<   rR   ra   r6   r:   r   r   r!   	Exceptionr#   LONG_VERSION_PYr&   r+   rK   r\   rh   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s%   ) (  				 				     




 
 
= = = = = = = =  N N N N NI N N N    FK"  "  "  " JG G G2 e^,,  -,8 eZ((3G 3G )(3Gl e.//?J X X X 0/Xv    2     6  ,  (  (( ( (@+@ +@ +@ +@ +@r   