Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/self/root/opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/main.cpython-311.pyc

�

�fN.���dZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
mZd�ZGd�dej
��Zd	�Zdd
�ZdS)z
Main program for 2to3.
�)�with_statement�print_functionN�)�refactorc	��|���}|���}tj||||ddd���S)z%Return a unified diff of two strings.z
(original)z(refactored)�)�lineterm)�
splitlines�difflib�unified_diff)�a�b�filenames   �3/opt/alt/python311/lib64/python3.11/lib2to3/main.py�
diff_textsrsF��	�����A�	�����A����1�h�� ,�n�)+�-�-�-�-�c�<��eZdZdZ	d�fd�	Zd�Z�fd�Zd�Z�xZS)�StdoutRefactoringToola2
    A refactoring tool that can avoid overwriting its input files.
    Prints output to stdout.

    Output files can optionally be written to a different directory and or
    have an extra file suffix appended to their name for use in situations
    where you do not want to replace the input files.
    rc	���||_||_|r.|�tj��s|tjz
}||_||_||_tt|���
|||��dS)aF
        Args:
            fixers: A list of fixers to import.
            options: A dict with RefactoringTool configuration.
            explicit: A list of fixers to run even if they are explicit.
            nobackups: If true no backup '.bak' files will be created for those
                files that are being refactored.
            show_diffs: Should diffs of the refactoring be printed to stdout?
            input_base_dir: The base directory for all input files.  This class
                will strip this path prefix off of filenames before substituting
                it with output_dir.  Only meaningful if output_dir is supplied.
                All files processed by refactor() must start with this path.
            output_dir: If supplied, all converted files will be written into
                this directory tree instead of input_base_dir.
            append_suffix: If supplied, all files output by this tool will have
                this appended to their filename.  Useful for changing .py to
                .py3 for example by passing append_suffix='3'.
        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
         �rrzStdoutRefactoringTool.__init__$s���(#���$����	%�.�"9�"9�"�&�"A�"A�	%��b�f�$�N�-���%���+���
�#�T�*�*�3�3�F�G�X�N�N�N�N�Nrc�l�|j�|||f��|jj|g|�Ri|��dS�N)�errors�append�logger�error)r �msg�args�kwargss    r�	log_errorzStdoutRefactoringTool.log_errorAsJ������C��v�.�/�/�/�����#�/��/�/�/��/�/�/�/�/rc���|}|jrt|�|j��r@tj�|j|t
|j��d���}ntd|�d|j�����|jr
||jz
}||krktj�	|��}tj�
|��s|rtj|��|�d||��|j
s�|dz}tj�|��r<	tj|��n&#t $r|�d|��YnwxYw	tj||��n'#t $r|�d||��YnwxYwt%t&|��j}|||||��|j
st+j||��||krt+j||��dSdS)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_fileEsd��� �
���	J��"�"�4�#7�8�8�
J��7�<�<��(8�(0��T�5I�1J�1J�1K�1K�(L�N�N���!�j�)1���4�3G�3G�"I�J�J�J���	,���+�+�H��H�$�$������2�2�J��7�=�=��,�,�
(��
(���J�'�'�'����:�M�%�
'�
'�
'��~�	L���&�F��w���v�&�&�
G�G��I�f�%�%�%�%���G�G�G��$�$�%=�v�F�F�F�F�F�G����
L��	�(�F�+�+�+�+���
L�
L�
L�� � �!8�(�F�K�K�K�K�K�
L�����+�T�2�2�=��
��h��(�H�5�5�5��~�	.��O�F�H�-�-�-��H�$�$��O�M�8�4�4�4�4�4�%�$s$�-E� E%�$E%�)E?�?!F#�"F#c���|r|�d|��dS|�d|��|jr�t|||��}	|j�U|j5|D]}t	|���t
j���ddd��n
#1swxYwYdSdS|D]}t	|���dS#t$rtd|�d���YdSwxYwdS)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�7�7���
�'��S�(�;�;�
���'�3�!�-�/�/�(2�,�,�� %�d������J�,�,�.�.�.�/�/�/�/�/�/�/�/�/�/�/����/�/�/�/�/�/�/�/�
%/�(�(�D�!�$�K�K�K�K�(�(��)�����D�"�(�(�%�&�&�&��F�F�����
�
s<�
B<�3B�B<�B�B<�B�B<�&B<�<C�C)rrr)	�__name__�
__module__�__qualname__�__doc__rr1r@rV�
__classcell__)r's@rrrs����������BD�O�O�O�O�O�O�:0�0�0�%5�%5�%5�%5�%5�N������rrc�B�td|��tj���dS)Nz	WARNING: ��file)rKrL�stderr)r.s rrPrP�s$��	�E�3�3�
 �s�z�2�2�2�2�2�2rc
���tjd���}|�dddd���|�dd	d
gd���|�d
ddddd���|�ddd
gd���|�dddd���|�dddd���|�dddd���|�d d!dd"���|�d#dd$���|�d%d&dd'���|�d(d)dd*d+���|�d,d-dd.d/d0�1��|�d2d3dd4���|�d5dd.d/d6�1��d*}i}|�|��\}}|jr"d7|d8<|jst
d9��d7|_|jr|js|�	d:��|j
r|js|�	d;��|js|jrt
d<��|js|jr|�	d=��|jr9td>��tj���D]}t|���|sd?S|s8td@t j�A��tdBt j�A��dCSdD|vr&d7}|jrtdEt j�A��dCS|jrd7|dF<|jrd7|dG<|jrt*jnt*j}t+jdH|�I��t+jdJ��}t5tj�����}	t5�fdK�|jD����}
t5��}|jrJd*}|jD]&}
|
dLkrd7}�|��dMz|
z���'|r|	�|��n|}n|	�|��}|� |
��}tBj"�#|��}|r]|�$tBj%��s>tBj"�&|��stBj"�'|��}|jr;|�(tBj%��}|�)dN|j|��tUtW|��|tW|��|j|j||j|j
�O��}|j,s�|r|�-��ng	|�||j|j.|j/��n>#tj0$r,|j/dksJ�tdPt j�A��YdSwxYw|�1��tetg|j,����S)Qz�Main program.

    Args:
        fixer_pkg: the name of a package where the fixers are located.
        args: optional; a list of command line arguments. If omitted,
              sys.argv[1:] is used.

    Returns a suggested exit status (0, 1, 2).
    z2to3 [options] file|dir ...)�usagez-dz--doctests_only�
store_truezFix up doctests only)�action�helpz-fz--fixr+z1Each FIX specifies a transformation; default: all)rc�defaultrdz-jz--processes�storer�intzRun 2to3 concurrently)rcre�typerdz-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.)rcrhrerdz-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|zV��
dS)�.fix_N�)�.0�fix�	fixer_pkgs  �r�	<genexpr>zmain.<locals>.<genexpr>�s-�����L�L�s��W�,�s�2�L�L�L�L�L�Lr�allrqz7Output 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_argsrjrHrPr%rr-�
add_suffix�no_diffs�
list_fixesrKr�get_all_fix_namesrLr_rrm�verbose�logging�DEBUG�INFO�basicConfig�	getLogger�set�get_fixers_from_package�nofixrt�add�union�
differencerr4�commonprefixrrr9r8�rstrip�infor�sortedr*�refactor_stdin�
doctests_only�	processes�MultiprocessingUnsupported�	summarizerg�bool)rur/�parserr��flagsr"�fixnameror,�avail_fixes�unwanted_fixesr#�all_presentrt�	requested�fixer_namesr$�rts`                 r�mainr��s!����
"�)F�
G�
G�
G�F�
���d�-�l�1��3�3�3�
���d�G�H�b�N��P�P�P�
���d�M�'�1� �'>��@�@�@�
���d�I�h��D��F�F�F�
���d�N�<�;��=�=�=�
���d�.�|�M��O�O�O�
���d�-�l�L��N�N�N�
���d�K��1��3�3�3�
���l�<�@��B�B�B�
���d�I�l�6��8�8�8�
���d�M�,��C��E�E�E�
���d�N�7�� �(N��O�O�O����d�5�l�A��B�B�B����n�W�5�"�G��H�H�H��N��E��%�%�d�+�+�M�G�T��$��)-��%�&��}�	;��9�:�:�:���
���>�'�"3�>����<�=�=�=���;�'�"3�;����9�:�:�:��=�Q�W�-�Q��
O�P�P�P��=�0�W�.�0����.�/�/�/����
�B�C�C�C��1�)�<�<�	�	�G��'�N�N�N�N��	��1���
�A��
�S�S�S�S�
�)��
�;�;�;�;��q�
�d�{�{����=�	��)��
�;�;�;�;��1���'�"&������&�!%��o��%�_�>�G�M�M�'�,�E���6�e�D�D�D�D�
�
�~�
.�
.�F��h�6�y�A�A�B�B�K��L�L�L�L�g�m�L�L�L�L�L�N��u�u�H��{�	0����;�	8�	8�C��e�|�|�"������Y��0�3�6�7�7�7�7�3>�L�K�%�%�h�/�/�/�H�	�	��%�%�h�/�/�	��&�&�~�6�6�K��W�)�)�$�/�/�N��9�~�6�6�r�v�>�>�9���
�
�n�-�-�9�
�����8�8����8�'�.�.�r�v�6�6�����M��&��	8�	8�	8�	��;�����x�(8�(8���7�#3�3�)��)�!�,�
.�
.�
.�B��9���
	��������
����D�'�-��1F�#�-�/�/�/�/���6�
�
�
��(�1�,�,�,�,��C��:�'�'�'�'��q�q�	
����
	�������t�B�I�����s�;'U#�#7V�Vr))rZ�
__future__rrrLrrr�rArxrrr�MultiprocessRefactoringToolrrPr�rrrr�<module>r�s�����6�5�5�5�5�5�5�5�
�
�
�
�	�	�	�	���������
�
�
�
�����������-�-�-�e�e�e�e�e�H�@�e�e�e�N3�3�3�L �L �L �L �L �L r

Hacked By AnonymousFox1.0, Coded By AnonymousFox