§
    øyIfò  ã                  óÊ   — d Z ddlm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 ddlmZ  ej        e¦  «        Zd	Z G d
„ d¦  «        Z G d„ d¦  «        Zdd„ZdS )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.
é    )ÚannotationsN)ÚAny)Úexpand_paths)Úbase)Úapplication)Ú
parse_args)Úget_style_guidec                  ó:   — e Zd ZdZdd„Zedd„¦   «         Zdd„ZdS )Ú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   úapp.ApplicationÚreturnÚNonec                ó`   — |j         €J ‚|| _        |j         | _        | j        j        | _        dS )zlInitialize the Report for the user.

        .. warning:: This should not be instantiated by users.
        N)ÚguideÚ_applicationÚ_style_guideÚstatsÚ_stats©Úselfr   s     úE/var/www/piapp/venv/lib/python3.11/site-packages/flake8/api/legacy.pyÚ__init__zReport.__init__'   s7   € ð
 Ô Ð,Ð,Ð,Ø'ˆÔØ'Ô-ˆÔØÔ'Ô-ˆŒˆˆó    Úintc                ó   — | j         j        S )z"Return the total number of errors.)r   Úresult_count©r   s    r   Útotal_errorszReport.total_errors1   s   € ð Ô Ô-Ð-r   Ú	violationÚstrú	list[str]c                ó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)r   r   s     r   Úget_statisticszReport.get_statistics6   s3   € ð
ð 
à”[×/Ò/°	Ñ:Ô:ð
ñ 
ô 
ð 	
r   N©r   r   r   r   )r   r   )r   r    r   r!   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   r,   © r   r   r   r      sf   € € € € € ðð ð.ð .ð .ð .ð ð.ð .ð .ñ „Xð.ð
ð 
ð 
ð 
ð 
ð 
r   r   c                  óz   — e Zd ZdZdd„Zed d„¦   «         Zed!d
„¦   «         Zd"d#d„Zd"d$d„Z		 d"d%d„Z
	 	 	 d&d'd„ZdS )(Ú
StyleGuideaD  Public 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   r   r   r   c                ó,   — || _         |j        | _        dS )zInitialize our StyleGuide.N)r   Úfile_checker_managerÚ_file_checker_managerr   s     r   r   zStyleGuide.__init__S   s   € à'ˆÔØ%0Ô%EˆÔ"Ð"Ð"r   úargparse.Namespacec                ó6   — | j         j        €J ‚| j         j        S )zuReturn application's options.

        An instance of :class:`argparse.Namespace` containing parsed options.
        )r   Úoptionsr   s    r   r;   zStyleGuide.optionsX   s"   € ð Ô Ô(Ð4Ð4Ð4ØÔ Ô(Ð(r   r!   c                ó@   — | j         j        €J ‚| j         j        j        S )z+Return the extra arguments passed as paths.)r   r;   Ú	filenamesr   s    r   ÚpathszStyleGuide.pathsa   s%   € ð Ô Ô(Ð4Ð4Ð4ØÔ Ô(Ô2Ð2r   Nr>   úlist[str] | Noner   c                óÌ   — | j         j        €J ‚|| j         j        _        | 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.
        )r   r;   r=   Ú
run_checksÚreport_errorsr   )r   r>   s     r   Úcheck_fileszStyleGuide.check_filesg   s_   € ð Ô Ô(Ð4Ð4Ð4Ø.3ˆÔÔ!Ô+ØÔ×$Ò$Ñ&Ô&Ð&ØÔ×'Ò'Ñ)Ô)Ð)Ý�dÔ'Ñ(Ô(Ð(r   Úfilenamer    Úparentú
str | NoneÚboolc                ó€   ‡ — dˆ fd„} ||¦  «        p,|duo( |t           j                             ||¦  «        ¦  «        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.
        Úpathr    r   rG   c                óˆ   •— t          t          | g‰j        j        ‰j        j        ‰j        j        ¬¦  «        ¦  «        }| S )N)r>   Ústdin_display_nameÚfilename_patternsÚexclude)Útupler   r;   rK   rD   rM   )rI   r>   r   s     €r   Úexcludedz%StyleGuide.excluded.<locals>.excludedƒ   sK   ø€ ÝÝØ˜&Ø'+¤|Ô'FØ&*¤lÔ&;Ø œLÔ0ð	ñ ô ñô ˆEð �9Ðr   N)rI   r    r   rG   )ÚosrI   Újoin)r   rD   rE   rO   s   `   r   rO   zStyleGuide.excludedx   sa   ø€ ð		ð 		ð 		ð 		ð 		ð 		ð ˆx˜Ñ!Ô!ð 
Ø˜$ÐÐK 8 8­B¬G¯LªL¸ÀÑ,JÔ,JÑ#KÔ#Kð	
r   Úreporterú$type[formatter.BaseFormatter] | Nonec                ó*  — |€dS t          |t          j        ¦  «        st          d¦  «        ‚ || j        ¦  «        | j        _        d| j        _        | j                             ¦   «          d| j        _        | j         	                    g ¦  «         dS )z*Set up a formatter for this run of Flake8.Nz<Report should be subclass of flake8.formatter.BaseFormatter.)
Ú
issubclassÚ	formatterÚBaseFormatterÚ
ValueErrorr;   r   r   Ú
make_guider7   Úmake_file_checker_manager)r   rR   s     r   Úinit_reportzStyleGuide.init_report’   sž   € ð
 ÐØˆFÝ˜(¥IÔ$;Ñ<Ô<ð 	Ýð2ñô ð ð '/ h¨t¬|Ñ&<Ô&<ˆÔÔ#Ø"&ˆÔÔð 	Ô×$Ò$Ñ&Ô&Ð&Ø15ˆÔÔ.ØÔ×3Ò3°BÑ7Ô7Ð7Ð7Ð7r   r   Úlinesú
Any | NoneÚ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.
        )rC   )r   rD   r\   r^   r_   s        r   Ú
input_filezStyleGuide.input_file§   s   € ð. ×Ò  
Ñ+Ô+Ð+r   r-   )r   r9   )r   r!   )N)r>   r?   r   r   )rD   r    rE   rF   r   rG   )rR   rS   r   r   )NNr   )
rD   r    r\   r]   r^   r]   r_   r]   r   r   )r.   r/   r0   r1   r   r2   r;   r>   rC   rO   r[   ra   r3   r   r   r5   r5   D   sê   € € € € € ðð ðFð Fð Fð Fð
 ð)ð )ð )ñ „Xð)ð ð3ð 3ð 3ñ „Xð3ð
)ð )ð )ð )ð )ð"
ð 
ð 
ð 
ð 
ð8 :>ð8ð 8ð 8ð 8ð 8ð0 !Ø#Ø"#ð,ð ,ð ,ð ,ð ,ð ,ð ,r   r5   Úkwargsr   r   c                 óÔ  — t          j        ¦   «         }t          g ¦  «        \  |_        |_        |j        }|                      ¦   «         D ]R\  }}	 t          ||¦  «         t          |||¦  «         Œ(# t          $ r t           
                    d|¦  «         Y ŒOw xY w|                     ¦   «          |                     ¦   «          |                     g ¦  «         t          |¦  «        S )z´Provision a StyleGuide for use.

    :param \*\*kwargs:
        Keyword arguments that provide some options for the StyleGuide.
    :returns:
        An initialized StyleGuide
    zCould not update option "%s")ÚappÚApplicationr   Úpluginsr;   ÚitemsÚgetattrÚsetattrÚAttributeErrorÚLOGÚerrorÚmake_formatterrY   rZ   r5   )rb   r   r;   ÚkeyÚvalues        r   r	   r	   Á   sò   € õ ”/Ñ#Ô#€KÝ/9¸"©~¬~Ñ,€KÔ˜Ô,ð Ô!€GØ—l’l‘n”nð ;ð ;‰
ˆˆUð	;Ý�G˜SÑ!Ô!Ð!Ý�G˜S %Ñ(Ô(Ð(Ð(øÝð 	;ð 	;ð 	;Ý�IŠIÐ4°cÑ:Ô:Ð:Ð:Ð:ð	;øøøà×ÒÑ Ô Ð Ø×ÒÑÔÐØ×)Ò)¨"Ñ-Ô-Ð-Ý�kÑ"Ô"Ð"s   Á!A3Á3%BÂB)rb   r   r   r5   )r1   Ú
__future__r   ÚargparseÚloggingÚos.pathrP   Útypingr   Úflake8.discover_filesr   Úflake8.formattingr   rV   Úflake8.mainr   rd   Úflake8.options.parse_argsr   Ú	getLoggerr.   rk   Ú__all__r   r5   r	   r3   r   r   ú<module>r{      s)  ððð ð
 #Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø €€€Ø Ð Ð Ð Ð Ð à .Ð .Ð .Ð .Ð .Ð .Ø /Ð /Ð /Ð /Ð /Ð /Ø *Ð *Ð *Ð *Ð *Ð *Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0à€gÔ˜Ñ!Ô!€ð €ð)
ð )
ð )
ð )
ð )
ñ )
ô )
ð )
ðXz,ð z,ð z,ð z,ð z,ñ z,ô z,ð z,ðz#ð #ð #ð #ð #ð #r   