ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/flake8/api/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/flake8/api/__pycache__/legacy.cpython-311.pyc

�

�܋f�����dZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddl
Z
ddlmZddl
mZdd	lmZdd
lmZeje��ZdZGd�d
��ZGd�d��Zdedefd�ZdS)z�Module containing shims around Flake8 2.x behaviour.

Previously, users would import :func:`get_style_guide` from ``flake8.engine``.
In 3.0 we no longer have an "engine" module but we maintain the API from it.
�N)�Any)�List)�Optional)�Type)�expand_paths)�base)�application)�config)�get_style_guidec�d�eZdZdZdejddfd�Zedefd���Z	de
dee
fd�ZdS)	�Reporta"Public facing object that mimic's Flake8 2.0's API.

    .. note::

        There are important changes in how this object behaves compared to
        the object provided in Flake8 2.x.

    .. warning::

        This should not be instantiated by users.

    .. versionchanged:: 3.0.0
    r	�returnNc�`�|j�J�||_|j|_|jj|_dS)zlInitialize the Report for the user.

        .. warning:: This should not be instantiated by users.
        N)�guide�_application�_style_guide�stats�_stats��selfr	s  �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/flake8/api/legacy.py�__init__zReport.__init__)s7��
� �,�,�,�'���'�-����'�-�����c��|jjS)z"Return the total number of errors.)r�result_count�rs r�total_errorszReport.total_errors3s��� �-�-r�	violationc�J�d�|j�|��D��S)z�Get the list of occurrences of a violation.

        :returns:
            List of occurrences of a violation formatted as:
            {Count} {Error Code} {Message}, e.g.,
            ``8 E531 Some error message about the error``
        c�@�g|]}|j�d|j�d|j����S)� )�count�
error_code�message)�.0�ss  r�
<listcomp>z)Report.get_statistics.<locals>.<listcomp>@sD��
�
�
���w�3�3���3�3��	�3�3�
�
�
r)r�statistics_for)rrs  r�get_statisticszReport.get_statistics8s3��
�
��[�/�/�	�:�:�
�
�
�	
r)
�__name__�
__module__�__qualname__�__doc__�app�Applicationr�property�intr�strrr)�rrr
r
s���������.�C�O�.��.�.�.�.��.�c�.�.�.��X�.�
��
��S�	�
�
�
�
�
�
rr
c�D�eZdZdZdejddfd�Zedej	fd���Z
edeefd���Z
ddeeedefd	�Zdd
edeedefd�Z	dd
eeejddfd�Z			dd
edeedeedeedef
d�ZdS)�
StyleGuideaDPublic facing object that mimic's Flake8 2.0's StyleGuide.

    .. note::

        There are important changes in how this object behaves compared to
        the StyleGuide object provided in Flake8 2.x.

    .. warning::

        This object should not be instantiated directly by users.

    .. versionchanged:: 3.0.0
    r	rNc�,�||_|j|_dS)zInitialize our StyleGuide.N)r�file_checker_manager�_file_checker_managerrs  rrzStyleGuide.__init__Us��'���%0�%E��"�"�"rc�6�|jj�J�|jjS)zuReturn application's options.

        An instance of :class:`argparse.Namespace` containing parsed options.
        )r�optionsrs rr:zStyleGuide.optionsZs"��� �(�4�4�4�� �(�(rc�@�|jj�J�|jjjS)z+Return the extra arguments passed as paths.)rr:�	filenamesrs r�pathszStyleGuide.pathscs%��� �(�4�4�4�� �(�2�2rr=c���|jj�J�||jj_|j���|j���t|j��S)a)Run collected checks on the files provided.

        This will check the files passed in and return a :class:`Report`
        instance.

        :param paths:
            List of filenames (or paths) to check.
        :returns:
            Object that mimic's Flake8 2.0's Reporter class.
        )rr:r<�
run_checks�
report_errorsr
)rr=s  r�check_fileszStyleGuide.check_filesis_��� �(�4�4�4�.3���!�+���$�$�&�&�&���'�'�)�)�)��d�'�(�(�(r�filename�parentc���dtdtf�fd�}||��p,|duo(|tj�||����S)a"Determine if a file is excluded.

        :param filename:
            Path to the file to check if it is excluded.
        :param parent:
            Name of the parent directory containing the file.
        :returns:
            True if the filename is excluded, False otherwise.
        �pathrc	���tt|g�jj�jj�jj�jj�����}|S)N)r=�stdin_display_name�filename_patterns�exclude�is_running_from_diff)�tuplerr:rGrBrI�diff)rEr=rs  �r�excludedz%StyleGuide.excluded.<locals>.excluded�sS������&�'+�|�'F�&*�l�&;� �L�0�)-��):������E��9�rN)r2�bool�osrE�join)rrBrCrMs`   rrMzStyleGuide.excludedzso���
	�3�
	�4�
	�
	�
	�
	�
	�
	��x��!�!�
��$��K�8�8�B�G�L�L���,J�,J�#K�#K�	
r�reporterc�(�|�dSt|tj��std���||j��|j_d|j_|j���d|j_|j�	��dS)z*Set up a formatter for this run of Flake8.Nz<Report should be subclass of flake8.formatter.BaseFormatter.)
�
issubclass�	formatter�
BaseFormatter�
ValueErrorr:rr�
make_guider7�make_file_checker_manager)rrQs  r�init_reportzStyleGuide.init_report�s���
���F��(�I�$;�<�<�	��2���
�'/�h�t�|�&<�&<���#�"&����	
��$�$�&�&�&�15���.���3�3�5�5�5�5�5rr�lines�expected�line_offsetc�.�|�|g��S)a�Run collected checks on a single file.

        This will check the file passed in and return a :class:`Report`
        instance.

        :param filename:
            The path to the file to check.
        :param lines:
            Ignored since Flake8 3.0.
        :param expected:
            Ignored since Flake8 3.0.
        :param line_offset:
            Ignored since Flake8 3.0.
        :returns:
            Object that mimic's Flake8 2.0's Reporter class.
        )rA)rrBrZr[r\s     r�
input_filezStyleGuide.input_file�s��.����
�+�+�+r)N)NNr)r*r+r,r-r.r/rr0�argparse�	Namespacer:rr2r=rr
rArNrMrrTrUrYrr^r3rrr5r5Fs���������F�C�O�F��F�F�F�F�
�)��+�)�)�)��X�)��3�t�C�y�3�3�3��X�3�
)�)��$�s�)�!4�)��)�)�)�)�"
�
��
�h�s�m�
�t�
�
�
�
�:=A�6�6��4�	� 7�8�9�6�
�6�6�6�6�0 $�"&�%&�,�,��,���}�,��3�-�	,�
�c�]�,�
�
,�,�,�,�,�,rr5�kwargsrc��tj��}|�g��\}}tj|j|j��tj|j|j	|j
���\}}|�|||j|j
���|���|�|||��|j}|���D]R\}}	t%||��t'|||���(#t($rt*�d|��Y�OwxYw|���|���|���t5|��S)z�Provision a StyleGuide for use.

    :param \*\*kwargs:
        Keyword arguments that provide some options for the StyleGuide.
    :returns:
        An initialized StyleGuide
    )r
�extra�isolated)�enable_extensions�require_pluginszCould not update option "%s")r.r/�parse_preliminary_options�flake8�configure_logging�verbose�output_filer
�load_config�
append_configrd�find_pluginsrerf�register_plugin_options�parse_configuration_and_clir:�items�getattr�setattr�AttributeError�LOG�error�make_formatterrWrXr5)	rar	�prelim_opts�remaining_args�cfg�cfg_dirr:�key�values	         rrr�s����/�#�#�K�"-�"G�"G��"K�"K��K��
��[�0�+�2I�J�J�J��%��!��'��%����L�C�������%�7�#�3�	�����'�'�)�)�)��+�+�C��.�I�I�I��!�G��l�l�n�n�;�;�
��U�	;��G�S�!�!�!��G�S�%�(�(�(�(���	;�	;�	;��I�I�4�c�:�:�:�:�:�	;������� � � ��������)�)�+�+�+��k�"�"�"s�#!D�%D-�,D-)r-r_�logging�os.pathrO�typingrrrrrh�flake8.discover_filesr�flake8.formattingrrT�flake8.mainr	r.�flake8.optionsr
�	getLoggerr*ru�__all__r
r5rr3rr�<module>r�sd����
������������������������������������
�
�
�
�.�.�.�.�.�.�/�/�/�/�/�/�*�*�*�*�*�*�!�!�!�!�!�!��g���!�!����)
�)
�)
�)
�)
�)
�)
�)
�X{,�{,�{,�{,�{,�{,�{,�{,�|'#�c�'#�j�'#�'#�'#�'#�'#�'#r

Zerion Mini Shell 1.0