
    bi*`                       U d dl m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l
mZ d%dZ G d d      Zd&d	Z G d
 de      Zi Zded<   i Zded<   d'dZ	 	 	 	 d(	 	 	 	 	 	 	 	 	 	 	 	 	 d)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.dZ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.d"Z#d0d#Z$d1d$Z%y)2    )annotationsN)Callable)Anydict[str, str]c                     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       \/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/dask/dataframe/dask_expr/_version.pyget_keywordsr      s$     !LHH((HMHO    c                  N    e Zd ZU dZded<   ded<   ded<   ded<   ded<   ded	<   y
)VersioneerConfigz2Container for Versioneer configuration parameters.strVCSstyle
tag_prefixparentdir_prefixversionfile_sourceboolverboseN)__name__
__module____qualname____doc____annotations__r   r   r   r   r   %   s%    <	HJOMr   r   c                 n    t               } d| _        d| _        d| _        d| _        d| _        d| _        | S )z:Create, populate and return the VersioneerConfig() object.gitpep440vz
dask_expr-zdask_expr/_version.pyF)r   r   r   r   r   r   r   )cfgs    r   
get_configr'   0   s=     
CCGCICN'C4CCKJr   c                      e Zd ZdZy)NotThisMethodzCException raised if a method is not valid for the current scenario.N)r   r   r   r    r   r   r   r)   r)   >   s    Mr   r)   LONG_VERSION_PYzdict[str, dict[str, Callable]]HANDLERSc                     d fd}|S )z:Create decorator to mark a method as the handler of a VCS.c                B    t         vr	i t         <   | t            <   | S )z!Store f in HANDLERS[vcs][method].)r+   )fmethodvcss    r   decoratez&register_vcs_handler.<locals>.decorateI   s'    hHSM !fr   )r.   r   returnr   r   )r0   r/   r1   s   `` r   register_vcs_handlerr3   F   s     Or   c           	     6   t        | t              sJ d}i }t        j                  dk(  r<t	        j
                         }|xj                  t        j                  z  c_        ||d<   | D ]R  }		 t        |	g|z         }
t	        j                  |	g|z   f||t        j                  |rt        j                  ndd|} n |rt        d|         y|j                         d   j!                         j#                         }|j$                  dk7  r,|rt        d	|
z         t        d
|z         d|j$                  fS ||j$                  fS # t        $ rI}|j                  t        j                  k(  rY d}~
|rt        d
z         t        |       Y d}~ yd}~ww xY w)zCall the given command(s).Nwin32startupinfo)cwdenvstdoutstderrzunable to run %s)NNzunable to find command, tried r   zunable to run %s (error)zstdout was %s)
isinstancelistsysplatform
subprocessSTARTUPINFOdwFlagsSTARTF_USESHOWWINDOWr   PopenPIPEOSErrorerrnoENOENTprintcommunicatestripdecode
returncode)commandsargsr7   r   hide_stderrr8   processpopen_kwargsr6   commanddispcmder9   s                r   run_commandrU   S   s    h%%%G#%L
||w ,,.z>>>&1]# 	7)d*+G &&	D !+6
D G * 28*=>  "1%++-446FQ,w67/F*+W''''7%%%%#  	ww%,,&(723a	s   ,AE	FF2FFc                `   g }t        d      D ]x  }t        j                  j                  |      }|j	                  |       r|t        |       d dddddc S |j                  |       t        j                  j                  |      }z |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dirnamerH   r   r)   )r   rootr   rootdirs_rc   s         r   versions_from_parentdirrg      s     H1X %''""4(./"3'7#8#:;#'  	wwt$% 8}.0	
 E
FFr   r#   r   c                D   i }	 t        |       5 }|D ]  }|j                         j                  d      r,t        j                  d|      }|r|j                  d      |d<   |j                         j                  d      r,t        j                  d|      }|r|j                  d      |d<   |j                         j                  d      st        j                  d|      }|s|j                  d      |d<    	 d	d	d	       |S # 1 sw Y   |S xY w# t        $ r Y |S w xY w)
z0Extract version information from the given file.zgit_refnames =z
=\s*"(.*)"   r   z
git_full =r	   z
git_date =r
   N)openrJ   r`   researchgrouprE   )versionfile_absr   fobjlinemos        r   git_get_keywordsrr      s	     "H/" 	7d 7::<**+;<=$7B/1xx{,::<**<8=$7B+-88A;(::<**<8=$7B+-88A;(7	7  O!	7  O  Os;   D B;DD$D;D D
D D 	DDr   c                L   d| vrt        d      | j                  d      }|E|j                         d   }|j                         j	                  ddd      j	                  dd	d      }| d   j                         }|j                  d
      r|rt        d       t        d      |j                  d      j                  d      D ch c]  }|j                          }}d}|D ch c]"  }|j                  |      s|t        |      d $ }}|sH|D ch c]  }t        j                  d|      s| }}|r t        ddj                  ||z
        z         |r&t        ddj                  t        |            z         t        |      D ]c  }	|	j                  |      s|	t        |      d }t        j                  d|      s:|rt        d|z         || d   j                         dd|dc S  |rt        d       d| d   j                         ddddS c c}w c c}w c c}w )z*Get version information from git keywords.r   zShort version file foundr
   N Tri    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	   FrX   z2no suitable tags, using unknown + full revision id	0+unknownzno suitable tags)r)   get
splitlinesrJ   replacer`   rH   splitra   rk   rl   joinsortedmatch)
r   r   r   r
   r   rrefsTAGtagsrefs
             r   git_versions_from_keywordsr      s     !677<<D  $ zz|##Ca088b!D
#))+H9%67LMM'~~d399#>?!AGGI?D? C#'=a1<<+<Ac#hjM=D=  7a299UA#677.$+1FFG#((6$<"889d| >>*%C
O%&A 88E1%lQ&'#+F#3#9#9#; & BC#F+113# O @ > 8s   H%H<HH!0H!pieces_from_vcsc                l   dg}t         j                  dk(  rddg}t        j                  j	                         }|j                  dd       t        j                  ||      } ||dd	g|| 
      \  }}|dk7  r|rt        d|z         t        d       ||dddddd|  dg|      \  }}|t        d      |j                         } ||ddg|      \  }	}|	t        d      |	j                         }	i }
|	|
d<   |	dd |
d<   d|
d<    ||g d|      \  }}|dk7  s|t        d      |j                         }|dk(  rn ||dd g|      \  }}|dk7  s|t        d!      |j                  d"      }d#|d   v r|j                  d       |D cg c]  }|d$d 	 }}d%|v rd%}n
|sd}n|d   }||
d<   |}|j                  d&      }||
d'<   |r|d|j                  d&       }d(|v rt        j                  d)|      }|s
d*|z  |
d<   |
S |j!                  d+      }|j#                  |       s+|rd,}t        ||| fz         d-j%                  ||       |
d<   |
S |t'        |       d |
d.<   t)        |j!                  d$            |
d/<   |j!                  d0      |
d<   n1d|
d.<    ||g d1|      \  }}t'        |j                               |
d/<    ||g d2|      d   j                         }|j+                         d3   }|j                         j-                  d4d5d+      j-                  d4d6d+      |
d7<   |
S c c}w )8a  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#   r5   zgit.cmdzgit.exeGIT_DIRN)r8   	rev-parsez	--git-dir)r7   rO   r   z"Directory %s not under git controlz('git rev-parse --git-dir' returned errordescribez--tagsz--dirtyz--alwaysz--longz--matchz[[:digit:]]*)r7   z'git describe' failedHEADz'git rev-parse' failedlong   shortr[   )r   z--abbrev-refr   z+'git rev-parse --abbrev-ref' returned errorbranchz
--containsz&'git branch --contains' returned error
(   master-dirtyrZ   -z^(.+)-(\d+)-g([0-9a-f]+)$z)unable to parse git-describe output: '%s'ri   z'tag '%s' doesn't start with prefix '%s'z'tag '{}' doesn't start with prefix '{}'closest-tagdistancerW   )zrev-listr   z--left-right)showz-sz--format=%cir   rt   ru   rv   rw   r
   )r=   r>   r]   environcopypop	functoolspartialrH   r)   rJ   r}   endswithrindexrk   rl   rm   r`   formatra   intr{   r|   )r   rd   r   runnerGITSr8   rf   rcdescribe_outfull_outpiecesbranch_namebranchesr   git_describerZ   rq   full_tagfmtoutr
   s                        r   git_pieces_from_vcsr     s    7D
||w9%
 **//
CGGItv3/F4+{3w;WEAr	Qw6=>FGG l,'	
 L" 344%%'L$f 54@LHb455~~HFF6NrlF7OF7OT#HdSOK	Qw+%IJJ##%Kf dX|$<$G"7h& HII>>$' (1+LLO .666F12J66x"KK #1+K"F8  L !!(+EF7O#$Cl&9&9(&CD lYY3\BILXF7OM 88A;"":.?cXz223GNNF7O M (Z): ;} !!-z ((1+w !%}CNR -z $>DI!LRRTD ??R DZZ\))#sA6>>sBJF6NM 7s   L1c                .    d| j                  dd      v ryy)z8Return a + if we don't already have one, else return a .+r   rw   .)rz   )r   s    r   plus_or_dotr     s    
fjj++r   c                    | d   r9| d   }| d   s| d   r(|t        |       z  }|d| d   | d   fz  z  }| d   r|dz  }|S 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   rZ   %d.g%sr   .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 '&*<fWo)NN'? HOr   c                    | d   rF| d   }| d   s| d   r5| d   dk7  r|dz  }|t        |       z  }|d| d   | d   fz  z  }| d   r|d	z  }|S d
}| d   dk7  r|dz  }|d| d   | d   fz  z  }| d   r|d	z  }|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   rZ   r   r   .dev0r   r   r   0z+untagged.%d.g%sr   r   s     r   render_pep440_branchr     s     m-(*h8+G#F++HF:$6w#HHHHgH$ O (x'H&&*<fWo)NNN'? HOr   c                ~    t         j                  | d      }|d   t        |      dk(  rt        |d   xs 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).
    z.postr   r   ri   N)r   r}   ra   r   )vervcs     r   pep440_split_postr     sA     
3	 Ba5SW\#bejq/;;t;;r   c                    | d   r@| d   r4t        | d         \  }}|}||d|dz   | d   fz  z  }|S |d| d   z  z  }|S | d   }|S d| d   z  }|S )z_TAG[.postN.devDISTANCE] -- No -dirty.

    Exceptions:
    1: no tags. 0.post0.devDISTANCE
    r   r   z.post%d.dev%dri   z.post0.dev%dz0.post0.dev%d)r   )r   tag_versionpost_versionr   s       r   render_pep440_prer     s     m*(9&:O(P%K"H'O|a/?
AS.TTT O NfZ.@AA O	 m,H O #VJ%77Or   c                    | d   r?| d   }| d   s| d   r.|d| d   z  z  }| d   r|dz  }|t        |       z  }|d| d   z  z  }|S 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   rZ   .post%dr   g%sr   0.post%d+g%sr   r   s     r   render_pep440_postr     s     m-(*	F:$666HgG#F++Hw//H O	 z 22'?HFVG_,,Or   c                    | d   rL| d   }| d   s| d   r;|d| d   z  z  }| d   dk7  r|dz  }|t        |       z  }|d| d	   z  z  }| d   r|d
z  }|S d| d   z  }| d   dk7  r|dz  }|d| d	   z  z  }| d   r|d
z  }|S )zTAG[.postDISTANCE[.dev0]+gHEX[.dirty]] .

    The ".dev0" means not master branch.

    Exceptions:
    1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty]
    r   r   rZ   r   r   r   r   r   r   r   r   r   r   r   s     r   render_pep440_post_branchr     s     m-(*	F:$666Hh8+G#F++Hw//HgH$ O z 22(x'HFVG_,,'? HOr   c                    | d   r&| d   }| d   s| d   r|d| d   z  z  }| d   r|dz  }|S d| d   z  }| d   r|dz  }|S )zuTAG[.postDISTANCE[.dev0]] .

    The ".dev0" means dirty.

    Exceptions:
    1: no tags. 0.postDISTANCE[.dev0]
    r   r   rZ   r   r   r   r   r   s     r   render_pep440_oldr   5  sw     m-(*	F:$666HgG# O z 22'?HOr   c                d    | 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   rZ   r   r   r   s     r   render_git_describer   K  s\     m-(*	VJ%7$IIIH '?gHOr   c                Z    | 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   rZ   r   r   r   s     r   render_git_describe_longr   _  sT     m-(I
!3VG_ EEE '?gHOr   c                   | d   rd| j                  d      d| d   ddS |r|dk(  rd}|dk(  rt        |       }n|dk(  rt        |       }nt|d	k(  rt        |       }nc|d
k(  rt	        |       }nR|dk(  rt        |       }nA|dk(  rt        |       }n0|dk(  rt        |       }n|dk(  rt        |       }nt        d|z        || d   | d   d| j                  d      dS )z9Render the given version pieces into the requested style.r[   unknownr   NrX   defaultr$   zpep440-branchz
pep440-prezpep440-postzpep440-post-branchz
pep440-oldzgit-describezgit-describe-longzunknown style '%s'rZ   r
   )
rz   r   r   r   r   r   r   r   r   
ValueError)r   r   r   s      r   renderr   s  s   g %zz&1G_
 	
 EY& (	/	!'/	,	$V,	-	%f-	&	&,V4	,	$V,	.	 &v.	%	%+F3-566 !&>

6" r   c                 t   t               } | j                  }	 t        t               | j                  |      S # t
        $ r Y nw xY w	 t        j                  j                  t              }| j                  j                  d      D ]!  }t        j                  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./ry   Nz"unable to find root of source treerX   zunable to compute version)r'   r   r   r   r   r)   r]   r^   realpath__file__r   r}   rc   	NameErrorr   r   r   r   rg   )r&   r   rd   rf   r   s        r   get_versionsr     sD    ,CkkG),.#..'RR 
ww) ''--c2 	)A77??4(D	) 
"#9
 	

$S^^T7Cfcii(( *3+?+?wOO    , sF   7 	AAA"B* *B>=B>,C/ /	C;:C;?"D# #	D/.D/)r2   r   )r2   r   )r0   r   r/   r   r2   r   )NFFN)rM   	list[str]rN   r   r7   z
str | Noner   r   rO   r   r8   zdict[str, str] | Noner2   ztuple[str | None, int | None])r   r   rd   r   r   r   r2   dict[str, Any])rn   r   r2   r   )r   r   r   r   r   r   r2   r   )
r   r   rd   r   r   r   r   r   r2   r   )r   r   r2   r   )r   r   r2   ztuple[str, int | None])r   r   r   r   r2   r   )r2   r   )&
__future__r   rF   r   r]   rk   r?   r=   collections.abcr   typingr   r   r   r'   	Exceptionr)   r*   r!   r+   r3   rU   rg   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s   #
 )   	 	  
 $ 
 NI N #% $+-
( -
  !%1&1&
1& 
1& 	1&
 1& 
1& #1&hGG
G G 	GD e^, -6 eZ(GGG G 	G )GT e./BMKKK)-K7?KK 0K\0:<06:,(('T1r   