§
|<ˆjü ã ó� — d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZ dd l
mZ G d
„ d¦ « ZdS )z8The base class and interface for all formatting plugins.é N)ÚIO)ÚList)ÚOptional)ÚTuple)Ú_windows_color)Ú
Statistics)Ú Violationc ó — e Zd ZdZdej ddfd„Zdd„Zdeddfd„Z deddfd „Z
dd
„Zdd
„Zddde
e fd„Zdd„Zdeeeef ddfd„Zddde
e fd„Zdeddfd„Zde
e de
e ddfd„Zdd„ZdS )Ú
BaseFormattera" Class defining the formatter interface.
.. attribute:: options
The options parsed from both configuration files and the command-line.
.. attribute:: filename
If specified by the user, the path to store the results of the run.
.. attribute:: output_fd
Initialized when the :meth:`start` is called. This will be a file
object opened for writing.
.. attribute:: newline
The string to add to the end of a line. This is only used when the
output filename has been specified.
ÚoptionsÚreturnNc óú — || _ |j | _ d| _ d| _ |j dk p4|j dk o)t j ¦ « ot j
| _ | ¦ « dS )aM Initialize with the options parsed from config and cli.
This also calls a hook, :meth:`after_init`, so subclasses do not need
to call super to call this method.
:param options:
User specified configuration parsed from both configuration files
and the command-line interface.
Nú
ÚalwaysÚauto)r Úoutput_fileÚfilenameÚ output_fdÚnewlineÚcolorÚsysÚstdoutÚisattyr Úterminal_supports_colorÚ
after_init)Úselfr s úh/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/flake8/formatting/base.pyÚ__init__zBaseFormatter.__init__% s| € 𠈌ØÔ+ˆŒ
Ø,0ˆŒØˆŒØ”] hÒ.ð
ØŒM˜VÒ#ð
7Ý”
×!Ò!Ñ#Ô#ð
7åÔ6ð
Œ
ð
�ŠÑÔÐÐÐó c ó — dS )z!Initialize the formatter further.N© ©r s r r zBaseFormatter.after_init: ó € € € r r c ó — dS )z¼Notify the formatter that we're starting to process a file.
:param filename:
The name of the file that Flake8 is beginning to report results
from.
Nr! ©r r s r Ú beginningzBaseFormatter.beginning= r# r c ó — dS )z¼Notify the formatter that we've finished processing a file.
:param filename:
The name of the file that Flake8 has finished reporting results
from.
Nr! r% s r ÚfinishedzBaseFormatter.finishedE r# r c óú — | j rst j t j | j ¦ « ¦ « }t j |d¬¦ « t
| j d¦ « | _ dS dS )z}Prepare the formatter to receive input.
This defaults to initializing :attr:`output_fd` if :attr:`filename`
T)Úexist_okÚaN)r ÚosÚpathÚdirnameÚabspathÚmakedirsÚopenr )r r. s r ÚstartzBaseFormatter.startM sg € ð
Œ=ð 6Ý”g—o’o¥b¤g§o¢o°d´mÑ&DÔ&DÑEÔEˆGÝŒK˜¨$Ð/Ñ/Ô/Ð/Ý! $¤-°Ñ5Ô5ˆDŒNˆNˆNð 6ð 6r Úerrorr c ó† — | |¦ « }| |¦ « }| ||¦ « dS )aD Handle an error reported by Flake8.
This defaults to calling :meth:`format`, :meth:`show_source`, and
then :meth:`write`. To extend how errors are handled, override this
method.
:param error:
This will be an instance of
:class:`~flake8.violation.Violation`.
N)ÚformatÚshow_sourceÚwrite)r r3 ÚlineÚsources r ÚhandlezBaseFormatter.handleW sB € ð �{Š{˜5Ñ!Ô!ˆØ×!Ò! %Ñ(Ô(ˆØ�
Š
�4˜Ñ Ô Ð Ð Ð r c ó — t d¦ « ‚)a Format an error reported by Flake8.
This method **must** be implemented by subclasses.
:param error:
This will be an instance of
:class:`~flake8.violation.Violation`.
:returns:
The formatted error string.
z3Subclass of BaseFormatter did not implement format.)ÚNotImplementedError)r r3 s r r5 zBaseFormatter.formatf s € õ "ØDñ
ô
ð
r Ú
statisticsr c ó — | ¦ « D ]l}| |¦ « }t |¦ « }|j }|t d„ |D ¦ « ¦ « z
}| |d›d|› d|j › �¦ « ŒmdS )z Format and print the statistics.c 3 ó$ K — | ]}|j V — Œd S )N)Úcount)Ú.0Ústats r ú