ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/libfuturize/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/libfuturize/__pycache__/main.cpython-311.pyc

�

�܋f�5���dZddlmZmZmZddlZddlmZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZddlmZddlmZmZmZmZdZd
d	�ZdS)a�
futurize: automatic conversion to clean 2/3 code using ``python-future``
======================================================================

Like Armin Ronacher's modernize.py, ``futurize`` attempts to produce clean
standard Python 3 code that runs on both Py2 and Py3.

One pass
--------

Use it like this on Python 2 code:

  $ futurize --verbose mypython2script.py

This will attempt to port the code to standard Py3 code that also
provides Py2 compatibility with the help of the right imports from
``future``.

To write changes to the files, use the -w flag.

Two stages
----------

The ``futurize`` script can also be called in two separate stages. First:

  $ futurize --stage1 mypython2script.py

This produces more modern Python 2 code that is not yet compatible with Python
3. The tests should still run and the diff should be uncontroversial to apply to
most Python projects that are willing to drop support for Python 2.5 and lower.

After this, the recommended approach is to explicitly mark all strings that must
be byte-strings with a b'' prefix and all text (unicode) strings with a u''
prefix, and then invoke the second stage of Python 2 to 2/3 conversion with::

  $ futurize --stage2 mypython2script.py

Stage 2 adds a dependency on ``future``. It converts most remaining Python
2-specific code to Python 3 code and adds appropriate imports from ``future``
to restore Py2 support.

The command above leaves all unadorned string literals as native strings
(byte-strings on Py2, unicode strings on Py3). If instead you would like all
unadorned string literals to be promoted to unicode, you can also pass this
flag:

  $ futurize --stage2 --unicode-literals mypython2script.py

This adds the declaration ``from __future__ import unicode_literals`` to the
top of each file, which implicitly declares all unadorned string literals to be
unicode strings (``unicode`` on Py2).

All imports
-----------

The --all-imports option forces adding all ``__future__`` imports,
``builtins`` imports, and standard library aliases, even if they don't
seem necessary for the current state of each module. (This can simplify
testing, and can reduce the need to think about Py2 compatibility when editing
the code further.)

�)�absolute_import�print_function�unicode_literalsN)�__version__)�warn�StdoutRefactoringTool)�refactor)�lib2to3_fix_names_stage1�lib2to3_fix_names_stage2�libfuturize_fix_names_stage1�libfuturize_fix_names_stage2zlibfuturize.fixesc�t��tjd���}|�dddd���|�dd	dd
���|�dddd
���|�dddd���|�dddd���|�dddd���|�dddgd���|�ddddd d!�"��|�d#d$dgd%���|�d&d'dd(���|�d)d*dd+���|�d,d-dd.���|�d/dd0���|�d1d2dd3���|�d4d5dd6d7���|�d8d9dd:d;d<�=��|�d>d?dd@���|�dAdd:d;dB�=��i}d6}|�|��\}}|jr"dC|dD<|jst
dE��dC|_|jr|js|�	dF��|j
r|js|�	dG��|js|jrt
dH��|js|jr|�	dI��dJ|vr&dC}|jrtdKtj�L��dMS|jrdC|dN<|jrt"jnt"j}t#jdO|�P��t#jdQ��}|js|jr|j�J�d6|_ndC|_t3��}|js|jr4|�t6��|�t8��|js|jr4|�t:��|�t<��|jr|� dS��|j!rttD��dTS|j#r4tdU��tI|��D]}t|���|sdTS|s8tdVtj�L��tdWtj�L��dMSt3��}	|j%D]NJdX�vr|	� �����fdY�|D��}
tM|
��dkr>tdZd[�'d\�|
D����ztj�L��dMStM|
��dTkrtd]tj�L��dMS|	� |
dT����t3��}|j(rl|jrd^}|� |d_z��nJd`}|� |daz��|� |dbz��|� |dcz��t3��}
|j)�rJd6}|j)D]Њ�ddkrdC}�dX�vr|
� ����%�fde�|D��}
tM|
��dkr>tdZd[�'df�|
D����ztj�L��dMStM|
��dTkrtd]tj�L��dMS|
� |
dT����tM|
|	z��dTkr@tdgd[�'dh�|
|	zD����ztj�L��dMS|r|�*|
��n|
}n|�*|
��}||z|	z
}tVj,�-|��}|r]|�.tVj/��s>tVj,�0|��stVj,�1|��}|jr;|�2tVj/��}|�3di|j|��thj5j6ri}n|j
|j|dj�}totI|��|tI|
��|j|jfi|��}|j8s�|r|�9��nb	|�:||jdR|j;��n>#ttj<$r,|j;dksJ�tdktj�L��YdSwxYw|�=��t}t|j8����S)lz�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).
    zfuturize [options] file|dir ...)�usagez-Vz	--version�
store_truez%Report the version number of futurize)�action�helpz-az
--all-importsz4Add all __future__ and future imports to each modulez-1z--stage1zZModernize Python 2 code only; no compatibility with Python 3 (or dependency on ``future``)z-2z--stage2z^Take modernized (stage1) code and add a dependency on ``future`` to provide Py3 compatibility.z-0z
--both-stageszApply both stages 1 and 2z-uz--unicode-literalsz{Add ``from __future__ import unicode_literals`` to implicitly convert all unadorned string literals '' into unicode stringsz-fz--fix�appendz�Each FIX specifies a transformation; default: all.
Either use '-f division -f metaclass' etc. or use the fully-qualified module name: '-f lib2to3.fixes.fix_types -f libfuturize.fixes.fix_unicode_keep_u')r�defaultrz-jz--processes�store��intzRun 2to3 concurrently)rr�typerz-xz--nofixzPrevent a fixer from being run.z-lz--list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() 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 files.z-oz--output-dir�str�zpPut output files in this directory instead of overwriting the input files.  Requires -n. For Python >= 2.7 only.)rrrrz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z--add-suffixz�Append this string to all output filenames. Requires -n if non-empty. For Python >= 2.7 only.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 -w�-zCan't write to stdin.)�file�rz%(name)s: %(message)s)�format�levelzlibfuturize.mainNz-libfuturize.fixes.fix_unicode_literals_importrz2Available transformations for the -f/--fix option:z1At least one file or directory argument required.zUse --help to show usage.z.fix_c�d��g|],}|�d�������*|��-S�zfix_{0}��endswithr��.0�f�fixs  ��a/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/libfuturize/main.py�
<listcomp>zmain.<locals>.<listcomp>�sG���;�;�;�1��
�
�9�#3�#3�C�#8�#8�9�9�;�Q�;�;�;�zOAmbiguous fixer name. Choose a fully qualified module name instead from these:
�
c3� K�|]	}d|zV��
dS�z  N��r&�myfs  r)�	<genexpr>zmain.<locals>.<genexpr>�s&����<�<�s��s�
�<�<�<�<�<�<r+z1Unknown fixer. Use --list-fixes or -l for a list.zlibfuturize.fixes.�0fix_add__future__imports_except_unicode_literalszlibpasteurize.fixes.�fix_add_all__future__imports�&fix_add_future_standard_library_import�fix_add_all_future_builtins�allc�d��g|],}|�d�������*|��-Sr"r#r%s  �r)r*zmain.<locals>.<listcomp>�sN���C�C�C�1� !�
�
�9�+;�+;�C�+@�+@� A� A�C�Q�C�C�Cr+c3� K�|]	}d|zV��
dSr.r/r0s  r)r2zmain.<locals>.<genexpr>s&����'D�'D�s��s�
�'D�'D�'D�'D�'D�'Dr+z[Conflicting usage: the following fixers have been simultaneously requested and disallowed:
c3� K�|]	}d|zV��
dSr.r/r0s  r)r2zmain.<locals>.<genexpr>s&����N�N�3�D�3�J�N�N�N�N�N�Nr+z7Output in %r will mirror the input directory %r layout.)�
append_suffix�
output_dir�input_base_dirz+Sorry, -j isn't supported on this platform.)@�optparse�OptionParser�
add_option�
parse_argsr�writerr<�	nobackups�error�
add_suffix�no_diffs�print�sys�stderrr�verbose�logging�DEBUG�INFO�basicConfig�	getLogger�stage1�stage2�both_stages�set�updater
rrr
r�add�versionr�
list_fixes�sorted�nofix�len�join�all_importsr(�union�os�path�commonprefixr$�sep�isdir�dirname�rstrip�info�future�utils�PY26r�errors�refactor_stdinr	�	processes�MultiprocessingUnsupported�	summarizer�bool)�args�parser�flagsrj�optionsr �logger�avail_fixes�fixname�unwanted_fixes�found�extra_fixes�prefix�explicit�all_present�	requested�fixer_namesr=�extra_kwargs�rtr(s                    @r)�mainr�Ts�����
"�)J�
K�
K�
K�F�
���d�K��B��D�D�D�
���d�O�L�Q��S�S�S�
���d�J�|�w��y�y�y�
���d�J�|�{��}�}�}�
���d�O�L�6��8�8�8�
���d�0��Y��Z�Z�Z�
���d�G�H�b�i��j�j�j�
���d�M�'�1� �'>��@�@�@�
���d�I�h��<��>�>�>�
���d�N�<�;��=�=�=�
���d�.�|�M��O�O�O�
���d�K��1��3�3�3�
���l�<�@��B�B�B�
���d�I�l�6��8�8�8�
���d�M�,��D��F�F�F�
���d�N�7�� �(0��1�1�1����d�5�l�A��B�B�B����n�W�5�"�G��H�H�H�
�E��N��%�%�d�+�+�M�G�T��$��)-��%�&��}�	;��9�:�:�:���
���>�'�"3�>����<�=�=�=���;�'�"3�;����9�:�:�:��=�Q�W�-�Q��
O�P�P�P��=�0�W�.�0����.�/�/�/�
�d�{�{����=�	��)��
�;�;�;�;��1���'�"&����%�_�>�G�M�M�'�,�E���6�e�D�D�D�D�
�
�1�
2�
2�F��~�#���#��"�*�*�*�#����"����%�%�K��~�9��,�9����3�4�4�4����7�8�8�8��~�9��,�9����3�4�4�4����7�8�8�8���I����G�H�H�H����
�k�����q����
�B�C�C�C��k�*�*�	�	�G��'�N�N�N�N��	��1���
�A��:�	�	�	�	�
�)��
�;�;�;�;��q��U�U�N��}�)�)���c�>�>����s�#�#�#�#�
;�;�;�;��;�;�;�E��5�z�z�A�~�~��:��i�i�<�<�e�<�<�<�<�<�=��:�'�'�'�'��q�q��U���q����I��:�'�'�'�'��q�q����u�Q�x�(�(�(�(��%�%�K���
D��>�		D�)�F��O�O�F�N�O�
P�
P�
P�
P�,�F��O�O�F�%C�C�D�D�D��O�O�F�%M�M�N�N�N��O�O�F�%B�B�C�C�C��u�u�H��{�!0����;�	+�	+�C��e�|�|�"����c�>�>��L�L��%�%�%�%�
C�C�C�C��C�C�C�E��5�z�z�A�~�~��B�"�i�i�'D�'D�e�'D�'D�'D�D�D�E�$'�:�/�/�/�/� !�q�q��U���q����Q�#&�:�/�/�/�/� �q�q��L�L��q��*�*�*�*��x�.�(�)�)�A�-�-��?��)�)�N�N�8�n�3L�N�N�N�N�N�O��z�
#�
#�
#�
#��1�3>�L�K�%�%�h�/�/�/�H�	�	��%�%�h�/�/�	��{�*�n�<�K��W�)�)�$�/�/�N��9�~�6�6�r�v�>�>�9���
�
�n�-�-�9�
�����8�8����8�'�.�.�r�v�6�6�����M��&��	8�	8�	8��|������*1�);�&-�&8�*8����
��;�����x�(8�(8���7�#3�3�
�
��
�
�B��9���
	��������
����D�'�-��#�-�/�/�/�/���6�
�
�
��(�1�,�,�,�,��4�:=�*�F�F�F�F��q�q�	
����
	�������t�B�I�����s�$"c�7d�d)N)�__doc__�
__future__rrr�future.utilsrfrrHrKr>r^�lib2to3.mainrr�lib2to3r	�libfuturize.fixesr
rrr
�	fixer_pkgr�r/r+r)�<module>r�s��=�=�~K�J�J�J�J�J�J�J�J�J�����������
�
�
�
���������	�	�	�	�4�4�4�4�4�4�4�4�������=�=�=�=�=�=�=�=�=�=�=�=�

 �	�n �n �n �n �n �n r+

Zerion Mini Shell 1.0