
    \Og                        S r SSKJr  SSKrSSKrSSKrSSKrSSKJ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	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  \R.                  " \5      r " S S5      rg)z3Module containing the application logic for Flake8.    )annotationsN)Sequence)checker)defaults)
exceptions)style_guide)BaseFormatter)debug)
parse_args)finder)reporterc                      \ 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)Application   z&Abstract our application into a class.c                    [         R                   " 5       U l        SU l        SU l        SU l        SU l        SU l        SU l        SU l        SU l	        SU l
        g)zInitialize our application.Nr   F)time
start_timeend_timeplugins	formatterguidefile_checker_manageroptionsresult_counttotal_result_countcatastrophic_failureselfs    \/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/flake8/main/application.py__init__Application.__init__   sb     ))+&*.2/3 <@
 =A! 37  #$ %*!    c                    U R                   (       a  gU R                  c   eU R                  R                  (       a  g[        U R                  S:  5      $ )zReturn the program exit code.   r   )r   r   	exit_zerointr   r   s    r   	exit_codeApplication.exit_code:   sD    $$||'''<<!!t((1,--r"   c                    U R                   c   eU R                  c   e[        R                  " U R                   R                  U R                  5      U l        g)z3Initialize a formatter based on the parsed options.N)r   r   r   make	reportersr   r   s    r   make_formatterApplication.make_formatterD   sB    ||'''||'''!t||'='=t||Lr"   c                    U R                   c   eU R                  c   e[        R                  " U R                  U R                   5      U l        g)zInitialize our StyleGuide.N)r   r   r   StyleGuideManagerr   r   s    r   
make_guideApplication.make_guideJ   sA    ~~)))||''' 22LL$..

r"   c                    U R                   c   eU R                  c   e[        R                  " U R                   U R                  R                  US9U l        g)z#Initialize our FileChecker Manager.N)r   r   argv)r   r   r   Managercheckersr   r   r3   s     r   make_file_checker_manager%Application.make_file_checker_managerR   sJ    zz%%%||'''$+OO

LL))%
!r"   c                   U R                   c   eU R                   R                  5          U R                   R                  5         [        R                  S5        U R                   R                  5         [        R                  " 5       U l        g! [        R                   a0  n[        [        U5      5        [        S5        SU l         SnANSnAff = f)zRun the actual checks with the FileChecker Manager.

This method encapsulates the logic to make a
:class:`~flake8.checker.Manger` instance run the checks it is
managing.
Nz5Run flake8 with greater verbosity to see more detailsTzFinished running)r   startrunr   PluginExecutionFailedprintstrr   LOGinfostopr   r   )r   plugin_faileds     r   
run_checksApplication.run_checks\   s     ((444!!'')	-%%))+
 	#$!!&&(		 // 	-#m$%IJ(,D%%	-s   B C#&CCc                   U R                   c   eU R                   R                  (       d  gU R                  c   eU R                  c   eU R                  U R                  -
  nSU4/nUR
                  n[        R                  S-    HE  nU R                  R                  U   nSU S3nU" Xe45        U S3nU" U[        XQ-  5      45        MG     U R                  c   eU R                  R                  U5        g)z9Aggregate, calculate, and report benchmarks for this run.Nzseconds elapsed)filesztotal z
 processedz processed per second)r   	benchmarkr   r   r   appendr   STATISTIC_NAMES
statisticsr&   r   show_benchmarks)r   time_elapsedrJ   add_statistic	statisticvaluetotal_descriptionper_second_descriptions           r   report_benchmarksApplication.report_benchmarksp   s    ||'''||%%((444}}(((}}t6(,78
"))!11J>I--88CE"(: >,45(1{2G%H"13u7K3LMN ? ~~)))&&z2r"   c                    [         R                  S5        U R                  c   eU R                  R                  5       nUu  U l        U l        [         R                  SU R                  U R
                  5        g)zReport all the errors found by flake8 3.0.

This also updates the :attr:`result_count` attribute with the total
number of errors, warnings, and other messages found.
zReporting errorsNz.Found a total of %d violations and reported %d)r?   r@   r   reportr   r   )r   resultss     r   report_errorsApplication.report_errors   sh     	#$((444++2245<2!2<##	
r"   c                    U R                   c   eU R                   R                  (       d  gU R                  c   eU R                  c   eU R                  R	                  U R                  R
                  5        g)z.Aggregate and report statistics from this run.N)r   rJ   r   r   show_statisticsstatsr   s    r   report_statisticsApplication.report_statistics   s^    ||'''||&&~~)))zz%%%&&tzz'7'78r"   c                ~   [        U5      u  U l        U l        U R                  R                  (       aY  [        R
                  " [        R                  U R                  5      n[        [        R                  " USSS95        [        S5      eU R                  5         U R                  5         U R                  U5        g)zInitialize the application to be run.

This finds the plugins, registers their options, and parses the
command-line arguments.
   T)indent	sort_keysr   N)r   r   r   
bug_reportr
   informationflake8__version__r=   jsondumps
SystemExitr,   r0   r7   )r   r3   r@   s      r   
initializeApplication.initialize   s     &0%5"dl<<""$$V%7%7FD$**T!t<=Q-&&t,r"   c                    U R                   c   eU R                   R                  5         U R                  5         U R                  5         U R	                  5         U R                   R                  5         g)z*Report errors, statistics, and benchmarks.N)r   r:   rW   r\   rR   rA   r   s    r   rU   Application.report   sV    ~~)))  r"   c                f    U R                  U5        U R                  5         U R                  5         g )N)ri   rC   rU   r6   s     r   _runApplication._run   s!    r"   c                8    U R                  U5        U R                  c   eU R                  R                  (       a  [        U R                  5        gg! [
         aF  n[        S5        [        R                  S5        [        R                  U5        SU l	         SnAgSnAf[        R                   a<  n[        S5        [        U5        [        R                  U5        SU l	         SnAgSnAf[        R                   a    SU l	        [        S5         gf = f)zRun our application.

This method will also handle KeyboardInterrupt exceptions for the
entirety of the flake8 application. If it sees a KeyboardInterrupt it
will forcibly clean up the :class:`~flake8.checker.Manager`.
Nz... stoppedz#Caught keyboard interrupt from userTz6There was a critical error during execution of Flake8:z"... stopped while processing files)rn   r   countr=   r   KeyboardInterruptr?   critical	exceptionr   r   ExecutionError	EarlyQuit)r   r3   excs      r   r;   Application.run   s    	)IIdO <<+++||!!d''( " ! 	-- LL>?MM#(,D%%(( 	-JK#JMM#(,D%%## 	8(,D%67	8s)   A 
D<BD62C--)DD)
r   r   r   r   r   r   r   r   r   r   N)returnNone)ry   r&   )r3   zSequence[str]ry   rz   )__name__
__module____qualname____firstlineno____doc__r    r'   r,   r0   r7   rC   rR   rW   r\   ri   rU   rn   r;   __static_attributes__ r"   r   r   r      sG    0*<.M

$(3*
 9-"
)r"   r   )r   
__future__r   argparserf   loggingr   typingr   rd   r   r   r   r   flake8.formatting.baser	   flake8.mainr
   flake8.options.parse_argsr   flake8.pluginsr   r   	getLoggerr{   r?   r   r   r"   r   <module>r      sV    9 "           0  0 ! # !~) ~)r"   