§ |<ˆjüãó�—dZddlZddlZddlZddlmZddlmZddlmZddlmZddl m Z ddl m Z dd l mZGd „d ¦«ZdS) z8The base class and interface for all formatting plugins.éN)ÚIO)ÚList)ÚOptional)ÚTuple)Ú_windows_color)Ú Statistics)Ú Violationcó—eZdZdZdejddfd„Zdd„Zdeddfd„Z deddfd „Z dd „Z dd „Z d d de efd„Zdd„Zdeeeefddfd„Zd d de efd„Zdeddfd„Zde ede eddfd„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|_|jdkp4|jdko)t j ¦«o tj |_|  ¦«dS)aMInitialize 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©©rs rrzBaseFormatter.after_init:ó€€€rrcó—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!©rrs rÚ beginningzBaseFormatter.beginning=r#rcó—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.finishedEr#rcóú—|jrstj tj |j¦«¦«}tj|d¬¦«t |jd¦«|_dSdS)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)rr.s rÚstartzBaseFormatter.startMsg€ð Œ=ð 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)aDHandle 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)rr3ÚlineÚsources rÚhandlezBaseFormatter.handleWsB€ð�{Š{˜5Ñ!Ô!ˆØ×!Ò! %Ñ(Ô(ˆØ � Š �4˜Ñ Ô Ð Ð Ð rcó —td¦«‚)aFormat 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)rr3s rr5zBaseFormatter.formatfs€õ"Ø Dñ ô ð rÚ statisticsrcó—| ¦«D]l}| |¦«}t|¦«}|j}|t d„|D¦«¦«z }| |d›d|›d|j›�¦«ŒmdS)z Format and print the statistics.c3ó$K—|] }|jV—Œ dS)N)Úcount)Ú.0Ústats rú z0BaseFormatter.show_statistics..{s$èè€ÐEÐE¨˜œÐEÐEÐEÐEÐEÐErz<5ú N)Ú error_codesÚstatistics_forÚnextr@ÚsumÚ_writeÚmessage)rr=Ú error_codeÚstats_for_error_codeÚ statisticr@s rÚshow_statisticszBaseFormatter.show_statisticsus§€à$×0Ò0Ñ2Ô2ð Hð HˆJØ#-×#<Ò#<¸ZÑ#HÔ#HÐ ÝÐ1Ñ2Ô2ˆIØ”OˆEØ •SÐEÐEÐ0DÐEÑEÔEÑEÔEÑ EˆEØ �KŠK˜5ÐFÐFÐF jÐFÐF°9Ô3DÐFÐFÑ GÔ GÐ GÐ Gð  Hð HrÚ benchmarkscó¼—dj}dj}|D]J\}}t|t¦«r|||¬¦«}n |||¬¦«}| |¦«ŒKdS)z Format and print the benchmarks.z{value:<10.3} {statistic}z{value:<10} {statistic})rMÚvalueN)r5Ú isinstanceÚintrI)rrOÚ float_formatÚ int_formatrMrQÚ benchmarks rÚshow_benchmarkszBaseFormatter.show_benchmarks~s„€ð3Ô9ˆ Ø.Ô5ˆ Ø *ð #ð #Ñ ˆI�uݘ%¥Ñ%Ô%ð KØ&˜J°À%ÐHÑHÔH� � à(˜L°9ÀEÐJÑJÔJ� Ø �KŠK˜ Ñ "Ô "Ð "Ð "ð  #ð #rcó¬—|jjr|j€dSd d„|jd|jdz …D¦«¦«}|j›|›d�S)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Úc3óFK—|]}| ¦«r|ndV—ŒdS)rDN)Úisspace)rAÚcs rrCz,BaseFormatter.show_source..¦sGèè€ð ð àð—’‘”Ð %ˆAˆA #ð ð ð ð ð ð réú^)r r6Ú physical_lineÚjoinÚ column_number)rr3Úindents rr6zBaseFormatter.show_source“s~€ðŒ|Ô'ð ¨5Ô+>Ð+FØ�2ð—’ð ð àÔ(Ð)B¨5Ô+>ÀÑ+BÐ)BÔCð ñ ô ñ ô ˆð Ô%Ð0 vÐ0Ð0Ð0Ð0rÚoutputcó"—|j�"|j ||jz¦«|j� |jjrRt jj | ¦«|j ¦«z¦«dSdS)z9Handle logic of whether to use an output file or print().N) rr7rr ÚteerrÚbufferÚencode)rrcs rrIzBaseFormatter._write®s{€à Œ>Ð %Ø ŒN× Ò  ¨$¬,Ñ!6Ñ 7Ô 7Ð 7Ø Œ>Ð ! T¤\Ô%5Ð !Ý ŒJÔ × #Ò # F§M¢M¡O¤O°d´l×6IÒ6IÑ6KÔ6KÑ$KÑ LÔ LÐ LÐ LÐ Lð "Ð !rr8r9cóf—|r| |¦«|r| |¦«dSdS)a»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)rI)rr8r9s rr7zBaseFormatter.writeµsH€ð ð Ø �KŠK˜Ñ Ô Ð Ø ð Ø �KŠK˜Ñ Ô Ð Ð Ð ð ð rcóX—|j�"|j ¦«d|_dSdS)z%Clean up after reporting is finished.N)rÚcloser"s rÚstopzBaseFormatter.stopÇs1€à Œ>Ð %Ø ŒN× Ò Ñ "Ô "Ð "Ø!ˆDŒNˆNˆNð &Ð %r)r N)r3r r N)r=rr N)Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚargparseÚ NamespacerrÚstrr&r(r2r:rr5rNrrÚfloatrWr6rIr7rkr!rrr r sÄ€€€€€ððð* Ô 2ð°tððððð*0ð0ð0ð0ð  #ð ¨$ð ð ð ð ð  ð ¨ð ð ð ð ð6ð6ð6ð6ð !ð !ð !ð !ð  ˜Kð  ¨H°S¬Mð  ð  ð  ð  ðHðHðHðHð#¨$¨u°S¸%°ZÔ/@Ô*Að#Àdð#ð#ð#ð#ð*1 ð1°¸#´ð1ð1ð1ð1ð6M˜SðM TðMðMðMðMð ˜( 3œ-ð °¸#´ð À4ð ð ð ð ð$"ð"ð"ð"ð"ð"rr )rorpr,rÚtypingrrrrÚflake8.formattingrÚflake8.statisticsrÚflake8.violationr r r!rrúrxsàðØ>Ð>Ø€€€Ø € € € Ø € € € ØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐà,Ð,Ð,Ð,Ð,Ð,Ø(Ð(Ð(Ð(Ð(Ð(Ø&Ð&Ð&Ð&Ð&Ð&ð|"ð|"ð|"ð|"ð|"ñ|"ô|"ð|"ð|"ð|"r