
    (ph              	          S SK r S SKr S SKrS SKrS SKrS SKJrJ	r	J
r
JrJrJr  S\	\/\4   S\\   S\\\   \\   4   4S jr " S S	\R                   5      r\" 5       S
.S\R$                  S\R$                  4S jjr\S:X  Ga>  \ R*                  " SS9r\R/                  SSSSSS9  \R/                  SSSSSS9  \R1                  5       r\R$                  " \R4                  5      r\R$                  " \R6                  5      r\R9                  5       (       d'  \" S\ S3\R<                  S9  \R>                  " S5        \R9                  5       (       d'  \" S\ S3\R<                  S9  \R>                  " S5        \R@                  " \5      (       a'  \" S\ S 3\R<                  S9  \R>                  " S5        \" \\5        gg! \ a	    \" S5      ef = f)!    Nz@Run `python -m pip install "libcst >= 0.2.5"` to install libcst.)AnyCallableDictListSequenceTuple	predicateiteratorreturnc                 v    / / 4nU H&  nU[        U " U5      5         R                  U5        M(     US   US   4$ )z!A stable, out-of-place partition.   r   )intappend)r	   r
   resultsis       a/var/www/html/venv/lib/python3.13/site-packages/../../../bin/fixup_firestore_admin_v1_keywords.py	partitionr      sH    
 2hGIaL!"))!,  1:wqz!!    c            	          \ rS rSr% Sr\\   \S'   0 SS_SS_SS	_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS S S!S"S#S$S%.Er\	\\\   4   \S&'   S'\
R                  S(\
R                  S)\
R                  4S* jrS+rg,)-firestore_adminCallTransformer-   )retrytimeoutmetadataCTRL_PARAMSbulk_delete_documents)namecollection_idsnamespace_idscreate_backup_schedule)parentbackup_schedulecreate_database)r!   databasedatabase_idcreate_index)r!   indexdelete_backup)r   delete_backup_scheduledelete_database)r   etagdelete_indexexport_documents)r   r   output_uri_prefixr   snapshot_time
get_backupget_backup_scheduleget_database	get_field	get_indeximport_documents)r   r   input_uri_prefixr   list_backups)r!   filterlist_backup_schedules)r!   )r!   show_deleted)r!   r8   	page_size
page_token)r!   r%   backupencryption_config)r"   update_mask)r$   r?   )fieldr?   )list_databaseslist_fieldslist_indexesrestore_databaseupdate_backup_scheduleupdate_databaseupdate_fieldMETHOD_TO_PARAMSoriginalupdatedr   c                 @  ^   UR                   R                  R                  nT R                  U   n[        S UR                  5      u  pV[        S U 5       5      (       a  U$ [        U 4S jU5      u  pgUS [        U5       U[        U5      S  pUR                  S [        UT R                  5       5       5        [        R                  " [        R                  " [        XEU-   5       V	V
s/ s H[  u  p[        R                   " [        R"                  " SR%                  U	5      5      [        R&                  " U
R                  S95      PM]     sn
n	5      [        R(                  " S5      S9nUR+                  U/U-   S	9$ ! [        [
        4 a    Us $ f = fs  sn
n	f )
Nc                 6    [        U R                  5      (       + $ N)boolkeyword)as    r   <lambda>;firestore_adminCallTransformer.leave_Call.<locals>.<lambda>T   s    tAII+>r   c              3   R   #    U  H  oR                   R                  S :H  v   M     g7f)requestN)rO   value).0ks     r   	<genexpr><firestore_adminCallTransformer.leave_Call.<locals>.<genexpr>U   s     <Vyy)+Vs   %'c                 J   > U R                   R                  TR                  ;  $ rM   )rO   rU   r   )rP   selfs    r   rQ   rR   Z   s    aiiooT-=-==r   c              3      #    U  H8  u  p[         R                  " UR                  [         R                  " US 9S9v   M:     g7f)rU   rU   rO   N)cstArgrU   Name)rV   rP   ctrls      r   rX   rY   _   s2      L*Jwq 77#((:NO*Js   A Az'{}'r]   rT   r^   )args)funcattrrU   rH   AttributeErrorKeyErrorr   rc   anylenextendzipr   r_   r`   r   DictElementSimpleStringformatElementra   with_changes)r[   rI   rJ   keykword_paramsrc   kwargsctrl_kwargs	ctrl_argsr   argrequest_args   `           r   
leave_Call)firestore_adminCallTransformer.leave_CallJ   s   	--$$**C005L !!>M<V<<<N'=

 1L 12D\9J9K4Li L*-i9I9I*JL 	L gg(( "%\&=!AC "BID $$V]]4%89 #))  "BC D HHY'
 ##, $ 
 	
C ) 	N	*Cs   /F .A"FFF N)__name__
__module____qualname____firstlineno__r   r   str__annotations__rH   r   r_   CallCSTNoderx   __static_attributes__rz   r   r   r   r   -   s>   >Ks>/!N/ "A/ 	B/ 	-	/
 	/ 	!*/ 	-/ 	
/ 	o/ 	j/ 	z/ 	
/ 	Z/ 	Z/ 	]/  	.!/" 	 #/$ 7HIV"F821/d3c
?+ 6'
388 '
chh '
3;; '
r   r   )transformerin_dirout_dirc                   S [         R                  " U 5       5       nU H  n[        US5       nUR                  5       nSSS5        [        R
                  " W5      nUR                  U5      nUR                  UR                  U 5      5      n	U	R                  R                  SSS9  [        U	S5       nUR                  UR                  5        SSS5        M     g! , (       d  f       N= f! , (       d  f       M  = f)zDuplicate the input dir to the output dir, fixing file method calls.

Preconditions:
* in_dir is a real directory
* out_dir is a real, empty directory
c              3      #    U  Hm  u  pnU  H`  n[         R                  R                  U5      S    S:X  d  M+  [        R                  " [         R                  R                  X5      5      v   Mb     Mo     g7f)r   z.pyN)ospathsplitextpathlibPathjoin)rV   root_filesfs        r   rX   fix_files.<locals>.<genexpr>   s^      -NDUA"''**1-a0E9 	,RWW\\$*++ 	,-s
   3A7>A7rNT)parentsexist_okw)r   walkopenreadr_   parse_modulevisitjoinpathrelative_tor!   mkdirwritecode)
r   r   r   
pyfile_genfpathr   srctreerJ   updated_paths
             r   	fix_filesr   t   s     ggfoJ %&&(C  $**[) ''(9(9&(AB!!$!> ,$GGGLL! %$  %$s   C5C/
C,	/
C>	__main__a  Fix up source that uses the firestore_admin client library.

The existing sources are NOT overwritten but are copied to output_dir with changes made.

Note: This tool operates at a best-effort level at converting positional
      parameters in client method calls to keyword based parameters.
      Cases where it WILL FAIL include
      A) * or ** expansion in a method call.
      B) Calls via function or method alias (includes free function calls)
      C) Indirect or dispatched calls (e.g. the method is looked up dynamically)

      These all constitute false negatives. The tool will also detect false
      positives when an API method shares a name with another method.
)descriptionz-dz--input-directoryT	input_dirz6the input directory to walk for python files to fix up)requireddesthelpz-oz--output-directory
output_dirz5the directory to output files fixed via un-flatteningzinput directory 'z&' does not exist or is not a directory)filezoutput directory 'z' is not empty)!argparser   libcstr_   ImportErrorr   systypingr   r   r   r   r   r   rN   r   CSTTransformerr   r   r   r{   ArgumentParserparseradd_argument
parse_argsrc   r   r   is_dirprintstderrexitlistdirrz   r   r   <module>r      s  "  	Z  
 ? ?"t$"sm" 49d3i "D
S%7%7 D
V /0	 "LL "\\ "F z$$F E   D   DT^^,Idoo.J	{*PQ	
 	 ,RS	
 		zz* N;	
 	i$m E  Z
X
YYZs   G G