Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/flake8/main/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/flake8/main/__pycache__/application.cpython-311.pyc

�

�܋f�2��X�dZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZddlmZddl
Z
dd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZeje ��Z!Gd�d��Z"dS)z3Module containing the application logic for Flake8.�N)�Dict)�List)�Optional)�Sequence)�Set)�Tuple)�checker)�defaults)�
exceptions)�style_guide)�utils)�
BaseFormatter)�debug)�options)�
aggregator)�config)�manager)�finder)�reporterc
�p�eZdZdZdd�Zdeedeej	e
effd�Zdefd�Z
dejd	ed
eedeeddf
d�Zdd
�Zdejd	ede
eddfd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdeeddfd�Zdd�Zdeeddfd�Zdeeddfd�ZdS)�Applicationz&Abstract our application into a class.�returnNc��tj��|_d|_tj��|_d|_d|_d|_d|_	d|_
d|_d|_d|_d|_
i|_dS)zInitialize our application.NrF)�time�
start_time�end_timer�stage1_arg_parser�prelim_arg_parser�option_manager�plugins�	formatter�guide�file_checker_manager�result_count�total_result_count�catastrophic_failure�parsed_diff��selfs �h/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/flake8/main/application.py�__init__zApplication.__init__$s����)�+�+���)-��
�")�!:�!<�!<���@D���15���26���?C��
�@D��!�6:������#$���%*��!�13������argvc��|j�|��\}}|jr|�d|jf��||fS)a%Get preliminary options from the CLI, pre-plugin-loading.

        We need to know the values of a few standard options so that we can
        locate configuration files and configure logging.

        Since plugins aren't loaded yet, there may be some as-yet-unknown
        options; we ignore those for now, they'll be parsed later when we do
        real option parsing.

        :param argv:
            Command-line arguments passed in directly.
        :returns:
            Populated namespace and list of remaining argument strings.
        z
--output-file)r�parse_known_args�output_file�extend)r)r-�args�rests    r*�parse_preliminary_optionsz%Application.parse_preliminary_optionsKsO��"�+�<�<�T�B�B�
��d���	=��K�K��$�*:�;�<�<�<��T�z�r,c�r�|jrdS|j�J�|jjrdSt|jdk��S)zReturn the program exit code.�Nr)r&r�	exit_zero�intr$r(s r*�	exit_codezApplication.exit_codecsH���$�	��1��|�'�'�'��<�!�	.��1��t�(�1�,�-�-�-r,�cfg�cfg_dir�enable_extensions�require_pluginsc��tj||||���}tj||��}tj||��|_dS)znFind and load the plugins for this application.

        Set :attr:`plugins` based on loaded plugins.
        �r<r=N)r�parse_plugin_options�find_plugins�load_pluginsr )r)r:r;r<r=�opts�raws       r*rAzApplication.find_pluginsmsS���*���/�+�	
�
�
���!�#�t�,�,���*�3��5�5����r,c��|j�J�tjtj|j���|jg���|_tj	|j��|j�
|j��dS)z;Register options provided by plugins to our option manager.N)�version�plugin_versions�parents)r r�
OptionManager�flake8�__version__�versions_strrrr�register_default_options�register_pluginsr(s r*�register_plugin_optionsz#Application.register_plugin_options�s���|�'�'�'�%�3��&� �L�5�5�7�7��+�,�
�
�
���
	�(��)<�=�=�=���,�,�T�\�:�:�:�:�:r,c��|j�J�|j�J�tj|j|||��|_|jjrWt
jtj	|j��}ttj|dd�����td���|jjr2t�d��t#j��|_|j���D]]}t+|jdd��}|��	||j|j|jj���>#t0$r||j��Y�ZwxYwdS)z.Parse configuration files and the CLI options.N�T)�indent�	sort_keysrzHthe --diff option is deprecated and will be removed in a future version.�
parse_options)rr r�aggregate_optionsr�
bug_reportr�informationrJrK�print�json�dumps�
SystemExit�diff�LOG�warningr
�parse_unified_diffr'�all_plugins�getattr�obj�	filenames�	TypeError)r)r:r;r-�info�loadedrTs       r*�parse_configuration_and_cliz'Application.parse_configuration_and_cli�sy���"�.�.�.��|�'�'�'�!�3������	
�
����<�"�	 ��$�V�%7���F�F�D��$�*�T�!�t�<�<�<�=�=�=��Q�-�-���<��	:��K�K�"�
�
�
� %�7�9�9�D���l�.�.�0�0�
	,�
	,�F�#�F�J���F�F�M��$��
,��
��'��L��L�*������
�
,�
,�
,��
�d�l�+�+�+�+�+�
,����
	,�
	,s�
!D,�,E	�E	c�|�|j�J�|j�J�tj|jj|j��|_dS)z3Initialize a formatter based on the parsed options.N)r rr�make�	reportersr!r(s r*�make_formatterzApplication.make_formatter�s<���|�'�'�'��|�'�'�'�!��t�|�'=�t�|�L�L����r,c���|j�J�|j�J�tj|j|j��|_|jjr!|j�|j��dSdS)zInitialize our StyleGuide.N)r!rr�StyleGuideManagerr"r\�add_diff_rangesr'r(s r*�
make_guidezApplication.make_guide�ss���~�)�)�)��|�'�'�'� �2��L�$�.�
�
��
��<��	9��J�&�&�t�'7�8�8�8�8�8�	9�	9r,c�~�|j�J�|j�J�tj|j|jj���|_dS)z#Initialize our FileChecker Manager.N)rr )r"r r	�Manager�checkersr#r(s r*�make_file_checker_managerz%Application.make_file_checker_manager�sJ���z�%�%�%��|�'�'�'�$+�O��
��L�)�%
�%
�%
��!�!�!r,c��|j�J�|j�J�|jjrt|j��}|sdSnd}|j�|��	|j���nN#tj$r<}tt|����td��d|_Yd}~nd}~wwxYwt�
d��|j���tj��|_dS)z�Run the actual checks with the FileChecker Manager.

        This method encapsulates the logic to make a
        :class:`~flake8.checker.Manger` instance run the checks it is
        managing.
        Nz5Run flake8 with greater verbosity to see more detailsTzFinished running)rr#r\�sortedr'�start�runr�PluginExecutionFailedrX�strr&r]re�stoprr)r)�files�
plugin_faileds   r*�
run_checkszApplication.run_checks�s$���|�'�'�'��(�4�4�4��<��	�)/��0@�)A�)A�E��
���
��E��!�'�'��.�.�.�	-��%�)�)�+�+�+�+���/�	-�	-�	-��#�m�$�$�%�%�%��I�J�J�J�(,�D�%�%�%�%�%�%�����	-����	���#�$�$�$��!�&�&�(�(�(��	����
�
�
s�A/�/B:�>2B5�5B:c��|j�J�|jjsdS|j�J�|j�J�|j|jz
}d|fg}|j}tjdzD]I}|jj|}d|�d�}|||f��|�d�}||t||z��f���J|j
�J�|j
�|��dS)z9Aggregate, calculate, and report benchmarks for this run.Nzseconds elapsed)r{ztotal z
 processedz processed per second)r�	benchmarkr#rr�appendr
�STATISTIC_NAMES�
statisticsr8r!�show_benchmarks)r)�time_elapsedr��
add_statistic�	statistic�value�total_description�per_second_descriptions        r*�report_benchmarkszApplication.report_benchmarks�s���|�'�'�'��|�%�	��F��(�4�4�4��}�(�(�(��}�t��6��(�,�7�8�
�"�)�
�!�1�J�>�	O�	O�I��-�8��C�E� >�� >� >� >���M�,�e�4�5�5�5�(1�%H�%H�%H�"��M�1�3�u�|�7K�3L�3L�M�N�N�N�N��~�)�)�)���&�&�z�2�2�2�2�2r,c���t�d��|j�J�|j���}|\|_|_t�d|j|j��dS)z�Report all the errors found by flake8 3.0.

        This also updates the :attr:`result_count` attribute with the total
        number of errors, warnings, and other messages found.
        zReporting errorsNz.Found a total of %d violations and reported %d)r]rer#�reportr%r$)r)�resultss  r*�
report_errorszApplication.report_errorssy��	���#�$�$�$��(�4�4�4��+�2�2�4�4��5<�2����!2����<��#���	
�	
�	
�	
�	
r,c��|j�J�|jjsdS|j�J�|j�J�|j�|jj��dS)z.Aggregate and report statistics from this run.N)rr�r!r"�show_statistics�statsr(s r*�report_statisticszApplication.report_statisticss_���|�'�'�'��|�&�	��F��~�)�)�)��z�%�%�%���&�&�t�z�'7�8�8�8�8�8r,c���|�|��\}}tj|j|j��tj|j|j|j���\}}|�	|||j
|j���|���|�
|||��|���|���|���dS)z�Initialize the application to be run.

        This finds the plugins, registers their options, and parses the
        command-line arguments.
        )r�extra�isolatedr?N)r4rJ�configure_logging�verboser0r�load_config�
append_configr�rAr<r=rOrgrkrors)r)r-�prelim_opts�remaining_argsr:r;s      r*�
initializezApplication.initializes���'+�&D�&D�T�&J�&J�#��^�� ��!4�k�6M�N�N�N��)��%��+� �)�
�
�
���W�	
�����)�;�'�7�		�	
�	
�	
�	
�$�$�&�&�&��(�(��g�~�F�F�F��������������&�&�(�(�(�(�(r,c���|j�J�|j���|���|���|���|j���dS)z*Report errors, statistics, and benchmarks.N)r!rvr�r�r�rzr(s r*r�zApplication.report:st���~�)�)�)����������������� � � ���� � � ���������r,c��|�|��|���|���dS)N)r�r}r�)r)r-s  r*�_runzApplication._runCs5������������������
�
�
�
�
r,c�H�	|�|��|j�J�|jjrt|j��dSdS#t
$rU}td��t�d��t�|��d|_	Yd}~dSd}~wtj$rJ}td��t|��t�|��d|_	Yd}~dSd}~wtj$rd|_	td��YdSwxYw)z�Run our application.

        This method will also handle KeyboardInterrupt exceptions for the
        entirety of the flake8 application. If it sees a KeyboardInterrupt it
        will forcibly clean up the :class:`~flake8.checker.Manager`.
        Nz... stoppedz#Caught keyboard interrupt from userTz6There was a critical error during execution of Flake8:z"... stopped while processing files)
r�r�countrXr$�KeyboardInterruptr]�critical�	exceptionr&r�ExecutionError�	EarlyQuit)r)r-�excs   r*rwzApplication.runHsV��	)��I�I�d�O�O�O��<�+�+�+��|�!�
)��d�'�(�(�(�(�(�
)�
)��!�	-�	-�	-��-� � � ��L�L�>�?�?�?��M�M�#����(,�D�%�%�%�%�%�%�%������(�	-�	-�	-��J�K�K�K��#�J�J�J��M�M�#����(,�D�%�%�%�%�%�%�%������#�	8�	8�	8�(,�D�%��6�7�7�7�7�7�7�	8���s*�A�
D!�A
B�D!�0?C5�5(D!� D!)rN)�__name__�
__module__�__qualname__�__doc__r+rryr�argparse�	Namespacerr4r8r9�configparser�RawConfigParserrrArOrgrkrorsr}r�r�r�r�r�r�rw�r,r*rr!s>������0�0�%3�%3�%3�%3�N��S�M��	�x�!�4��9�,�	-�����0.�3�.�.�.�.�6�
�
)�6��6�
$�C�=�6�"�#��
6�
�6�6�6�6�*
;�
;�
;�
;�),�
�
)�),��),��3�i�	),�

�),�),�),�),�VM�M�M�M�	9�	9�	9�	9�
�
�
�
�$�$�$�$�63�3�3�3�*
�
�
�
� 9�9�9�9�)�x��}�)��)�)�)�)�:������#���4�����
)���
�)�$�)�)�)�)�)�)r,r)#r�r�r�rY�loggingr�typingrrrrrrrJr	r
rrr
�flake8.formatting.baser�flake8.mainrr�flake8.optionsrrr�flake8.pluginsrr�	getLoggerr�r]rr�r,r*�<module>r�s���9�9���������������������������������������������������������
�
�
�
�������������������������������0�0�0�0�0�0�������������%�%�%�%�%�%�!�!�!�!�!�!�"�"�"�"�"�"�!�!�!�!�!�!�#�#�#�#�#�#��g���!�!��@)�@)�@)�@)�@)�@)�@)�@)�@)�@)r,

Hacked By AnonymousFox1.0, Coded By AnonymousFox