Hacked By AnonymousFox

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

�

�܋f0H����dZddlmZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZddlmZmZdd	lmZddlZddlZdd
lmZedee��Zgd�ZGd
�de��Zeddddd��eddddd��eddddd��eddd d!d"��ed#d$d%d&d'��ed(d)d*d+d,��gZd-�eD��ZdVd3�Z	dWdXd:�Z ej!ej"ej#ej$ej%ej&ej'd;�Z(ed<�d=D����Z)ej*d>ej+�?��Z,dYd@�Z-dZdD�Z.d[dF�Z/d\dG�Z0edH�I��d[dJ���Z1d]dM�Z2d^dO�Z3GdP�dQej4��Z5d_dU�Z6dS)`a2Unicode and some other ASCII characters can be used to create programs that run
much different compared to what a human reader would expect from them.

PEP 672 lists some examples.
See: https://www.python.org/dev/peps/pep-0672/

The following checkers are intended to make users are aware of these issues.
�)�annotationsN)�OrderedDict)�Iterable)�	lru_cache)�detect_encoding)�
NamedTuple�TypeVar)�nodes)�checkers�_StrLike)
u‪u‫u‬u‭u‮u⁦u⁧u⁨u⁩u‏c�V�eZdZUdZded<ded<ded<ded<ded<dd	�Zdd
�ZdS)
�_BadCharz/Representation of an ASCII char considered bad.�str�name�	unescaped�escaped�code�	help_text�returnc�(�d|j�d|j�d�S)z0Used for the detailed error message description.zInvalid unescaped character z, use "z
" instead.)rr��selfs �h/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/checkers/unicode.py�descriptionz_BadChar.descriptionCs.��
-�4�9�
-�
-��L�
-�
-�
-�	
�c��d|j��S)z2Used to generate the human readable error message.zinvalid-character-)rrs r�
human_codez_BadChar.human_codeJs��/�D�I�/�/�/rN)rr)�__name__�
__module__�__qualname__�__doc__�__annotations__rr�rrrr:sq�������9�9�
�I�I�I��N�N�N��L�L�L�
�I�I�I��N�N�N�
�
�
�
�0�0�0�0�0�0rr�	backspace�z\b�E2510zUMoves the cursor back, so the character after it will overwrite the character before.zcarriage-return�
z\r�E2511z]Moves the cursor to the start of line, subsequent characters overwrite the start of the line.�sub�z\x1A�E2512zcCtrl+Z "End of text" on Windows. Some programs (such as type) ignore the rest of the file after it.�esc�z\x1B�E2513zNCommonly initiates escape codes which allow arbitrary control of the terminal.�nul�z\0�E2514zMostly end of input for python.zzero-width-spaceu​z\u200B�E2515z9Invisible space character could hide real code execution.c��i|]
}|j|��Sr#)r)�.0�chars  r�
<dictcomp>r6�s��D�D�D�$����D�D�Dr�line�codecrr�intc��t|t��r%t||���|d��}n|}|�d��}||kr|�d��}t|��S)z?Get the length of a string like line as displayed in an editor.�replace�
r')�
isinstance�bytes�_remove_bom�decode�rstrip�len)r7r8�decoded�strippeds    r�_line_lengthrE�ss���$������d�E�*�*�1�1�%��C�C������~�~�d�#�#�H��7����?�?�4�(�(���x�=�=�r��search_dict�dict[_StrLike, _BadChar]�new_line�byte_str_length�dict[int, _BadChar]c�p�i}|���D]�\}}||vr�
|jdkr+|�|��rt|��d|zz
}nd}d}|�||��}	|	dkr>|	|krt|	|z��}
|||
<|	dz}|�||��}	|	dk�>��|S)z�Get all occurrences of search dict keys within line.

    Ignores Windows end of line and can handle bytes as well as string.
    Also takes care of encodings for which the length of an encoded code point does not
    default to 8 Bit.
    r'�NrrF)�itemsr�endswithrB�findr9)r7rGrIrJ�result�
search_forr5�
ignore_pos�start�pos�cols           r�_map_positions_to_resultrW�s���#%�F�'�-�-�/�/�/�/��
�D��T�!�!���>�T�!�!�d�m�m�H�&=�&=�!��T���Q��%8�8�J�J��J����i�i�
�E�*�*���A�g�g��j� � ��#��/�0�0��"��s���!�G�E��)�)�J��.�.�C�
�A�g�g���Mr)�utf-8�utf-16�utf-32�utf-16le�utf-16be�utf-32le�utf-32bec#�4K�|]}t||fV��dS�N)�UNICODE_BOMS)r4r8s  r�	<genexpr>rb�sB����"�"�	��%��%� �"�"�"�"�"�"r)r]r^rXr[r\z%utf[ -]?(8|16|32)[ -]?(le|be|)?(sig)?)�flagsc�\�t�d|�����S)zDMake sure the codec name is always given as defined in the BOM dict.zutf-\1\2)�UTF_NAME_REGEX_COMPILEDr)�lower�r8s r�_normalize_codec_namerh�s$��"�&�&�{�E�:�:�@�@�B�B�Br�encodedr>�encodingc��|tvr|St|}|�|��r|t|��d�S|S)z$Remove the bom if given from a line.N)ra�
startswithrB)rirj�boms   rr?r?�sL���|�#�#���
�x�
 �C����#���#��s�3�x�x�z�z�"�"��Nr�stringc�H�t|�|��|��S)z#Encode a string but remove the BOM.)r?�encode�rnrjs  r�_encode_without_bomrr�s���v�}�}�X�.�.��9�9�9rc�b�|�d��rdS|�d��rdSdS)z6Return how many byte are usually(!) a character point.rZ�rYrMrF�rlrgs r�_byte_to_str_lengthrv�s=������!�!���q�����!�!���q��1ri�)�maxsizec�"�t||��S)z3A cached version of encode used for search pattern.)rrrqs  r�_cached_encode_searchry�s���v�x�0�0�0r�steam�Iterable[bytes]c#�K�|�d��s|�d��s
|Ed{V��dSd�d�|D����}td|��}d}	|�||��}|dkr|||t	|��z�V�n||d�r||d�V�dS|t	|��z}�d)z�Handle line ending for UTF16 and UTF32 correctly.

    Currently, Python simply strips the required zeros after 
 after the
    line ending. Leading to lines that can't be decoded properly
    rYrZNrc3�K�|]}|V��dSr`r#)r4r7s  rrbz,_fix_utf16_32_line_stream.<locals>.<genexpr>s"����2�2�D�4�2�2�2�2�2�2rr<r)rl�joinryrPrB)rzr8�contentrIrTrUs      r�_fix_utf16_32_line_streamr��s�������H�%�%�(�e�.>�.>�x�.H�.H�(������������(�(�2�2�E�2�2�2�2�2��(��u�5�5����
	(��,�,�x��/�/�C��a�x�x��e�c�C��M�M�&9�9�:�:�:�:�:��5�6�6�?�*�!�%�&�&�/�)�)�)����#�h�-�-�'�E�
	(r�
first_linec��t���D]\}}|�|��r|cS�td���)aTry to extract the codec (unicode only) by checking for the BOM.

    For details about BOM see https://unicode.org/faq/utf_bom.html#BOM

    Args:
        first_line: the first line of a file

    Returns:
        a codec name

    Raises:
        ValueError: if no codec was found
    z-No BOM found. Could not detect Unicode codec.)�BOM_SORTED_TO_CODECrNrl�
ValueError)r�rmr8s   r�extract_codec_from_bomr�sX��*�/�/�1�1���
��U�� � ��%�%�	��L�L�L�	��D�
E�
E�Erc��eZdZdZdZdddd�d�eD���Zed!d���Zed!d
���Z	e
d"d���Zed#d���Zd$d�Z
d%d�Zd%d�Zd&d�Zd S)'�UnicodeCheckera�Check characters that could be used to hide bad code to humans.

    This includes:

    - Bidirectional Unicode (see https://trojansource.codes/)

    - Bad ASCII characters (see PEP672)

        If a programmer requires to use such a character they should use the escaped
        version, that is also much easier to read and does not depend on the editor used.

    The Checker also includes a check that UTF-16 and UTF-32 are not used to encode
    Python files.

    At the time of writing Python supported only UTF-8. See
    https://stackoverflow.com/questions/69897842/ and https://bugs.python.org/issue1503789
    for background.
    �unicode_checker)z?UTF-16 and UTF-32 aren't backward compatible. Use UTF-8 instead�invalid-unicode-codecz�For compatibility use UTF-8 instead of UTF-16/UTF-32. See also https://bugs.python.org/issue1503789 for a history of this issue. And https://softwareengineering.stackexchange.com/questions/102205/ for some possible problems when using UTF-16 for instance.)z_Contains control characters that can permit obfuscated code executed differently than displayed�bidirectional-unicodeabidirectional unicode are typically not displayed characters required to display right-to-left (RTL) script (i.e. Chinese, Japanese, Arabic, Hebrew, ...) correctly. So can you trust this code? Are you sure it displayed correctly in all editors? If you did not write it or your language is not RTL, remove the special characters, as they could be used to trick you into executing code, that does something else than what it looks like.
More Information:
https://en.wikipedia.org/wiki/Bidirectional_text
https://trojansource.codes/)z2PEP8 recommends UTF-8 as encoding for Python files�bad-file-encodingzsPEP8 recommends UTF-8 default encoding for Python files. See https://peps.python.org/pep-0008/#source-file-encoding)�E2501�E2502�C2503c�v�i|]6}|j|���|���|jf��7Sr#)rrrr)r4�bad_chars  rr6zUnicodeChecker.<dictcomp>nsU��
�
�
��
�M��$�$�&�&��#�#�%�%��"��
�
�
rr8rr�boolc�V�|�d��p|�d��S)NrYrZrurgs r�_is_invalid_codecz UnicodeChecker._is_invalid_codecxs)������)�)�G�U�-=�-=�h�-G�-G�Grc�,�|�d��S)N�utfrurgs r�_is_unicodezUnicodeChecker._is_unicode|s������&�&�&rr7r>rKc	��	|�|d���}t}t||d��S#t$r�|}i}tD]K}tjt��5||t|j|��<ddd��n#1swxYwY�Lt||td|��t|�����cYSwxYw)z�Find all matches of BAD_CHARS within line.

        Args:
            line: the input
            codec: that will be used to convert line/or search string into

        Return:
            A dictionary with the column offset and the BadASCIIChar
        �strict)�errorsr<N)rJ)
r@�BAD_ASCII_SEARCH_DICTrW�UnicodeDecodeError�	BAD_CHARS�
contextlib�suppressryrrv)�clsr7r8�line_searchrG�line_search_byte�search_dict_byter5s        r�_find_line_matchesz!UnicodeChecker._find_line_matches�s2��	��+�+�e�H�+�=�=�K�/�K�+�K��d�K�K�K��!�	�	�	� $��68��!�
�
���(�);�<�<����%�-�d�n�e�D�D���������������������
,� � �%�d�E�2�2� 3�E� :� :�	���
�
�
�	���s3�.1�0C�!B�:C�B
�
C�
B
�2C�C�stream�
io.BytesIO�tuple[str, int]c�D�	t|j��\}}t|��pd}nf#t$rY}|�d��	t|�����}d}n#t$r}||�d}~wwxYwYd}~nd}~wwxYwt|��|fS)a�Determine the codec from the given stream.

        first tries https://www.python.org/dev/peps/pep-0263/
        and if this fails also checks for BOMs of UTF-16 and UTF-32
        to be future-proof.

        Args:
            stream: The byte stream to analyse

        Returns: A tuple consisting of:
                  - normalized codec name
                  - the line in which the codec was found

        Raises:
            SyntaxError: if failing to detect codec
        rFrN)r�readlinerB�SyntaxError�seekr�r�rh)r�r8�lines�codec_definition_line�e�ves      r�_determine_codeczUnicodeChecker._determine_codec�s���$	 �+�6�?�;�;�L�E�5�%(��J�J�O�!�!�!���	 �	 �	 �
�K�K��N�N�N�
 �.�v���/@�/@�A�A��()�%�%���
 �
 �
 ��R������
 ����&�%�%�%�%�����	 ����%�U�+�+�-B�B�Bs8�(+�
B�B	�#A/�.B	�/
B�9A<�<B�B	�	Br�r9�Nonec��|dkrEd}|�|��rd}|�|||tjjdd���dSdS)zCheck validity of the codec.rXr�r�N�r7�
end_lineno�
confidence�
col_offset�end_col_offset)r��add_message�pylint�
interfaces�HIGH)rr8r��msgs    r�_check_codeczUnicodeChecker._check_codec�sv���G���%�C��%�%�e�,�,�
.�-������+�0�!�,�1��#�
�	
�	
�	
�	
�	
�	�r�linenoc��|�||��}|���D]\\}}|�|���||tjj|dz|t|j��zdz����]dS)zLook for chars considered bad.rFr�N)	r�rNr�rr�r�r�rBr)rr7r�r8�matchesrVr5s       r�_check_invalid_charsz#UnicodeChecker._check_invalid_chars�s����)�)�$��6�6�� �����
	�
	�I�C��������!�!��!�!�,�1���7�"�S���%8�%8�8�1�<�
�	
�	
�	
�	
�
	�
	rc���|�|��sdStD]O}t||��|vr;|�d||dt	||��t
jj���dS�PdS)z2Look for Bidirectional Unicode, if we use unicode.Nr�r)r7r�r�r�r�)r��BIDI_UNICODEryr�rEr�r�r�)rr7r�r8�	dangerouss     r�_check_bidi_charsz UnicodeChecker._check_bidi_chars�s�������&�&�	��F�%�	�	�I�$�Y��6�6�$�>�>�
� � �+� �%� !�#/��e�#<�#<�%�0�5�!�������'?�	�	r�node�nodes.Modulec��|���5}|�|��\}}|�||��|�d��t	t||��d���D]I\}}|dkrt
||��}|�|||��|�|||���J	ddd��dS#1swxYwYdS)z3Perform the actual check by checking module stream.rrF)rTN)	r�r�r�r��	enumerater�r?r�r�)rr�r�r8�
codec_liner�r7s       r�process_modulezUnicodeChecker.process_modules3��
�[�[�]�]�
	?�f� $� 5� 5�f� =� =��E�:����e�Z�0�0�0��K�K��N�N�N�!*�)�&�%�8�8��!�!�!�
?�
?�����Q�;�;�&�t�U�3�3�D��&�&�t�V�U�;�;�;��)�)�$���>�>�>�>�

?�
	?�
	?�
	?�
	?�
	?�
	?�
	?�
	?�
	?�
	?�
	?�
	?����
	?�
	?�
	?�
	?�
	?�
	?s�B-C�C�CN)r8rrr�)r7r>r8rrrK)r�r�rr�)r8rr�r9rr�)r7r>r�r9r8rrr�)r�r�rr�)rrr r!rr��msgs�staticmethodr�r��classmethodr�r�r�r�r�r�r#rrr�r�-sA��������&�D�
�
�*
�G3�3�V
�
�&�

�
�
�W3�D�j�H�H�H��\�H��'�'�'��\�'��!�!�!��[�!�F�&C�&C�&C��\�&C�P����"
�
�
�
�����4?�?�?�?�?�?rr��linter�pylint.lint.PyLinterr�c�J�|�t|����dSr`)�register_checkerr�)r�s r�registerr�s$��
���N�6�2�2�3�3�3�3�3r)r7rr8rrr9)rF)
r7rrGrHrIrrJr9rrK)r8rrr)rir>rjrrr>)rnrrjrrr>)r8rrr9)rzr{r8rrr{)r�r>rr)r�r�rr�)7r!�
__future__r�codecsr��io�re�collectionsr�collections.abcr�	functoolsr�tokenizer�typingrr	�astroidr
�pylint.interfacesr��pylint.lintrrr>rr�rr�r�rErW�BOM_UTF8�	BOM_UTF16�	BOM_UTF32�BOM_UTF16_LE�BOM_UTF16_BE�BOM_UTF32_LE�BOM_UTF32_BErar��compile�
IGNORECASErerhr?rrrvryr�r��BaseRawFileCheckerr�r�r#rr�<module>r�s���
��#�"�"�"�"�"�
�
�
�
�����	�	�	�	�	�	�	�	�#�#�#�#�#�#�$�$�$�$�$�$�������$�$�$�$�$�$�&�&�&�&�&�&�&�&����������������������7�:�s�E�*�*��
����*0�0�0�0�0�z�0�0�0�.
�H���
��
 �
	�	�
�H���
��
%�
	�	�
�H�
����
-�
	�	�
�H�
����
�
	�	�
�H�
��
��)���
�H�	����C���a9
�	�tE�D�)�D�D�D������&�	#�#�#�#�#�N�_������#��#��#��#����"�k�"�"�K�"�"�"����%�"�*�+�2�=�����
C�C�C�C�
����:�:�:�:�

�
�
�
���4����1�1�1���1�
(�(�(�(�<F�F�F�F�*i?�i?�i?�i?�i?�X�0�i?�i?�i?�X4�4�4�4�4�4r

Hacked By AnonymousFox1.0, Coded By AnonymousFox