ó
    áÅŸg`8  ã                  ó®  • 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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r\R,                  " \5      r " S S\R2                  5      r " S S\R2                  5      r " S S\R2                  5      r      SS jr          SS jr " S S5      r " S S5      r  " S S5      r!g)z0Implementation of the StyleGuide used by Flake8.é    )ÚannotationsN)Ú	Generator)ÚSequence)Údefaults)Ú
statistics)Úutils)Úbase)Ú	Violation)Ú
StyleGuidec                  ó    • \ rS rSrSrSrSrSrg)ÚSelectedé   z<Enum representing an explicitly or implicitly selected code.zexplicitly selectedzimplicitly selected© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
ExplicitlyÚ
ImplicitlyÚ__static_attributes__r   ó    ÚS/var/www/blue/EV-Temp_rev04/venv/lib/python3.13/site-packages/flake8/style_guide.pyr   r      s   † ÙFà&€JØ&ƒJr   r   c                  ó    • \ rS rSrSrSrSrSrg)ÚIgnoredé   z;Enum representing an explicitly or implicitly ignored code.zexplicitly ignoredzimplicitly ignoredr   Nr   r   r   r   r   r      s   † ÙEà%€JØ%ƒJr   r   c                  ó    • \ rS rSrSrSrSrSrg)ÚDecisioné&   z?Enum representing whether a code should be ignored or selected.zignored errorzselected errorr   N)r   r   r   r   r   r   r   r   r   r   r   r   r   &   s   † ÙIà€GØƒHr   r   c                óX   • / U =(       d    / QU=(       d    / Qn[        [        USS95      $ ©NT)Úreverse©ÚtupleÚsorted)ÚoptionÚextendÚrets      r   Ú_explicitly_chosenr*   -   s-   € ð
 -ˆV�\�rÐ
,˜fŸl¨Ð
,€CÜ”˜ TÑ*Ó+Ð+r   c                óp   • U b  / U QU=(       d    / QnO/ UQUQU=(       d    / Qn[        [        USS95      $ r"   r$   )r'   ÚdefaultÚextended_defaultr(   r)   s        r   Ú_select_ignorer.   6   sH   € ð ÑØ(�Ð(˜&Ÿ, BÐ(‰à<�Ð<Ð*Ð<¨f¯l¸Ð<ˆÜ”˜ TÑ*Ó+Ð+r   c                  óJ   • \ 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r
g	)ÚDecisionEngineéE   z�A class for managing the decision process around violations.

This contains the logic for whether a violation should be reported or
ignored.
c                óv  • 0 U l         [        UR                  UR                  S9U l        [        UR
                  UR                  S9U l        [        UR                  SUR                  UR                  S9U l
        [        UR
                  [        R                  UR                  UR                  S9U l        g)zInitialize the engine.)r'   r(   r   )r'   r,   r-   r(   N)Úcacher*   ÚselectÚextend_selectÚselected_explicitlyÚignoreÚextend_ignoreÚignored_explicitlyr.   Úextended_default_selectÚselectedr   ÚIGNOREÚextended_default_ignoreÚignored)ÚselfÚoptionss     r   Ú__init__ÚDecisionEngine.__init__L   s�   € à*,ˆŒ
ä#5Ø—>‘>Ø×(Ñ(ñ$
ˆÔ ô #5Ø—>‘>Ø×(Ñ(ñ#
ˆÔô
 'Ø—>‘>ØØ$×<Ñ<Ø×(Ñ(ñ	
ˆŒô &Ø—>‘>Ü—O‘OØ$×<Ñ<Ø×(Ñ(ñ	
ˆ�r   c                óâ   • UR                  U R                  5      (       a  [        R                  $ UR                  U R                  5      (       a  [        R
                  $ [        R
                  $ )aX  Determine if the code has been selected by the user.

:param code: The code for the check that has been run.
:returns:
    Selected.Implicitly if the selected list is empty,
    Selected.Explicitly if the selected list is not empty and a match
    was found,
    Ignored.Implicitly if the selected list is not empty but no match
    was found.
)Ú
startswithr6   r   r   r;   r   r   ©r?   Úcodes     r   Úwas_selectedÚDecisionEngine.was_selectedf   sP   € ð �?‰?˜4×3Ñ3×4Ñ4Ü×&Ñ&Ð&Ø�_‰_˜TŸ]™]×+Ñ+Ü×&Ñ&Ð&ä×%Ñ%Ð%r   c                óâ   • UR                  U R                  5      (       a  [        R                  $ UR                  U R                  5      (       a  [        R
                  $ [        R
                  $ )aX  Determine if the code has been ignored by the user.

:param code:
    The code for the check that has been run.
:returns:
    Selected.Implicitly if the ignored list is empty,
    Ignored.Explicitly if the ignored list is not empty and a match was
    found,
    Selected.Implicitly if the ignored list is not empty but no match
    was found.
)rD   r9   r   r   r>   r   r   rE   s     r   Úwas_ignoredÚDecisionEngine.was_ignoredx   sP   € ð �?‰?˜4×2Ñ2×3Ñ3Ü×%Ñ%Ð%Ø�_‰_˜TŸ\™\×*Ñ*Ü×%Ñ%Ð%ä×&Ñ&Ð&r   c                óP  ^• U R                  T5      nU R                  T5      n[        R                  STUU5        [	        U[
        5      (       a%  [	        U[
        5      (       a  [        R
                  $ [	        U[        5      (       a%  [	        U[        5      (       a  [        R                  $ U[
        R                  L a#  U[        R                  La  [        R
                  $ U[
        R                  La#  U[        R                  L a  [        R                  $ U[        R                  L a#  U[
        R                  L a  [        R                  $ U[
        R                  L a  U[        R                  L d&  U[
        R                  L a‰  U[        R                  L av  [        U4S jU R                   5       5      n[        U4S jU R                   5       5      n[        U5      [        U5      :”  a  [        R
                  $ [        R                  $ [        ST SU SU 35      e)z-Decide if code should be ignored or selected.z#The user configured %r to be %r, %rc              3  óV   >#   • U H  nTR                  U5      (       d  M  Uv •  M!     g 7f©N©rD   ©Ú.0ÚsrF   s     €r   Ú	<genexpr>Ú/DecisionEngine.make_decision.<locals>.<genexpr>¬   s   øé € ÐI¡] °d·o±oÀa×6HŸ!™!¢]ùó   ƒ) 	)c              3  óV   >#   • U H  nTR                  U5      (       d  M  Uv •  M!     g 7frN   rO   rP   s     €r   rS   rT   ­   s   øé € ÐH¡\ °T·_±_ÀQ×5GŸ!™!¢\ùrU   zunreachable Ú )rG   rJ   ÚLOGÚdebugÚ
isinstancer   r   r   r   r   Únextr;   r>   ÚlenÚAssertionError)r?   rF   r;   r>   r4   r7   s    `    r   Úmake_decisionÚDecisionEngine.make_decision‹   s¤  ø€ à×$Ñ$ TÓ*ˆØ×"Ñ" 4Ó(ˆÜ�	‰	Ø1ØØØô		
ô �h¤×)Ñ)¬j¸Ä(×.KÑ.KÜ×$Ñ$Ð$Ü˜¤'×*Ñ*¬z¸'Ä7×/KÑ/KÜ×#Ñ#Ð#àœ×+Ñ+Ò+Øœw×1Ñ1Ò1ä×$Ñ$Ð$àœH×/Ñ/Ò/Øœ7×-Ñ-Ò-ä×#Ñ#Ð#Øœ×+Ñ+Ò+°¼8×;NÑ;NÒ0NÜ×#Ñ#Ð#àœ×+Ñ+Ò+°¼7×;MÑ;MÒ0Màœ×+Ñ+Ò+°¼7×;MÑ;MÒ0Mô ÔI T§]¢]ÓIÓIˆFÜÔH T§\¢\ÓHÓHˆFÜ�6‹{œS ›[Ó(Ü×(Ñ(Ð(ä×'Ñ'Ð'ä  <°¨v°Q°x°jÀÀ'ÀÐ!KÓLÐLr   c                ó¬   • U R                   R                  U5      nUc5  U R                  U5      nX R                   U'   [        R	                  SX5        U$ )až  Return the decision for a specific code.

This method caches the decisions for codes to avoid retracing the same
logic over and over again. We only care about the select and ignore
rules as specified by the user in their configuration files and
command-line flags.

This method does not look at whether the specific line is being
ignored in the file itself.

:param code: The code for the check that has been run.
z"%s" will be "%s")r3   Úgetr^   rX   rY   )r?   rF   Údecisions      r   Údecision_forÚDecisionEngine.decision_forµ   sL   € ð —:‘:—>‘> $Ó'ˆØÑØ×)Ñ)¨$Ó/ˆHØ'�J‰J�tÑÜ�I‰IÐ)¨4Ô:Øˆr   )r3   r>   r9   r;   r6   N)r@   úargparse.NamespaceÚreturnÚNone)rF   Ústrrf   zSelected | Ignored©rF   rh   rf   r   )r   r   r   r   r   rA   rG   rJ   r^   rc   r   r   r   r   r0   r0   E   s"   † ñô
ô4&ô$'ô&(M÷Tr   r0   c                  ó¬   • \ rS rSrSr S
       SS jjr    SS jrSS jr\R                      SS j5       r
 S
             SS jjrS	rg)ÚStyleGuideManageréÊ   z.Manage multiple style guides for a single run.Nc                ó\  • Xl         X l        [        R                  " 5       U l        U=(       d    [        U5      U l        / U l        [        XU R                  US9U l	        U R                  /U R                  U5      QU l        [        R                  " SS9" U R                  5      U l        g)úCInitialize our StyleGuide.

.. todo:: Add parameter documentation.
)ÚdeciderN)Úmaxsize)r@   Ú	formatterr   Ú
StatisticsÚstatsr0   ro   Ústyle_guidesr   Údefault_style_guideÚpopulate_style_guides_withÚ	functoolsÚ	lru_cacheÚ_style_guide_forÚstyle_guide_for)r?   r@   rq   ro   s       r   rA   ÚStyleGuideManager.__init__Í   sš   € ð ŒØ"ŒÜ×*Ò*Ó,ˆŒ
Ø×9¤.°Ó"9ˆŒØ.0ˆÔÜ#-Ø §
¡
°Gñ$
ˆÔ ð ×$Ñ$ð
à×,Ñ,¨WÓ5ð
ˆÔô
  )×2Ò2¸4Ò@Ø×!Ñ!ó 
ˆÕr   c              #  ó˜   #   • [         R                  " UR                  5      nU H   u  p4U R                  R	                  X4S9v •  M"     g7f)zÏGenerate style guides from the per-file-ignores option.

:param options:
    The original options parsed from the CLI and config file.
:returns:
    A copy of the default style guide with overridden values.
)ÚfilenameÚextend_ignore_withN)r   Úparse_files_to_codes_mappingÚper_file_ignoresru   Úcopy)r?   r@   Úper_filer}   Ú
violationss        r   rv   Ú,StyleGuideManager.populate_style_guides_withè   sK   é € ô ×5Ò5°g×6NÑ6NÓOˆÛ$,Ñ ˆHØ×*Ñ*×/Ñ/Ø!ð 0ð ô ò %-ùs   ‚AA
c                óB   ^• [        U4S jU R                   5       S S9$ )z3Find the StyleGuide for the filename in particular.c              3  óT   >#   • U H  oR                  T5      (       d  M  Uv •  M      g 7frN   )Ú
applies_to)rQ   Úgr}   s     €r   rS   Ú5StyleGuideManager._style_guide_for.<locals>.<genexpr>û   s   øé € ÐDÑ)�1¯\©\¸(×-C�Q‰QÒ)ùs   ƒ(Ÿ	(c                ó>   • [        U R                  =(       d    S5      $ )NÚ )r\   r}   )rˆ   s    r   Ú<lambda>Ú4StyleGuideManager._style_guide_for.<locals>.<lambda>ü   s   € œ#˜aŸj™j×.¨BÔ/r   )Úkey)Úmaxrt   ©r?   r}   s    `r   ry   Ú"StyleGuideManager._style_guide_forø   s!   ø€ äÜD˜×)Ò)ÓDÙ/ñ
ð 	
r   c              #  óŒ   #   • U R                  U5      nUR                  U5         Uv •  SSS5        g! , (       d  f       g= f7f©z9Record the fact that we're processing the file's results.N)rz   Úprocessing_file)r?   r}   Úguides      r   r”   Ú!StyleGuideManager.processing_fileÿ   s5   é € ð
 ×$Ñ$ XÓ.ˆØ×"Ñ" 8Õ,ØŠK÷ -×,Ö,üs   ‚#A¥3ª	A³
A½Ac                óJ   • U R                  U5      nUR                  XX4XV5      $ )án  Handle an error reported by a check.

:param code:
    The error code found, e.g., E123.
:param filename:
    The file in which the error was found.
:param line_number:
    The line number (where counting starts at 1) at which the error
    occurs.
:param column_number:
    The column number (where counting starts at 1) at which the error
    occurs.
:param text:
    The text of the error message.
:param physical_line:
    The actual physical line causing the error.
:returns:
    1 if the error was reported. 0 if it was ignored. This is to allow
    for counting of the number of errors found that were not ignored.
)rz   Úhandle_error)r?   rF   r}   Úline_numberÚcolumn_numberÚtextÚphysical_liner•   s           r   r™   ÚStyleGuideManager.handle_error  s.   € ð: ×$Ñ$ XÓ.ˆØ×!Ñ!Ø˜K¸ó
ð 	
r   )ro   ru   rq   r@   rs   rz   rt   rN   )r@   re   rq   úbase_formatter.BaseFormatterro   úDecisionEngine | Nonerf   rg   )r@   re   rf   ú!Generator[StyleGuide, None, None])r}   rh   rf   r   ©r}   rh   rf   r¡   ©rF   rh   r}   rh   rš   Úintr›   r¤   rœ   rh   r�   ú
str | Nonerf   r¤   )r   r   r   r   r   rA   rv   ry   Ú
contextlibÚcontextmanagerr”   r™   r   r   r   r   rk   rk   Ê   sÌ   † Ù8ð *.ð	
à#ð
ð 0ð
ð 'ð	
ð
 
õ
ð6Ø)ðà	*ôô 
ð ×ÑðØðà	*óó ðð %)ð 
àð 
ð ð 
ð ð	 
ð
 ð 
ð ð 
ð "ð 
ð 
÷ 
ð  
r   rk   c                  óÐ   • \ rS rSrSr  S         SS jjrSS jr  S     SS jjr\R                      SS j5       r
SS jrSS	 jr S             SS
 jjrSrg)r   i+  z#Manage a Flake8 user's style guide.Nc                óÔ   • Xl         X l        X0l        U=(       d    [        U5      U l        X@l        U R
                  (       a&  [        R                  " U R
                  5      U l        gg)rn   N)r@   rq   rs   r0   ro   r}   r   Únormalize_path)r?   r@   rq   rs   r}   ro   s         r   rA   ÚStyleGuide.__init__.  sK   € ð ŒØ"ŒØŒ
Ø×9¤.°Ó"9ˆŒØ ŒØ�=�=Ü!×0Ò0°·±Ó?ˆD�Mð r   c                ó"   • SU R                    S3$ )z5Make it easier to debug which StyleGuide we're using.z<StyleGuide [z]>©r}   )r?   s    r   Ú__repr__ÚStyleGuide.__repr__B  s   € à˜tŸ}™}˜o¨RÐ0Ð0r   c                ó&  • U=(       d    U R                   n[        R                  " U R                  5      nUR                  =(       d    / Ul        UR                  R                  U=(       d    / 5        [        X0R                  U R                  US9$ )z8Create a copy of this style guide with different values.r­   )	r}   r�   Údeepcopyr@   r8   r(   r   rq   rs   )r?   r}   r~   r@   s       r   r�   ÚStyleGuide.copyF  sm   € ð ×,˜tŸ}™}ˆÜ—-’- §¡Ó-ˆØ '× 5Ñ 5× ;¸ˆÔØ×Ñ×$Ñ$Ð%7×%=¸2Ô>ÜØ—^‘^ T§Z¡Z¸(ñ
ð 	
r   c              #  ó€   #   • U R                   R                  U5        U v •  U R                   R                  U5        g7fr“   )rq   Ú	beginningÚfinishedr�   s     r   r”   ÚStyleGuide.processing_fileT  s0   é € ð
 	�‰× Ñ  Ô*ØŠ
Ø�‰×Ñ Õ)ùs   ‚<>c                ór   • U R                   c  g[        R                  " UU R                   /U < S3[        S9$ )zÕCheck if this StyleGuide applies to the file.

:param filename:
    The name of the file with violations that we're potentially
    applying this StyleGuide to.
:returns:
    True if this applies, False otherwise
Tz! does %(whether)smatch "%(path)s")ÚpatternsÚlog_messageÚlogger)r}   r   Úmatches_filenamerX   r�   s     r   r‡   ÚStyleGuide.applies_to]  s>   € ð �=‰=Ñ ØÜ×%Ò%ØØ—m‘m�_Ø™(Ð"CÐDÜñ	
ð 	
r   c                ó8   • U R                   R                  U5      $ )a\  Determine if the error code should be reported or ignored.

This method only cares about the select and ignore rules as specified
by the user in their configuration files and command-line flags.

This method does not look at whether the specific line is being
ignored in the file itself.

:param code:
    The code for the check that has been run.
)ro   rc   rE   s     r   Úshould_report_errorÚStyleGuide.should_report_erroro  s   € ð �|‰|×(Ñ(¨Ó.Ð.r   c                ón  • U R                   R                  nU(       d  Sn[        UUUUS-   UU5      nU R                  UR                  5      [
        R                  L n	UR                  U5      SL n
U	(       a>  U
(       a7  U R                  R                  U5        U R                  R                  U5        gg)r˜   r   é   F)r@   Údisable_noqar
   r¾   rF   r   r   Úis_inline_ignoredrq   Úhandlers   Úrecord)r?   rF   r}   rš   r›   rœ   r�   rÂ   ÚerrorÚerror_is_selectedÚis_not_inline_ignoreds              r   r™   ÚStyleGuide.handle_error}  sª   € ð: —|‘|×0Ñ0ˆö ØˆMÜØØØØ˜AÑØØó
ˆð ×$Ñ$ U§Z¡ZÓ0´H×4EÑ4EÐEð 	ð !&× 7Ñ 7¸Ó EÈÐ NÐÞÖ!6Ø�N‰N×!Ñ! %Ô(Ø�J‰J×Ñ˜eÔ$ØØr   )ro   r}   rq   r@   rs   )NN)
r@   re   rq   rŸ   rs   zstatistics.Statisticsr}   r¥   ro   r    )rf   rh   )r}   r¥   r~   zSequence[str] | Nonerf   r   r¢   )r}   rh   rf   Úboolri   rN   r£   )r   r   r   r   r   rA   r®   r�   r¦   r§   r”   r‡   r¾   r™   r   r   r   r   r   r   +  sý   † Ù-ð  $Ø)-ð@à#ð@ð 0ð@ð %ð	@ð
 ð@ð 'õ@ô(1ð  $Ø37ð
àð
ð 1ð
ð 
õ	
ð ×Ñð*Øð*à	*ó*ó ð*ô
ô$/ð* %)ð2àð2ð ð2ð ð	2ð
 ð2ð ð2ð "ð2ð 
÷2ð 2r   r   )r'   úlist[str] | Noner(   rË   rf   útuple[str, ...])
r'   rË   r,   rÌ   r-   z	list[str]r(   rË   rf   rÌ   )"r   Ú
__future__r   Úargparser¦   r�   Úenumrw   ÚloggingÚtypingr   r   Úflake8r   r   r   Úflake8.formattingr	   Úbase_formatterÚflake8.violationr
   Ú__all__Ú	getLoggerr   rX   ÚEnumr   r   r   r*   r.   r0   rk   r   r   r   r   Ú<module>rÙ      só   ðÙ 6Ý "ã Û Û Û Û Û Ý Ý å Ý Ý Ý 4Ý &à
€à×Ò˜Ó!€ô'ˆt�y‰yô 'ô&ˆd�i‰iô &ô ˆt�y‰yô  ð,àð,ð ð,ð ô	,ð,àð,ð ð,ð  ð	,ð
 ð,ð ô,÷Bñ B÷J^
ñ ^
÷BDò Dr   