AlkantarClanX12

Your IP : 3.145.59.244


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

�

�܋f�+�
�J�dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZdd	l
mZdd
l
mZddl
mZddlmZe	jd
��Ze	jd��Ze	jd��Ze	jd��Zefdedeedeefd�ZGd�de��Z d\Z!Z"Z#Z$Z%dZ&e	jd��e!fe	jd��e"fe	jd��e#fe	jd��e$fe	jd��e%fgZ'dedee fd�Z(deeeefdeeeeeffd �Z)ej*fd!eed"edeefd#�Z+ej*fd$ed"edefd%�Z,ej-d&�'��defd(���Z.deefd)�Z/d6d*eedeeee0ffd+�Z1d!eede2fd,�Z3d-ed.eede2fd/�Zd$ed.eed0ed1ej4de2f
d2�Z5defd3�Z6d4edefd5�Z7dS)7zUtility methods for flake8.�N)�Dict)�List)�
NamedTuple)�Optional)�Pattern)�Sequence)�Set)�Tuple)�Union)�
exceptionsz*^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$z[,\s]z
[,\t\n\r\f\v]z[-_.]+�value�regexp�returnc��t|t��s
J|���|�|��}d�|D��}d�|D��S)aParse a comma-separated list.

    :param value:
        String to be parsed and normalized.
    :param regexp:
        Compiled regular expression used to split the value when it is a
        string.
    :returns:
        List of values with whitespace stripped.
    c3�>K�|]}|���V��dS�N)�strip��.0�items  �]/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/flake8/utils.py�	<genexpr>z-parse_comma_separated_list.<locals>.<genexpr>/s*����3�3���
�
���3�3�3�3�3�3�c��g|]}|�|��S�rrs  r�
<listcomp>z.parse_comma_separated_list.<locals>.<listcomp>0s��.�.�.�T��.�D�.�.�.r)�
isinstance�str�split)r
r�	separated�item_gens    r�parse_comma_separated_listr"sZ���e�S�!�!�(�(�5�(�(�!����U�#�#�I�3�3��3�3�3�H�.�.�X�.�.�.�.rc�$�eZdZUeed<eed<dS)�_Token�tp�srcN)�__name__�
__module__�__qualname__r�__annotations__rrrr$r$3s"��������G�G�G�	�H�H�H�H�Hrr$)�code�file�colon�comma�ws�eofz[A-Z]+[0-9]*(?=$|\s|,)z[^\s:,]+z\s*:\s*z\s*,\s*z\s+c���g}d}|t|��kr�tD]z\}}|�||��}|r]|�t	||����������|���}n�{td||���|t|��k��|�t	td����|S)Nr�unreachable�)
�len�_FILE_LIST_TOKEN_TYPES�match�appendr$�groupr�end�AssertionError�_EOF)r
�tokens�i�token_re�
token_namer6s      r� _tokenize_files_to_codes_mappingr@Cs���
�F�	�A�
�c�%�j�j�.�.�$:�	:�	:� �H�j��N�N�5�!�,�,�E��
��
�
�f�Z������1D�1D�1F�1F�G�G�H�H�H��I�I�K�K����
�
!���q�9�9�9��c�%�j�j�.�.��M�M�&��r�"�"�#�#�#��Mr�value_c�t����t|t��sd�|���n|�g�����s�SGd�d���d
��fd�}dtjf�fd�}t
���D�]8}|jtthvrd�_
� �jsg|jtkrd�_d�_
�F�j
r7|jtkr'�j�|j��d	�_
��|���|jt"kr|�����j
r7|jt$kr'�j�|j��d	�_
��j
rB|jtkr2|���j�|j��d	�_
��0|����S)aParse a files-to-codes mapping.

    A files-to-codes mapping a sequence of values specified as
    `filenames list:codes list ...`.  Each of the lists may be separated by
    either comma or whitespace tokens.

    :param value: String to be parsed and normalized.
    �
c�L�eZdZUdZdZgZeeed<gZ	eeed<dS)�+parse_files_to_codes_mapping.<locals>.StateTF�	filenames�codesN)
r'r(r)�seen_sep�
seen_colonrFrrr*rGrrr�StaterEhsD����������
�!�	�4��9�!�!�!���t�C�y�����rrJrNc����jr&�jD]}��|�jf���d�_d�_g�_g�_dS)NTF)rGrFr7rHrI)�filenamerJ�rets ��r�_resetz,parse_files_to_codes_mapping.<locals>._resetns[����;�	4�!�O�
4�
4���
�
�H�e�k�2�3�3�3�3���� ����������rc�|��tjdtj����d������S)Nz�Expected `per-file-ignores` to be a mapping from file exclude patterns to ignore codes.

Configured `per-file-ignores` setting:

z    )r�ExecutionError�textwrap�indentr)r
s�r�_unexpected_tokenz7parse_files_to_codes_mapping.<locals>._unexpected_tokenws@����(�
8���u�{�{�}�}�f�5�5�
8�
8�
�
�	
rTF)rN)rr�joinrrrPr@r%�_COMMA�_WSrHrI�_COLON�_FILErFr7r&r;�_CODErG)rArNrS�tokenrJrMr
s    @@@r�parse_files_to_codes_mappingr[Ts	������f�c�"�"���	�	�&�!�!�����')�C��;�;�=�=���
����������������
�z�8�
�
�
�
�
�
�2�%�8�8�*�*���8���}�$�$�!�E�N�N��!�	*��x�6�!�!�#'�� �!%������
*�E�H��$5�$5���&�&�u�y�1�1�1�!&����'�'�)�)�)��x�4�����������
*�E�H��$5�$5���"�"�5�9�-�-�-�!&������
*�E�H��$5�$5��������&�&�u�y�1�1�1�!&����'�'�)�)�)��Jr�paths�parentc�^��t|t��s
J|����fd�|D��S)zkNormalize a list of paths relative to a parent directory.

    :returns:
        The normalized paths.
    c�0��g|]}t|�����Sr)�normalize_path)r�pr]s  �rrz#normalize_paths.<locals>.<listcomp>�s#���5�5�5�!�N�1�f�%�%�5�5�5r)r�list)r\r]s `r�normalize_pathsrc�s=����e�T�"�"�)�)�E�)�)�"�5�5�5�5�u�5�5�5�5r�pathc��tjj}tjjpd}|dks
||vs|rA||vr=tj�tj�||����}|�||z��S)zINormalize a single-path.

    :returns:
        The normalized path.
    r3�.)�osrd�sep�altsep�abspathrT�rstrip)rdr]�	separator�alternate_separators    rr`r`�s~�����I��'�.�.�B������������$7�4�$?�$?��w���r�w�|�|�F�D�9�9�:�:���;�;�y�#6�6�7�7�7r�)�maxsizec��tjj���}t	j|��}	t
j|j��\}}|�	d��t	j
||�����S#tttf$r|�d��cYSwxYw)z'Get and cache it so plugins can use it.rzutf-8)�sys�stdin�buffer�read�io�BytesIO�tokenize�detect_encoding�readline�seek�
TextIOWrapper�LookupError�SyntaxError�UnicodeError�decode)�stdin_value�fd�coding�_s    r�stdin_get_valuer��s����)�"�'�'�)�)�K�	��K�	 �	 �B�+��,�R�[�9�9�	���
����
�
�
����F�+�+�0�0�2�2�2����l�3�+�+�+��!�!�'�*�*�*�*�*�+���s�AB�,C�?Cc�\�ttjt������S)z8Return lines of stdin split according to file splitting.)rbru�StringIOr�rrr�stdin_get_linesr��s �����O�-�-�.�.�/�/�/r�diffc�*�|�t��}d}d}tjt��}|���D]�}|r|r|ddkr|dz}�|dd�dkr=|dd��dd��d}|dd	�d
kr
|d	d�}�ct�|��}|rQd�|���D��\}}|�J�||�	t|||z������|S)zyParse the unified diff passed on stdin.

    :returns:
        dictionary mapping file names to sets of line numbers
    Nr�-rn�z+++��	�zb/c3�<K�|]}|sdnt|��V��dS)rnN)�int)rr8s  rrz%parse_unified_diff.<locals>.<genexpr>sB����%�%�38��.���C��J�J�%�%�%�%�%�%r)r��collections�defaultdict�set�
splitlinesr�DIFF_HUNK_REGEXPr6�groups�update�range)r��number_of_rows�current_path�parsed_paths�line�
hunk_match�rows       r�parse_unified_diffr��s\���|�� � ���N��L�(3�(?��(D�(D�L����!�!�-P�-P���		��
$�4��7�c�>�>��!�#��
�����8�u�������8�>�>�$��2�2�1�5�L��B�Q�B��4�'�'�+�A�B�B�/��

�%�+�+�D�1�1�
��	P�%�%�<F�<M�<M�<O�<O�%�%�%�!�S�.� �+�+�+���&�-�-�e�C��~�9M�.N�.N�O�O�O���rc�
�d|vS)z�Determine if we're going to read from stdin.

    :param paths:
        The paths that we're going to check.
    :returns:
        True if stdin (-) is in the path, otherwise False
    r�r)r\s r�is_using_stdinr�s���%�<�rrL�patternsc�B��|sdSt�fd�|D����S)a�Wrap :func:`fnmatch.fnmatch` to add some functionality.

    :param filename:
        Name of the file we're trying to match.
    :param patterns:
        Patterns we're using to try to match the filename.
    :param default:
        The default value if patterns is empty
    :returns:
        True if a pattern matches the filename, False if it doesn't.
        ``True`` if patterns is empty.
    Tc3�B�K�|]}tj�|��V��dSr)�_fnmatch�fnmatch)r�patternrLs  �rrzfnmatch.<locals>.<genexpr>,s0�����K�K�w�x���'�2�2�K�K�K�K�K�Kr)�any)rLr�s` rr�r�s5������t��K�K�K�K�(�K�K�K�K�K�Kr�log_message�loggerc�B�|sdStj�|��}|dvr+t||��r|�||dd���dStj�|��}t||��}|�|||rdndd���|S)aHUse fnmatch to discern if a path exists in patterns.

    :param path:
        The path to the file under question
    :param patterns:
        The patterns to match the path against.
    :param log_message:
        The message used for logging purposes.
    :returns:
        True if path matches patterns, False otherwise
    F>�..rfr3)rd�whetherTznot )rgrd�basenamer��debugrj)rdr�r�r�r��
absolute_pathr6s       r�matches_filenamer�/s���"���u��w����%�%�H��{�"�"�w�x��'B�'B�"����[�8��"C�"C�D�D�D��t��G�O�O�D�)�)�M��M�8�,�,�E�
�L�L����+B�2�2�F�C�C�����Lrc��d�tj��tj��tj����S)z�Find and format the python implementation and version.

    :returns:
        Implementation name, version, and platform as a string.
    z{} {} on {})�format�platform�python_implementation�python_version�systemrrr�get_python_versionr�Ps?������&�(�(���!�!�������r�sc�\�t�d|�����S)z3Normalize a distribution name according to PEP 503.r�)�NORMALIZE_PACKAGE_NAME_RE�sub�lower)r�s r�normalize_pypi_namer�]s$��$�(�(��a�0�0�6�6�8�8�8rr)8�__doc__r�r�r��	functoolsru�loggingrgr��rerqrQrw�typingrrrrrrr	r
r�flake8r�compiler��COMMA_SEPARATED_LIST_RE�LOCAL_PLUGIN_LIST_REr�rr"r$rYrXrWrUrVr;r5r@r[�curdirrcr`�	lru_cacher�r�r�r��boolr��Loggerr�r�r�rrr�<module>r�s���!�!�������������	�	�	�	�����	�	�	�	�����	�	�	�	�
�
�
�
����������������������������������������������������������������������2�:�K�L�L��$�"�*�X�.�.��!�r�z�"2�3�3��&�B�J�y�1�1��(?�/�/��/����/�	�#�Y�/�/�/�/�(
�
�
�
�
�Z�
�
�
�
%K�!��u�f�f�c����R�Z�)�*�*�E�2��R�Z����e�$��R�Z�
���V�$��R�Z�
���V�$��R�Z���������C��D��L�����"G��(�3�-��$�%�G�	�%��T�#�Y��
� �G�G�G�G�V)+�	�	6�	6��C�=�	6�"%�	6�	�#�Y�	6�	6�	6�	6�-/�I�8�8��8�c�8�#�8�8�8�8�*���Q����	+��	+�	+�	+� ��	+�0��c��0�0�0�0�
>�>�X�c�]�>�d�3��C��=�6I�>�>�>�>�B�$�s�)�������L�c�L�X�c�]�L�t�L�L�L�L�$�

���s�m����
�N�	�

�����B
�C�
�
�
�
�9�3�9�3�9�9�9�9�9�9r