HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/aigenerator/venv/bin/__pycache__/fixup_firestore_v1_keywords.cpython-312.pyc
�

�:3g?�	��ddlZddlZ	ddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
de	egefdeede
eeeeffd�ZGd�d	ej �Ze�d
�dej$dej$fd
�Zedk(�rAej*d��Zej/ddddd��ej/ddddd��ej1�Zej$ej4�Zej$ej6�Zej9�s*ede�d�ej<��ej>d�ej9�s*ede�d�ej<��ej>d�ej@e�r*ede�d �ej<��ej>d�eee�yy#e$r	ed��wxYw)!�Nz@Run `python -m pip install "libcst >= 0.2.5"` to install libcst.)�Any�Callable�Dict�List�Sequence�Tuple�	predicate�iterator�returnc�r�ggf}|D]%}|t||��j|��'|d|dfS)z!A stable, out-of-place partition.�r)�int�append)r	r
�results�is    �n/home/arjun/projects/aigenerator/venv/lib/python3.12/site-packages/../../../bin/fixup_firestore_v1_keywords.py�	partitionrsH��
�2�h�G�
����I�a�L�!�"�)�)�!�,���1�:�w�q�z�!�!�c���eZdZUdZeeed<idd�dd�dd�d	d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�Zeeeefed#<d$e	jd%e	jd&e	jfd'�Zy())�firestoreCallTransformer)�retry�timeout�metadata�CTRL_PARAMS�batch_get_documents)�database�	documents�mask�transaction�new_transaction�	read_time�batch_write)r�writes�labels�begin_transaction)r�options�commit)rr#r�create_document)�parent�
collection_id�document�document_idr�delete_document)�name�current_document�get_document)r.rrr!�list_collection_ids)r)�	page_size�
page_tokenr!�list_documents)	r)r*r2r3�order_byrrr!�show_missing�listen)r�
add_target�
remove_targetr$�partition_query)r)�structured_query�partition_countr3r2r!�rollback)rr�run_aggregation_query)r)�structured_aggregation_queryrr r!�explain_options�	run_query)r)r;rr r!r@�update_document)r+�update_maskrr/�write)r�	stream_idr#�stream_tokenr$�METHOD_TO_PARAMS�original�updatedrc�<��	|jjj}�j|}t
d�|j�\}}td�|D��r|St
�fd�|�\}}|dt|�|t|�d}}|jd�t|�j�D��tjtjt|||z�D�	�
cgc][\}	}
tj tj"dj%|	��tj&|
j�����]c}
}	�tj(d���}|j+|g|z�	�S#tt
f$r|cYSwxYwcc}
}	w)
Nc�.�t|j�S�N)�bool�keyword)�as r�<lambda>z5firestoreCallTransformer.leave_Call.<locals>.<lambda>Ls��t�A�I�I��+>rc3�NK�|]}|jjdk(���y�w)�requestN)rN�value)�.0�ks  r�	<genexpr>z6firestoreCallTransformer.leave_Call.<locals>.<genexpr>Ms����<�V��q�y�y���)�+�V�s�#%c�H��|jj�jvSrL)rNrSr)rO�selfs �rrPz5firestoreCallTransformer.leave_Call.<locals>.<lambda>Rs���a�i�i�o�o�T�-=�-=�=rc3�K�|]<\}}tj|jtj|�������>y�w)�rS�rSrNN)�cst�ArgrS�Name)rTrO�ctrls   rrVz6firestoreCallTransformer.leave_Call.<locals>.<genexpr>Ws8����L�*J�w�q�$��7�7����#�(�(��:N�O�O�*J�s�AAz'{}'rZrRr[)�args)�func�attrrSrG�AttributeError�KeyErrorrr`�any�len�extend�ziprr\r]r�DictElement�SimpleString�format�Elementr^�with_changes)rXrHrI�key�kword_paramsr`�kwargs�ctrl_kwargs�	ctrl_argsr.�arg�request_args`           r�
leave_Callz#firestoreCallTransformer.leave_CallBs����	��-�-�$�$�*�*�C��0�0��5�L�!�!>����M���f��<�V�<�<��N�'�=��
����
�1��L� 1�2�D��\�9J�9K�4L�i�����L�*-�i��9I�9I�*J�L�	L��g�g��(�(�"%�\�4�&�=�!A�C�"B�I�D�#�����$�$�V�]�]�4�%8�9����#�)�)���"B�C�D��H�H�Y�'�
���#�#����,�$�
�	
��C��)�	��N�	��*Cs�/F�*A F�F�FN)
�__name__�
__module__�__qualname__rr�str�__annotations__rGrr\�Call�CSTNoderu�rrrr-s$��>�K��s��>�/��q�/��9�/�	�6�/�	�9�	/�
	�[�/�	�9�
/�	�F�/�	�S�/�	�S�/�	�I�/�	�v�/�	�1�/�	 �"P�/�	�w�/�	�T�/� 	�P�!/��d�3��c�
�?�+��&'
�3�8�8�'
�c�h�h�'
�3�;�;�'
rr)�transformer�in_dir�out_dirc���d�tj|�D�}|D]�}t|d�5}|j�}ddd�t	j
�}|j
|�}|j|j|��}	|	jjdd��t|	d�5}|j|j�ddd���y#1swY��xYw#1swY��xYw)z�Duplicate 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
    c3��K�|]g\}}}|D]\}tjj|�ddk(r5tjtjj||�����^�iy�w)r
z.pyN)�os�path�splitext�pathlib�Path�join)rT�root�_�files�fs     rrVzfix_files.<locals>.<genexpr>xs^�����-�N�D�!�U��A�"�'�'�*�*�1�-�a�0�E�9�	���R�W�W�\�\�$��*�+��	,�-�s�A-A/�rNT)�parents�exist_ok�w)
r��walk�open�readr\�parse_module�visit�joinpath�relative_tor)�mkdirrD�code)
rr�r~�
pyfile_gen�fpathr��src�treerI�updated_paths
          r�	fix_filesr�ls���� �g�g�f�o��J���
�%��
���&�&�(�C������$���*�*�[�)���'�'��(9�(9�&�(A�B�����!�!�$��!�>��,��
$��
�G�G�G�L�L�!�%�
$��
�
��%�
$�s�C�6C)�C&	�)C2	�__main__a�Fix up source that uses the firestore 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-flatteningzinput directory 'z&' does not exist or is not a directory)�file���zoutput directory 'z' is not empty)!�argparser��libcstr\�ImportErrorr��sys�typingrrrrrrrMr�CSTTransformerrr�r�rv�ArgumentParser�parser�add_argument�
parse_argsr`r�r��is_dir�print�stderr�exit�listdirr}rr�<module>r�s��"�	�Z���
�?�?�"����t��$�"��s�m�"��4��9�d�3�i�� �"�<
�s�1�1�<
�F)�*�	 "��L�L� "�
�\�\� "�F�z��
$�X�
$�
$�
��F�������
�
E���������
�
D�������D�����T�^�^�,�I�����d�o�o�.�J�����
��	�{�*P�Q����	
�	����������
� ���,R�S����	
�	�������r�z�z�*��
� ���N�;����	
�	������
�i��$�m��u�Z�
�X�
Y�Y�Z�s�G�G