§
    øyIfè  ã                  ó‚  — d Z ddlmZ ddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZ  e
j        d¦  «        Z e
j        d	¦  «        Z e
j        d
¦  «        Zefd7d„Z G d„ de¦  «        Zd\  ZZZZZdZ e
j        d¦  «        ef e
j        d¦  «        ef e
j        d¦  «        ef e
j        d¦  «        ef e
j        d¦  «        efgZ d8d„Z!d9d „Z"ej#        fd:d$„Z$ej#        fd;d&„Z% ej&        d'¬(¦  «        d<d)„¦   «         Z'd=d*„Z(d>d,„Z)d?d/„Zd@d3„Z*d<d4„Z+dAd6„Z,dS )BzUtility methods for flake8.é    )ÚannotationsN)Ú
NamedTuple)ÚPattern)ÚSequence)Ú
exceptionsz[,\s]z[,\t\n\r\f\v]z[-_.]+ÚvalueÚstrÚregexpúPattern[str]Úreturnú	list[str]c                óš   — 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.
    c              3  ó>   K  — | ]}|                      ¦   «         V — Œd S ©N)Ústrip©Ú.0Úitems     ú@/var/www/piapp/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 © r   r   s     r   ú
<listcomp>z.parse_comma_separated_list.<locals>.<listcomp>*   s   € Ð.Ð.Ð.�T¨Ð.ˆDÐ.Ð.Ð.r   )Ú
isinstancer	   Úsplit)r   r
   Ú	separatedÚitem_gens       r   Úparse_comma_separated_listr      sZ   € õ �e�SÑ!Ô!Ð(Ð( 5Ñ(Ô(Ð(à—’˜UÑ#Ô#€IØ3Ð3¨Ð3Ñ3Ô3€HØ.Ð.˜XÐ.Ñ.Ô.Ð.r   c                  ó$   — e Zd ZU ded<   ded<   dS )Ú_Tokenr	   ÚtpÚsrcN)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__r   r   r   r!   r!   -   s"   € € € € € € Ø€G€G�GØ€H€H�H€H€Hr   r!   )ÚcodeÚfileÚcolonÚcommaÚwsÚeofz[A-Z]+[0-9]*(?=$|\s|,)z[^\s:,]+z\s*:\s*z\s*,\s*z\s+úlist[_Token]c                óÐ  — g }d}|t          | ¦  «        k     r¦t          D ]z\  }}|                     | |¦  «        }|r]|                     t	          ||                     ¦   «                              ¦   «         ¦  «        ¦  «         |                     ¦   «         } nŒ{t          d| |¦  «        ‚|t          | ¦  «        k     °¦|                     t	          t          d¦  «        ¦  «         |S )Nr   ÚunreachableÚ )
ÚlenÚ_FILE_LIST_TOKEN_TYPESÚmatchÚappendr!   Úgroupr   ÚendÚAssertionErrorÚ_EOF)r   ÚtokensÚiÚtoken_reÚ
token_namer4   s         r   Ú _tokenize_files_to_codes_mappingr>   =   sÙ   € Ø€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_úSequence[str] | strúlist[tuple[str, list[str]]]c                ó\  ‡‡‡— t          | t          ¦  «        sd                     | ¦  «        Šn| Šg Š‰                     ¦   «         s‰S  G d„ d¦  «        Šdˆˆfd„}dˆfd„}t	          ‰¦  «        D �]8}|j        t          t          hv rd	‰_        Œ ‰j	        sg|j        t          k    rd	‰_	        d	‰_        ŒF‰j        r7|j        t          k    r'‰j                             |j        ¦  «         d
‰_        Œ„ |¦   «         ‚|j        t          k    r |¦   «          Œ©‰j        r7|j        t           k    r'‰j                             |j        ¦  «         d
‰_        Œç‰j        rB|j        t          k    r2 |¦   «          ‰j                             |j        ¦  «         d
‰_        �Œ0 |¦   «         ‚‰S )a  Parse 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                  ó4   — e Zd ZU dZdZg Zded<   g Zded<   dS )ú+parse_files_to_codes_mapping.<locals>.StateTFr   Ú	filenamesÚcodesN)r$   r%   r&   Úseen_sepÚ
seen_colonrF   r'   rG   r   r   r   ÚStaterE   b   s>   € € € € € € ØˆØˆ
Ø!ˆ	Ð!Ð!Ð!Ñ!ØˆÐÐÐÑÐÐr   rJ   r   ÚNonec                 óš   •— ‰j         r&‰j        D ]} ‰                     | ‰j         f¦  «         Œd‰_        d‰_        g ‰_        g ‰_         d S )NTF)rG   rF   r5   rH   rI   )ÚfilenamerJ   Úrets    €€r   Ú_resetz,parse_files_to_codes_mapping.<locals>._reseth   s[   ø€ ØŒ;ð 	4Ø!œOð 4ð 4�Ø—
’
˜H e¤kÐ2Ñ3Ô3Ð3Ð3ØˆŒØ ˆÔØˆŒØˆŒˆˆr   úexceptions.ExecutionErrorc                 ó|   •— t          j        dt          j        ‰                      ¦   «         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_tokenq   s@   ø€ ÝÔ(ð8õ Œ˜uŸ{š{™}œ}¨fÑ5Ô5ð8ð 8ñ
ô 
ð 	
r   TF)r   rK   )r   rP   )r   r	   Újoinr   r>   r"   Ú_COMMAÚ_WSrH   rI   Ú_COLONÚ_FILErF   r5   r#   r9   Ú_CODErG   )r?   rO   rU   ÚtokenrJ   rN   r   s       @@@r   Úparse_files_to_codes_mappingr]   N   sÿ  øøø€ õ �f�cÑ"Ô"ð Ø—	’	˜&Ñ!Ô!ˆˆàˆà')€CØ�;Š;‰=Œ=ð Øˆ
ðð ð ð ð ñ ô ð ðð ð ð ð ð ð ð
ð 
ð 
ð 
ð 
ð 
õ 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úSequence[str]Úparentc                ó^   ‡— t          | t          ¦  «        s
J | ¦   «         ‚ˆfd„| D ¦   «         S )zkNormalize a list of paths relative to a parent directory.

    :returns:
        The normalized paths.
    c                ó0   •— g | ]}t          |‰¦  «        ‘ŒS r   )Únormalize_path)r   Úpr`   s     €r   r   z#normalize_paths.<locals>.<listcomp>¡   s#   ø€ Ð5Ð5Ð5¨!�N˜1˜fÑ%Ô%Ð5Ð5Ð5r   )r   Úlist)r^   r`   s    `r   Únormalize_pathsrf   ˜   s=   ø€ õ �e�TÑ"Ô"Ð)Ð) EÑ)Ô)Ð)Ø5Ð5Ð5Ð5¨uÐ5Ñ5Ô5Ð5r   Úpathc                ó  — t           j        j        }t           j        j        pd}| dk    s
|| v s|rA|| v r=t           j                             t           j                             || ¦  «        ¦  «        } |                      ||z   ¦  «        S )zINormalize a single-path.

    :returns:
        The normalized path.
    r1   ú.)Úosrg   ÚsepÚaltsepÚabspathrV   Úrstrip)rg   r`   Ú	separatorÚalternate_separators       r   rc   rc   ¤   s~   € õ ””€Iåœ'œ.Ð.¨BÐà�ŠˆØ˜ÐÐØð Ø$7¸4Ð$?Ð$?åŒw�Š�rœwŸ|š|¨F°DÑ9Ô9Ñ:Ô:ˆØ�;Š;�yÐ#6Ñ6Ñ7Ô7Ð7r   é   )Úmaxsizec                 ó†  — t           j        j                             ¦   «         } t	          j        | ¦  «        }	 t          j        |j        ¦  «        \  }}| 	                    d¦  «         t	          j
        ||¦  «                             ¦   «         S # t          t          t          f$ r |                      d¦  «        cY S w xY w)z'Get and cache it so plugins can use it.r   zutf-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   ¹AB Â,C Â?C c                 ó\   — t          t          j        t          ¦   «         ¦  «        ¦  «        S )z8Return lines of stdin split according to file splitting.)re   rx   ÚStringIOr‡   r   r   r   Ústdin_get_linesrŠ   Æ   s    € å•”�OÑ-Ô-Ñ.Ô.Ñ/Ô/Ð/r   Úboolc                ó
   — d| v S )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^   s    r   Úis_using_stdinrŽ   Ë   s   € ð �%ˆ<Ðr   rM   Úpatternsc                óB   ‡ — |sdS t          ˆ fd„|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.
    Tc              3  óB   •K  — | ]}t          j        ‰|¦  «        V — Œd S r   )Ú_fnmatchÚfnmatch)r   ÚpatternrM   s     €r   r   zfnmatch.<locals>.<genexpr>å   s0   øè è € ÐKÐK°w�xÔ ¨'Ñ2Ô2ÐKÐKÐKÐKÐKÐKr   )Úany)rM   r�   s   ` r   r“   r“   Ö   s5   ø€ ð ð ØˆtÝÐKÐKÐKÐKÀ(ÐKÑKÔKÑKÔKÐKr   Úlog_messageÚloggerúlogging.Loggerc                óB  — |sdS t           j                             | ¦  «        }|dvr+t          ||¦  «        r|                     ||ddœ¦  «         dS t           j                             | ¦  «        }t          ||¦  «        }|                     |||rdnddœ¦  «         |S )aH  Use 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>   ú..ri   r1   )rg   ÚwhetherTznot )rj   rg   Úbasenamer“   Údebugrm   )rg   r�   r–   r—   rœ   Úabsolute_pathr4   s          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ñô ð ð €Lr   c                 ó–   — d                      t          j        ¦   «         t          j        ¦   «         t          j        ¦   «         ¦  «        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Úsystemr   r   r   Úget_python_versionr¦   	  s?   € ð ×ÒÝÔ&Ñ(Ô(ÝÔÑ!Ô!ÝŒÑÔñô ð 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Ð8r   )r   r	   r
   r   r   r   )r   r	   r   r.   )r?   r@   r   rA   )r^   r_   r`   r	   r   r   )rg   r	   r`   r	   r   r	   )r   r	   )r   r   )r^   r   r   r‹   )rM   r	   r�   r_   r   r‹   )
rg   r	   r�   r_   r–   r	   r—   r˜   r   r‹   )r§   r	   r   r	   )-Ú__doc__Ú
__future__r   r“   r’   Ú	functoolsrx   Úloggingrj   r¢   Úrert   rS   rz   Útypingr   r   r   Úflake8r   ÚcompileÚCOMMA_SEPARATED_LIST_REÚLOCAL_PLUGIN_LIST_REr©   r   r!   r[   rZ   rY   rW   rX   r9   r3   r>   r]   Úcurdirrf   rc   Ú	lru_cacher‡   rŠ   rŽ   rŸ   r¦   r¬   r   r   r   ú<module>r¹      sî  ðØ !Ð !Ø "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø Ð Ð Ð Ø 	€	€	€	Ø €€€Ø 	€	€	€	Ø €€€Ø 	€	€	€	Ø 
€
€
€
Ø €€€Ø €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð à$˜"œ* XÑ.Ô.Ð Ø!�r”zÐ"2Ñ3Ô3Ð Ø&˜BœJ yÑ1Ô1Ð ð (?ð/ð /ð /ð /ð /ð(ð ð ð ð ˆZñ ô ð ð
 %KÑ !€€uˆf�f˜cØ€à€R„ZÐ)Ñ*Ô*¨EÐ2Ø€R„Z�ÑÔ˜eÐ$Ø€R„Z�
ÑÔ˜VÐ$Ø€R„Z�
ÑÔ˜VÐ$Ø€R„Z�ÑÔ˜ÐðÐ ðð ð ð ð"Gð Gð Gð GðV )+¬	ð	6ð 	6ð 	6ð 	6ð 	6ð -/¬Ið 8ð 8ð 8ð 8ð 8ð* €Ô˜QÐÑÔð	+ð 	+ð 	+ñ  Ôð	+ð0ð 0ð 0ð 0ð
ð ð ð ðLð Lð Lð Lð$ð ð ð ðB
ð 
ð 
ð 
ð9ð 9ð 9ð 9ð 9ð 9r   