ó
    áÅŸg¼  ã                  óp   • S r SSKJr  SSKrSSKrSSKrSSKJr  SSKJ	r	  SSK
Jr  SSKJr   " S S	5      rg)
z8The base class and interface for all formatting plugins.é    )ÚannotationsN)ÚIO)Ú_windows_color)Ú
Statistics)Ú	Violationc                  óš   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jrSS jrSS jrSS jrSrg)ÚBaseFormatteré   aö  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.
c                ó:  • Xl         UR                  U l        SU l        SU l        UR
                  S:H  =(       dK    UR
                  S:H  =(       a5    [        R                  R                  5       =(       a    [        R                  U l        U R                  5         g)a  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)ÚoptionsÚoutput_fileÚfilenameÚ	output_fdÚnewlineÚcolorÚsysÚstdoutÚisattyr   Úterminal_supports_colorÚ
after_init)Úselfr   s     ÚW/var/www/blue/EV-Temp_rev04/venv/lib/python3.13/site-packages/flake8/formatting/base.pyÚ__init__ÚBaseFormatter.__init__$   sw   € ð ŒØ×+Ñ+ˆŒØ)-ˆŒØˆŒØ—]‘] hÑ.÷ 
Ø�M‰M˜VÑ#÷ 7Ü—
‘
×!Ñ!Ó#÷7ä×6Ñ6ð 	Œ
ð
 	�‰Õó    c                ó   • g)z!Initialize the formatter further.N© ©r   s    r   r   ÚBaseFormatter.after_init9   ó   � r   c                ó   • g)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   Ú	beginningÚBaseFormatter.beginning<   r#   r   c                ó   • g)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   ÚfinishedÚBaseFormatter.finishedD   r#   r   c                ó  • U R                   (       aw  [        R                  R                  [        R                  R	                  U R                   5      5      n[        R
                  " USS9  [        U R                   S5      U l        gg)zmPrepare 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   r0   s     r   ÚstartÚBaseFormatter.startL   sS   € ð
 �=�=Ü—g‘g—o‘o¤b§g¡g§o¡o°d·m±mÓ&DÓEˆGÜ�KŠK˜¨$Ò/Ü! $§-¡-°Ó5ˆD�Nð r   c                ój   • U R                  U5      nU R                  U5      nU R                  X#5        g)a  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   ÚerrorÚlineÚsources       r   ÚhandleÚBaseFormatter.handleV   s.   € ð �{‰{˜5Ó!ˆØ×!Ñ! %Ó(ˆØ�
‰
�4Õ r   c                ó   • [        S5      e)zÛ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   r:   s     r   r7   ÚBaseFormatter.formate   s   € ô "ØDó
ð 	
r   c                óô   • UR                  5        Hd  nUR                  U5      n[        U5      nUR                  nU[	        S U 5       5      -  nU R                  US SU SUR                   35        Mf     g)z Format and print the statistics.c              3  ó6   #   • U H  oR                   v •  M     g 7f)N)Úcount)Ú.0Ústats     r   Ú	<genexpr>Ú0BaseFormatter.show_statistics.<locals>.<genexpr>z   s   é € ÐEÑ0D¨ŸžÒ0Dùs   ‚z<5Ú N)Úerror_codesÚstatistics_forÚnextrD   ÚsumÚ_writeÚmessage)r   Ú
statisticsÚ
error_codeÚstats_for_error_codeÚ	statisticrD   s         r   Úshow_statisticsÚBaseFormatter.show_statisticst   sv   € à$×0Ñ0Ö2ˆJØ#-×#<Ñ#<¸ZÓ#HÐ ÜÐ1Ó2ˆIØ—O‘OˆEØ”SÑEÑ0DÓEÓEÑEˆEØ�K‰K˜5 ˜* A j \°°9×3DÑ3DÐ2EÐFÖGò 3r   c                ó°   • SR                   nSR                   nU H8  u  pE[        U[        5      (       a  U" XES9nOU" XES9nU R                  U5        M:     g)z Format and print the benchmarks.z{value:<10.3} {statistic}z{value:<10} {statistic})rS   ÚvalueN)r7   Ú
isinstanceÚintrN   )r   Ú
benchmarksÚfloat_formatÚ
int_formatrS   rW   Ú	benchmarks          r   Úshow_benchmarksÚBaseFormatter.show_benchmarks}   sT   € ð 3×9Ñ9ˆØ.×5Ñ5ˆ
Û *ÑˆIÜ˜%¤×%Ñ%Ù&°ÑH‘	á(°9ÑJ�	Ø�K‰K˜	Ö"ò !+r   c                óÚ   • U R                   R                  (       a  UR                  c  gSR                  S UR                  SUR                  S-
    5       5      nUR                   U S3$ )a“  Show the physical line generating the error.

This also adds an indicator for the particular part of the line that
is reported as generating the problem.

:param error:
    This will be an instance of
    :class:`~flake8.violation.Violation`.
:returns:
    The formatted error string if the user wants to show the source.
    If the user does not want to show the source, this will return
    ``None``.
NÚ c              3  óR   #   • U H  nUR                  5       (       a  UOS v •  M      g7f)rI   N)Úisspace)rE   Úcs     r   rG   Ú,BaseFormatter.show_source.<locals>.<genexpr>¥   s&   é € ð 
áC�ð —‘—‘‰A #Ô%ÚCùs   ‚%'é   Ú^)r   r8   Úphysical_lineÚjoinÚcolumn_number)r   r:   Úindents      r   r8   ÚBaseFormatter.show_source’   so   € ð �|‰|×'×'¨5×+>Ñ+>Ñ+FØð —‘ñ 
à×(Ñ(Ð)B¨5×+>Ñ+>ÀÑ+BÑCó
ó 
ˆð ×%Ñ%Ð& v h¨aÐ0Ð0r   c                ób  • U R                   b'  U R                   R                  XR                  -   5        U R                   b  U R                  R                  (       aS  [
        R                  R                  R                  UR                  5       U R                  R                  5       -   5        gg)z9Handle logic of whether to use an output file or print().N)	r   r9   r   r   Úteer   r   ÚbufferÚencode)r   Úoutputs     r   rN   ÚBaseFormatter._write­   sp   € à�>‰>Ñ%Ø�N‰N× Ñ  ¯,©,Ñ!6Ô7Ø�>‰>Ñ! T§\¡\×%5×%5Ü�J‰J×Ñ×#Ñ# F§M¡M£O°d·l±l×6IÑ6IÓ6KÑ$KÕLð &6r   c                óf   • U(       a  U R                  U5        U(       a  U R                  U5        gg)as  Write the line either to the output file or stdout.

This handles deciding whether to write to a file or print to standard
out for subclasses. Override this if you want behaviour that differs
from the default.

:param line:
    The formatted string to print or write.
:param source:
    The source code that has been formatted and associated with the
    line of output.
N)rN   )r   r;   r<   s      r   r9   ÚBaseFormatter.write´   s'   € ö Ø�K‰K˜ÔÞØ�K‰K˜Õð r   c                ób   • U R                   b"  U R                   R                  5         SU l         gg)z%Clean up after reporting is finished.N)r   Úcloser!   s    r   ÚstopÚBaseFormatter.stopÆ   s(   € à�>‰>Ñ%Ø�N‰N× Ñ Ô"Ø!ˆD�Nð &r   )r   r   r   r   r   N)r   zargparse.NamespaceÚreturnÚNone)ry   rz   )r   Ústrry   rz   )r:   r   ry   rz   )r:   r   ry   ú
str | None)rP   r   ry   rz   )rZ   zlist[tuple[str, float]]ry   rz   )rq   r{   ry   rz   )r;   r|   r<   r|   ry   rz   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r&   r)   r4   r=   r7   rT   r^   r8   rN   r9   rw   Ú__static_attributes__r    r   r   r	   r	      sJ   † ñô*ô*0ôôô6ô!ô
ôHô#ô*1ô6Mô ÷$"r   r	   )r�   Ú
__future__r   Úargparser.   r   Útypingr   Úflake8.formattingr   Úflake8.statisticsr   Úflake8.violationr   r	   r    r   r   Ú<module>r‰      s,   ðÙ >Ý "ã Û 	Û 
Ý å ,Ý (Ý &÷|"ò |"r   