Hacked By AnonymousFox

Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/__pycache__/main.cpython-312.opt-2.pyc

�

6�fN.���	ddlmZmZddlZddlZddlZddlZddlZddlZddl	m
Z
d�ZGd�de
j�Z
d�Zd
d	�Zy)�)�with_statement�print_functionN�)�refactorc	�|�	|j�}|j�}tj||||ddd��S)Nz
(original)z(refactored)�)�lineterm)�
splitlines�difflib�unified_diff)�a�b�filenames   �3/opt/alt/python312/lib64/python3.12/lib2to3/main.py�
diff_textsrs>��/�	����A�	����A�����1�h�� ,�n�)+�-�-�c�:��eZdZ		d�fd�	Zd�Z�fd�Zd�Z�xZS)�StdoutRefactoringToolc	����	||_||_|r2|jtj�s|tjz
}||_||_||_tt|�+|||�y�N)�	nobackups�
show_diffs�endswith�os�sep�_input_base_dir�_output_dir�_append_suffix�superr�__init__)
�self�fixers�options�explicitrr�input_base_dir�
output_dir�
append_suffix�	__class__s
         �rr zStdoutRefactoringTool.__init__$sf���	�$#���$����.�"9�"9�"�&�&�"A��b�f�f�$�N�-���%���+���
�#�T�3�F�G�X�Nrc��|jj|||f�|jj|g|��i|��yr)�errors�append�logger�error)r!�msg�args�kwargss    r�	log_errorzStdoutRefactoringTool.log_errorAs9�������C��v�.�/�������#�/��/��/rc���|}|jrw|j|j�rAtjj|j|t
|j�d�}ntd|�d|j����|jr||jz
}||k7rhtjj|�}tjj|�s|rtj|�|jd||�|jsQ|dz}tjj|�r	tj|�	tj"||�t$t&|�R}|||||�|jst+j,|�||k7rt+j,||�yy#t $r|jd|�Y��wxYw#t $r|jd||�Y��wxYw)Nz	filename z( does not start with the input_base_dir zWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r�
startswithrr�path�join�len�
ValueErrorr�dirname�isdir�makedirs�log_messager�lexists�remove�OSError�renamerr�
write_file�shutil�copymode)
r!�new_textr�old_text�encoding�
orig_filenamer&�backup�writer(s
         �rr@z StdoutRefactoringTool.write_fileEs���� �
�����"�"�4�#7�#7�8��7�7�<�<��(8�(8�(0��T�5I�5I�1J�1K�(L�N��!�)1�4�3G�3G�"I�J�J������+�+�+�H��H�$�������2�J��7�7�=�=��,�����J�'����:�M�%�
'��~�~���&�F��w�w���v�&�G��I�I�f�%�
L��	�	�(�F�+��+�T�=��
�h��(�H�5��~�~��O�O�F�H�-��H�$��O�O�M�8�4�%���G��$�$�%=�v�F�G���
L�� � �!8�(�F�K�
L�s$�G�G%�G"�!G"�%H�Hc��|r|jd|�y|jd|�|jrst|||�}	|j�F|j5|D]
}t	|��t
jj�ddd�y|D]
}t	|��yy#1swYyxYw#t$rtd|�d��YywxYw)NzNo changes to %sz
Refactored %szcouldn't encode z's diff for your terminal)
r;rr�output_lock�print�sys�stdout�flush�UnicodeEncodeError�warn)r!�old�newr�equal�
diff_lines�lines       r�print_outputz"StdoutRefactoringTool.print_outputls�������/��:����_�h�7����'��S�(�;�
���'�'�3�!�-�-�/�(2�� %�d��)3��J�J�,�,�.�/�/�
%/�D�!�$�K�%/��/�/��*���"�%�&���s6�B4�1B(�B4�B4�(B1�-B4�1B4�4C�C)rrr)�__name__�
__module__�__qualname__r r1r@rV�
__classcell__)r(s@rrrs%����BD�O�:0�%5�Nrrc�@�td|��tj��y)Nz	WARNING: ��file)rKrL�stderr)r.s rrPrP�s��	�3�
 �s�z�z�2rc
���	tjd��}|jdddd��|jdd	d
gd��|jd
ddddd��|jddd
gd��|jdddd��|jdddd��|jdddd��|jd d!dd"��|jd#dd$��|jd%d&dd'��|jd(d)dd*d+��|jd,d-dd.d/d0�1�|jd2d3dd4��|jd5dd.d/d6�1�d*}i}|j|�\}}|jr#d7|d8<|j
st
d9�d7|_|jr|js|jd:�|jr|js|jd;�|j
s|jrt
d<�|j
s|jr|jd=�|jr3td>�tj��D]
}t|��|sy?|s7td@t j"�A�tdBt j"�A�yCdD|vr*d7}|j
rtdEt j"�A�yC|j$rd7|dF<|j&rd7|dG<|j(rt*j,nt*j.}t+j0dH|�I�t+j2dJ�}t5tj6���}	t5�fdK�|j8D��}
t5�}|j:rHd*}|j:D]!}
|
dLk(rd7}�|j=�dMz|
z��#|r|	j?|�n|}n|	j?|�}|jA|
�}tBjDjG|�}|r]|jItBjJ�s>tBjDjM|�stBjDjO|�}|jr<|jQtBjJ�}|jSdN|j|�tUtW|�|tW|�|j|j||j|j�O�}|jXsV|r|j[�n3	|j||j
|j\|j^�|jc�tetg|jX��S#tj`$rtdPt j"�A�YywxYw)QNz2to3 [options] file|dir ...)�usagez-dz--doctests_only�
store_truezFix up doctests only)�action�helpz-fz--fixr+z1Each FIX specifies a transformation; default: all)rb�defaultrcz-jz--processes�storer�intzRun 2to3 concurrently)rbrd�typercz-xz--nofixz'Prevent a transformation from being runz-lz--list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-ez--exec-functionz/Modify the grammar so that exec() is a functionz-vz	--verbosezMore verbose loggingz
--no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz--nobackupsFz&Don't write backups for modified filesz-oz--output-dir�strrzXPut output files in this directory instead of overwriting the input files.  Requires -n.)rbrgrdrcz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z--add-suffixzuAppend this string to all output filenames. Requires -n if non-empty.  ex: --add-suffix='3' will generate .py3 files.T�write_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.r\zUse --help to show usage.��-zCan't write to stdin.r�
exec_functionz%(name)s: %(message)s)�format�levelzlib2to3.mainc3�.�K�|]}�dz|z���y�w)�.fix_N�)�.0�fix�	fixer_pkgs  �r�	<genexpr>zmain.<locals>.<genexpr>�s�����L�s��W�,�s�2�L�s��allrpz7Output in %r will mirror the input directory %r layout.)r%r&r'z+Sorry, -j isn't supported on this platform.)4�optparse�OptionParser�
add_option�
parse_argsrirHrPr&rr-�
add_suffix�no_diffs�
list_fixesrKr�get_all_fix_namesrLr^rrl�verbose�logging�DEBUG�INFO�basicConfig�	getLogger�set�get_fixers_from_package�nofixrs�add�union�
differencerr4�commonprefixrrr9r8�rstrip�infor�sortedr*�refactor_stdin�
doctests_only�	processes�MultiprocessingUnsupported�	summarizerf�bool)rtr/�parserr��flagsr#�fixnamernr,�avail_fixes�unwanted_fixesr$�all_presentrs�	requested�fixer_namesr%�rts`                 r�mainr��s`�����
"�
"�)F�
G�F�
���d�-�l�1��3�
���d�G�H�b�N��P�
���d�M�'�1� �'>��@�
���d�I�h��D��F�
���d�N�<�;��=�
���d�.�|�M��O�
���d�-�l�L��N�
���d�K��1��3�
���l�<�@��B�
���d�I�l�6��8�
���d�M�,��C��E�
���d�N�7�� �(N��O����d�5�l�A��B����n�W�5�"�G��H��N��E��%�%�d�+�M�G�T��$�$�)-��%�&��}�}��9�:���
����'�"3�"3����<�=����'�"3�"3����9�:��=�=�W�-�-��
O�P��=�=�W�.�.����.�/����
�B�C��1�1�)�<�G��'�N�=����
�A��
�
�S�
�)��
�
�;��
�d�{����=�=��)��
�
�;�����"&�������!%��o��%�_�_�G�M�M�'�,�,�E����6�e�D�
�
�
�~�
.�F��h�6�6�y�A�B�K��L�g�m�m�L�L�N��u�H��{�{����;�;�C��e�|�"�����Y��0�3�6�7�	�
4?�K�%�%�h�/�H�	��%�%�h�/�	��&�&�~�6�K��W�W�)�)�$�/�N��~�6�6�r�v�v�>����
�
�n�-�������8�����'�.�.�r�v�v�6�����M��&�&��	8�	��;����x�(8����7�#3�#3�3�)��)�)�!�,�,�
.�B��9�9������
����D�'�-�-��1F�1F�#�-�-�/�	�����t�B�I�I������6�6�
��C��:�:�'��	
�s�;2V�.W�Wr)�
__future__rrrLrrr�rArwrrr�MultiprocessRefactoringToolrrPr�rqrr�<module>r�sI���6�
�	���
���-�e�H�@�@�e�N3�L r

Hacked By AnonymousFox1.0, Coded By AnonymousFox