a
    Of<\                     @   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ed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   H/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/_version.pyget_keywords   s
    r	   c                   @   s   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
   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                   @   s   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   5   s   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   sL  t | tsJ d}i }tjdkr@t }| jtjO  _||d< | D ]}	t|	g| }
z8tj	|	g| f||tj
|rxtj
ndd|}W  qW qD ty   t d }|jtjkrY qD|rtd|
  t| Y  dS 0 qD|rtd|   dS | d	   }|jd	krB|r8t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   sN    


rA   c                 C   s   g }t dD ]P}tj|}|| rF|t| d ddddd  S || tj|}q|rztdt	| d|   t
ddS )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dirnamer6   r/   r   )r   rootr   Zrootdirs_rN   r   r   r   versions_from_parentdirx   s&    


rQ   r   c                 C   s   i }zt | dd}|D ]}| drHtd|}|rH|d|d< | drttd|}|rt|d|d< | d	rtd|}|r|d|d
< qW d   n1 s0    Y  W n ty   Y n0 |S )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)openr8   rK   researchgroupr2   )Zversionfile_absr   Zfobjlinemor   r   r   git_get_keywords   s&    2rY   r   c           	         s~  d| vrt d| d}|durJ| d }| ddddd	d}| d  }|d
rt|rltd t ddd |ddD }d  fdd|D }|sdd |D }|rtdd||  d |rtddt	|  t	|D ]^}||r|t
|d }td|s&q|r:td|  || d  dd|d  S q|rft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   )r8   .0rr   r   r   	<setcomp>       z-git_versions_from_keywords.<locals>.<setcomp>z(),ztag: c                    s&   h | ]}|  r|t d  qS )N)rK   rL   r^   ZTAGr   r   ra      rb   c                 S   s   h | ]}t d |r|qS )\d)rT   rU   r^   r   r   r   ra      rb   zdiscarding 'z', no digitszlikely tags: re   zpicking r   FrC   z2no suitable tags, using unknown + full revision id	0+unknownzno suitable tags)r   get
splitlinesr8   replacerK   r6   splitjoinsortedrL   rT   match)	r   r   r   r   r   refstagsrefr`   r   rd   r   git_versions_from_keywords   sR    




rq   Zpieces_from_vcsc              
   C   s2  dg}t jdkrddg}tj }|dd tj||d}||dd	g|| d
\}}|dkrz|rrtd| d t	d||dddddd|  dg|d\}}|du rt	d|
 }||ddg|d\}	}|	du rt	d|	
 }	i }
|	|
d< |	dd |
d< d|
d< ||g d|d\}}|dks4|du r<t	d|
 }|dkr||d d!g|d\}}|dksx|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 rtd+|}|s:d,| d-|
d< |
S |d.}|| s|rjd/}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   shortrF   )rs   z--abbrev-refrt   z+'git rev-parse --abbrev-ref' returned errorbranchz
--containsz&'git branch --contains' returned error
(c                 S   s   g | ]}|d d qS )   Nr   )r_   rx   r   r   r   
<listcomp>D  rb   z'git_pieces_from_vcs.<locals>.<listcomp>master-dirtyrE   -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{   distancerB   )zrev-listrt   z--left-right)showz-sz--format=%cirt   rZ   r[   r\   r]   r   )r,   r-   rH   environcopypop	functoolspartialr6   r   r8   rj   endswithrindexrT   rU   rV   rK   rL   intrh   ri   )r   rO   r   runnerZGITSr&   rP   rcZdescribe_outZfull_outpiecesbranch_nameZbranchesZgit_describerE   rX   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]   .)rg   )r   r   r   r   plus_or_dot  s    r   c                 C   s   | d rX| d }| d s | d r|t | 7 }|| d  d| d  7 }| d r|d7 }n(d| d  d| d  }| d r|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   rE   .grw   .dirtyz0+untagged.r   r   renderedr   r   r   render_pep440  s    	
r   c                 C   s   | d rl| d }| d s | d r| d dkr4|d7 }|t | 7 }|| d  d| d  7 }| d r|d	7 }nDd
}| d dkr|d7 }|d| d  d| d  7 }| d r|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   rE   rx   r}   .dev0r   rw   r   0z
+untagged.r   r   r   r   r   render_pep440_branch  s     	
r   c                 C   s4   t | d}|d t|dkr.t|d p*dn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)r/   rj   rL   r   )vervcr   r   r   pep440_split_post  s    r   c                 C   sz   | d rh| d r^t | d \}}|}|durJ|d|d  d| d  7 }qf|d| d  7 }qv| d }n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 rb| d }| d s | d r|d| d  7 }| d rB|d7 }|t | 7 }|d| d  7 }n0d| d  }| d r|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   rE   r   r   grw   0.post+gr   r   r   r   r   render_pep440_post  s    
r   c                 C   s   | d rv| d }| d s | d r|d| d  7 }| d dkrF|d7 }|t | 7 }|d| d	  7 }| d r|d
7 }nDd| d  }| d dkr|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   rE   r   rx   r}   r   r   rw   r   r   r   r   r   r   r   r   render_pep440_post_branch  s"    
r   c                 C   sf   | d rD| d }| d s | d rb|d| d  7 }| d rb|d7 }nd| d  }| d rb|d7 }|S )zuTAG[.postDISTANCE[.dev0]] .

    The ".dev0" means dirty.

    Exceptions:
    1: no tags. 0.postDISTANCE[.dev0]
    r   r   rE   r   r   r   r   r   r   r   render_pep440_old  s    
r   c                 C   sR   | d r6| d }| d r>|d| d  d| d  7 }n| d }| d rN|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   -grw   rE   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 rF|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   rw   rE   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r2d}|dkrDt| }n|dkrVt| }n||d	krht| }nj|d
krzt| }nX|dkrt| }nF|dkrt| }n4|dkrt| }n"|dkrt| }nt	d| d|| d | d d|  ddS )z9Render the given version pieces into the requested style.rF   unknownru   NrC   defaultr   zpep440-branchz
pep440-prezpep440-postzpep440-post-branchz
pep440-oldzgit-describezgit-describe-longzunknown style 'r   rE   r   )
rg   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y0   Y n0 z.tjt	}| j
dD ]}tj|}qLW n" ty   dddddd Y S 0 zt| j||}t|| jW S  ty   Y n0 z| jrt| j||W S W n ty   Y n0 ddddddS )z=Get version information or return default if unable to do so./rf   Nz"unable to find root of source treerC   zunable to compute version)r   r   rq   r	   r   r   rH   rI   realpath__file__r   rj   rN   	NameErrorr   r   r   r   rQ   )r   r   rO   rP   r   r   r   r   get_versions  sB    r   )NFFN)%r   r4   r   rH   rT   r.   r,   typingr   r	   r
   r   	Exceptionr   r   dictr/   __annotations__r   r"   rA   rQ   rY   rq   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>   sF   
.

F 
*