Hacked By AnonymousFox

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

�

�܋fB���dZddlmZddlmZddlmZddlmZddlmZddlmZGd�d	��Z	Gd
�de��Z
Gd�d
��ZdS)z&Statistic collection logic for Flake8.�)�Dict)�	Generator)�List)�
NamedTuple)�Optional)�	Violationc�j�eZdZdZd
d�Zdeefd�Zdd�Z	dd	ed
e	ede
dfd�ZdS)�
Statisticsz5Manager of aggregated statistics for a run of Flake8.�returnNc��i|_dS)z8Initialize the underlying dictionary for our statistics.N)�_store��selfs �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/flake8/statistics.py�__init__zStatistics.__init__s
��.0�����c�>�td�|jD����S)ziReturn all unique error codes stored.

        :returns:
            Sorted list of error codes.
        c��h|]	}|j��
S�)�code)�.0�keys  r�	<setcomp>z)Statistics.error_codes.<locals>.<setcomp>s��7�7�7�C�s�x�7�7�7r��sortedr
rs r�error_codeszStatistics.error_codess#���7�7�4�;�7�7�7�8�8�8r�errorrc���t�|��}||jvr"t�|��|j|<|j|���dS)z�Add the fact that the error was seen in the file.

        :param error:
            The Violation instance containing the information about the
            violation.
        N)�Key�create_fromr
�	Statistic�	increment)rrrs   r�recordzStatistics.records[���o�o�e�$�$���d�k�!�!�(�4�4�U�;�;�D�K�����C��"�"�$�$�$�$�$r�prefix�filename)r!NNc#�x��K�t��fd�|jD����}|D]}|j|V��dS)aBGenerate statistics for the prefix and filename.

        If you have a :class:`Statistics` object that has recorded errors,
        you can generate the statistics for a prefix (e.g., ``E``, ``E1``,
        ``W50``, ``W503``) with the optional filter of a filename as well.

        .. code-block:: python

            >>> stats = Statistics()
            >>> stats.statistics_for('E12',
                                     filename='src/flake8/statistics.py')
            <generator ...>
            >>> stats.statistics_for('W')
            <generator ...>

        :param prefix:
            The error class or specific error code to find statistics for.
        :param filename:
            (Optional) The filename to further filter results by.
        :returns:
            Generator of instances of :class:`Statistic`
        c3�H�K�|]}|������|V��dS�N)�matches)rrr%r$s  ��r�	<genexpr>z,Statistics.statistics_for.<locals>.<genexpr>?sJ�����!
�!
��#�+�+�f�h�*G�*G�!
��!
�!
�!
�!
�!
�!
rNr)rr$r%�matching_errors�
error_codes ``  r�statistics_forzStatistics.statistics_for&sw������2!�!
�!
�!
�!
�!
��;�!
�!
�!
�
�
��*�	*�	*�J��+�j�)�)�)�)�)�	*�	*r�rN)rrrNr()�__name__�
__module__�__qualname__�__doc__rr�strrr#rrr-rrrr
r
s�������?�?�1�1�1�1�9�T�#�Y�9�9�9�9�
%�
%�
%�
%�6:�*�*��*�%-�c�]�*�	�*�	+�*�*�*�*�*�*rr
c�`�eZdZUdZeed<eed<edd���Zdedeede	fd	�Z
d
S)rz�Simple key structure for the Statistics dictionary.

    To make things clearer, easier to read, and more understandable, we use a
    namedtuple here for all Keys in the underlying dictionary for the
    Statistics object.
    r%rrrrc�0�||j|j���S)z6Create a Key from :class:`flake8.violation.Violation`.�r%rr6��clsrs  rr zKey.create_fromQs���s�E�N���<�<�<�<rr$c�T�|j�|��o|dup
|j|kS)a�Determine if this key matches some constraints.

        :param prefix:
            The error code prefix that this key's error code should start with.
        :param filename:
            The filename that we potentially want to match on. This can be
            None to only match on error prefix.
        :returns:
            True if the Key's code starts with the prefix and either filename
            is None, or the Key's filename matches the value passed in.
        N)r�
startswithr%)rr$r%s   rr)zKey.matchesVs5���y�#�#�F�+�+�
����9��
�� 9�	
rN)rrrr)r/r0r1r2r3�__annotations__�classmethodr r�boolr)rrrrrFs����������M�M�M�

�I�I�I��=�=�=��[�=�
�c�
�X�c�]�
�t�
�
�
�
�
�
rrc
�N�eZdZdZdededededdf
d�Zed
d���Zdd�Z	dS)r!z�Simple wrapper around the logic of each statistic.

    Instead of maintaining a simple but potentially hard to reason about
    tuple, we create a class which has attributes and a couple
    convenience methods on it.
    r,r%�message�countrNc�>�||_||_||_||_dS)zInitialize our Statistic.N�r,r%r?r@)rr,r%r?r@s     rrzStatistic.__init__os$��%��� ��
������
�
�
rrrc�>�||j|j|jd���S)z>Create a Statistic from a :class:`flake8.violation.Violation`.rrB)rr%�textr7s  rr zStatistic.create_fromxs/���s��z��^��J��	
�
�
�	
rc�&�|xjdz
c_dS)zAIncrement the number of times we've seen this error in this file.�N)r@rs rr"zStatistic.increment�s���
�
�a��
�
�
�
r)rrrr!r.)
r/r0r1r2r3�intrr<r r"rrrr!r!gs������������),��7:��CF��	
������
�
�
��[�
������rr!N)r2�typingrrrrr�flake8.violationrr
rr!rrr�<module>rJs���,�,�������������������������������&�&�&�&�&�&�8*�8*�8*�8*�8*�8*�8*�8*�v
�
�
�
�
�*�
�
�
�B���������r

Hacked By AnonymousFox1.0, Coded By AnonymousFox