o
    թZh<\                     @   s^  U d Z ddlZddlZddlZddlZddlZddlZddlmZ dd Z	G dd dZ
dd	 ZG d
d deZi Zeeef ed< i Zeeeeef f ed< dd Zd7ddZdd Zedddd Zedddd ZeddefddZdefdd Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Z d/d0 Z!d1d2 Z"d3d4 Z#d5d6 Z$dS )8z"Git implementation of _version.py.    N)Callablec                  C   s   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 )Zgit_refnamesZgit_fullZgit_datekeywordsr   r   F/var/www/html/lang_env/lib/python3.10/site-packages/pandas/_version.pyget_keywords   s
   r	   c                   @      e Zd ZdZdS )VersioneerConfigz2Container for Versioneer configuration parameters.N__name__
__module____qualname____doc__r   r   r   r   r   #       r   c                  C   s.   t  } d| _d| _d| _d| _d| _d| _| S )z:Create, populate and return the VersioneerConfig() object.gitpep440vzpandas-zpandas/_version.pyF)r   ZVCSstyle
tag_prefixparentdir_prefixversionfile_sourceverbose)cfgr   r   r   
get_config'   s   r   c                   @   r
   )NotThisMethodzCException raised if a method is not valid for the current scenario.Nr   r   r   r   r   r   5   r   r   LONG_VERSION_PYHANDLERSc                    s    fdd}|S )z:Create decorator to mark a method as the handler of a VCS.c                    s    t vri t < | t   < | S )z!Store f in HANDLERS[vcs][method].)r   )fmethodvcsr   r   decorate@   s   z&register_vcs_handler.<locals>.decorater   )r"   r!   r#   r   r    r   register_vcs_handler=   s   r$   Fc              	   C   sB  t | tsJ d}i }tjdkr t }| jtjO  _||d< | D ]I}	t|	g| }
ztj	|	g| f||tj
|r<tj
ndd|}W  n1 tyk   t d }|jtjkrZY q"|rgtd|
  t| Y  dS w |rutd|   dS | d	   }|jd	kr|rtd|
 d
 td|  d|jfS ||jfS )zCall the given command(s).Nwin32startupinfo)cwdenvstdoutstderr   zunable to run )NNzunable to find command, tried r   z (error)zstdout was )
isinstancelistsysplatform
subprocessZSTARTUPINFOZdwFlagsZSTARTF_USESHOWWINDOWstrPopenPIPEOSErrorexc_infoerrnoENOENTprintcommunicatestripdecode
returncode)commandsargsr'   r   hide_stderrr(   processZpopen_kwargsr&   commandZdispcmder)   r   r   r   run_commandJ   sP   
	


rC   c                 C   s   g }t dD ](}tj|}|| r#|t| d ddddd  S || tj|}q|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
       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dirnamer8   r1   r   )r   rootr   Zrootdirs_rP   r   r   r   versions_from_parentdirx   s&   


rS   r   c                 C   s   i }zbt | ddQ}|D ]D}| dr$td|}|r$|d|d< | dr:td|}|r:|d|d< | d	rPtd|}|rP|d|d
< qW d   W |S 1 s]w   Y  W |S  tyn   Y |S w )z0Extract version information from the given file.zutf-8)encodingzgit_refnames =z
=\s*"(.*)"r+   r   z
git_full =r   z
git_date =r   N)openr:   rM   researchgroupr4   )Zversionfile_absr   Zfobjlinemor   r   r   git_get_keywords   s4   r[   r   c           	         sx  d| vrt d| d}|dur%| d }| ddddd	d}| d  }|d
r:|r6td t ddd |ddD }d  fdd|D }|sjdd |D }|rjtdd||  d |rxtddt	|  t	|D ]-}||r|t
|d }td|sq||rtd|  || d  dd|d  S q||rtd d| d  ddddS )z*Get version information from git keywords.r   zShort version file foundr   N Tr+    z$Formatz"keywords are unexpanded, not usingz.unexpanded keywords, not a git-archive tarballc                 S   s   h | ]}|  qS r   )r:   .0rr   r   r   	<setcomp>   s    z-git_versions_from_keywords.<locals>.<setcomp>z(),ztag: c                    s&   h | ]}|  r|t d  qS )N)rM   rN   r`   ZTAGr   r   rc      s   & c                 S   s   h | ]
}t d |r|qS )\d)rV   rW   r`   r   r   r   rc      s    zdiscarding 'z', no digitszlikely tags: rf   zpicking r   FrE   z2no suitable tags, using unknown + full revision id	0+unknownzno suitable tags)r   get
splitlinesr:   replacerM   r8   splitjoinsortedrN   rV   match)	r   r   r   r   r   refstagsrefrb   r   re   r   git_versions_from_keywords   sT   





rr   Zpieces_from_vcsc              
   C   s   dg}t jdkrddg}tj }|dd tj||d}||dd	g|| d
\}}|dkr=|r9td| d t	d||dddddd|  dg|d\}}|du rXt	d|
 }||ddg|d\}	}|	du rot	d|	
 }	i }
|	|
d< |	dd |
d< d|
d< ||g d|d\}}|dks|du rt	d|
 }|dkr||d d!g|d\}}|dks|du rt	d"|d#}d$|d v r|d d%d& |D }d'|v rd'}n	|sd}n|d }||
d < |}|d(}||
d)< |r|d|d( }d*|v rTtd+|}|sd,| d-|
d< |
S |d.}|| s9|r,d/}t||| f  d0| d1|  d-|
d< |
S |t| d |
d2< t|d3|
d4< |d5|
d< nd|
d2< ||g d6|d\}}t| |
d4< ||g d7|dd 
 }| d8 }|
 d9d:d.d9d;d.|
d<< |
S )=a  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   r%   zgit.cmdzgit.exeGIT_DIRN)r(   	rev-parsez	--git-dir)r'   r?   r   z
Directory z not under git controlz('git rev-parse --git-dir' returned errorZdescribez--tagsz--dirtyz--alwaysz--longz--matchz[[:digit:]]*)r'   z'git describe' failedHEADz'git rev-parse' failedlong   shortrH   )rt   z--abbrev-refru   z+'git rev-parse --abbrev-ref' returned errorbranchz
--containsz&'git branch --contains' returned error
(c                 S   s   g | ]}|d d qS )   Nr   )ra   ry   r   r   r   
<listcomp>D  s    z'git_pieces_from_vcs.<locals>.<listcomp>master-dirtyrG   -z^(.+)-(\d+)-g([0-9a-f]+)$z&unable to parse git-describe output: ''r+   z'tag '%s' doesn't start with prefix '%s'ztag 'z' doesn't start with prefix 'closest-tagr|   distancerD   )zrev-listru   z--left-right)showz-sz--format=%ciru   r\   r]   r^   r_   r   )r.   r/   rJ   environcopypop	functoolspartialr8   r   r:   rk   endswithrindexrV   rW   rX   rM   rN   intri   rj   )r   rQ   r   runnerZGITSr(   rR   rcZdescribe_outZfull_outpiecesbranch_nameZbranchesZgit_describerG   rZ   Zfull_tagfmtoutr   r   r   r   git_pieces_from_vcs   s   

	





 r   returnc                 C   s   d|  ddv r
dS dS )z8Return a + if we don't already have one, else return a .+r   r_   .)rh   )r   r   r   r   plus_or_dot  s   r   c                 C   s   | d r-| d }| d s| d r+|t | 7 }|| d  d| d  7 }| d r+|d7 }|S d| d  d| d  }| d rA|d7 }|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   rG   .grx   .dirtyz0+untagged.r   r   renderedr   r   r   render_pep440  s   	r   c                 C   s   | d r7| d }| d s| d r5| d dkr|d7 }|t | 7 }|| d  d| d  7 }| d r5|d	7 }|S d
}| d dkrC|d7 }|d| d  d| d  7 }| d rY|d	7 }|S )zTAG[[.dev0]+DISTANCE.gHEX[.dirty]] .

    The ".dev0" means not master branch. Note that .dev0 sorts backwards
    (a feature branch will appear "older" than the master branch).

    Exceptions:
    1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty]
    r   r   rG   ry   r~   .dev0r   rx   r   0z
+untagged.r   r   r   r   r   render_pep440_branch  s"   		r   c                 C   s6   t | d}|d t|dkrt|d pdfS dfS )zSplit pep440 version string at the post-release segment.

    Returns the release segments before the post-release and the
    post-release version number (or -1 if no post-release segment is present).
    .postr   r|   r+   N)r1   rk   rN   r   )vervcr   r   r   pep440_split_post  s   *r   c                 C   s   | d r7| d r1t | d \}}|}|dur&|d|d  d| d  7 }|S |d| d  7 }|S | d }|S d| d  }|S )	z_TAG[.postN.devDISTANCE] -- No -dirty.

    Exceptions:
    1: no tags. 0.post0.devDISTANCE
    r   r   Nr   r+   z.devz
.post0.devz0.post0.dev)r   )r   Ztag_versionZpost_versionr   r   r   r   render_pep440_pre  s   	r   c                 C   s   | d r2| d }| d s| d r0|d| d  7 }| d r!|d7 }|t | 7 }|d| d  7 }|S d| d  }| d rA|d7 }|d	| d  7 }|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   rG   r   r   grx   0.post+gr   r   r   r   r   render_pep440_post  s   
r   c                 C   s   | d r<| d }| d s| d r:|d| d  7 }| d dkr#|d7 }|t | 7 }|d| d	  7 }| d r:|d
7 }|S d| d  }| d dkrM|d7 }|d| d	  7 }| d r^|d
7 }|S )zTAG[.postDISTANCE[.dev0]+gHEX[.dirty]] .

    The ".dev0" means not master branch.

    Exceptions:
    1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty]
    r   r   rG   r   ry   r~   r   r   rx   r   r   r   r   r   r   r   r   render_pep440_post_branch  s$   	r   c                 C   sh   | d r#| d }| d s| d r!|d| d  7 }| d r!|d7 }|S d| d  }| d r2|d7 }|S )zuTAG[.postDISTANCE[.dev0]] .

    The ".dev0" means dirty.

    Exceptions:
    1: no tags. 0.postDISTANCE[.dev0]
    r   r   rG   r   r   r   r   r   r   r   render_pep440_old  s   r   c                 C   sR   | d r| d }| d r|d| d  d| d  7 }n| d }| d r'|d7 }|S )zTAG[-DISTANCE-gHEX][-dirty].

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

    Exceptions:
    1: no tags. HEX[-dirty]  (note: no 'g' prefix)
    r   r   r   -grx   rG   r   r   r   r   r   r   render_git_describe1  s   r   c                 C   sJ   | d r| d }|d| d  d| d  7 }n| d }| d r#|d7 }|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   rx   rG   r   r   r   r   r   r   render_git_describe_longE  s   	r   c                 C   s   | d rd|  dd| d ddS |r|dkrd}|dkr"t| }nG|dkr+t| }n>|d	kr4t| }n5|d
kr=t| }n,|dkrFt| }n#|dkrOt| }n|dkrXt| }n|dkrat| }nt	d| d|| d | d d|  ddS )z9Render the given version pieces into the requested style.rH   unknownrv   NrE   defaultr   zpep440-branchz
pep440-prezpep440-postzpep440-post-branchz
pep440-oldzgit-describezgit-describe-longzunknown style 'r   rG   r   )
rh   r   r   r   r   r   r   r   r   
ValueError)r   r   r   r   r   r   renderY  s@   







r   c               	   C   s   t  } | j}z	tt | j|W S  ty   Y nw ztjt	}| j
dD ]}tj|}q&W n tyA   dddddd Y S w zt| j||}t|| jW S  tyY   Y nw z| jrft| j||W S W n	 typ   Y nw ddddddS )z=Get version information or return default if unable to do so./rg   Nz"unable to find root of source treerE   zunable to compute version)r   r   rr   r	   r   r   rJ   rK   realpath__file__r   rk   rP   	NameErrorr   r   r   r   rS   )r   r   rQ   rR   r   r   r   r   get_versions  sN   
	r   )NFFN)%r   r6   r   rJ   rV   r0   r.   typingr   r	   r   r   	Exceptionr   r   dictr1   __annotations__r   r$   rC   rS   r[   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>   sH   

.

F 
*