
    \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J	r	  SSKJ
r
  SSKJr  SSKJr  \R                  " \5      r\R$                  " S	S
5      rSSS.         SS jjr " S S5      r " S S5      rg)z,Option handling and Option management logic.    )annotationsN)Any)Callable)Sequence)utils)Plugins_ARGNOFcomma_separated_listnormalize_pathsc                  U nU(       a+  [        U[        5      (       a  [        R                  " U 5      nU(       aE  [        U[        5      (       a  [        R                  " U/UQ76 nU$ [        R
                  " U/UQ76 nU$ N)
isinstancestrr   parse_comma_separated_listnormalize_pathr   )valuer   r   argsrets        [/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/flake8/options/manager.py_flake8_normalizer      sp     !C
3 4 4..u5c3&&s2T2C J ''3d3CJ    c                     \ rS rSrSr\R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  SSS4                               SS jjr\SS j5       r	SS jr
SS jrSS jrS	rg
)Option)   z@Our wrapper around an argparse argument parsers to add features.Fc                   U[         R                  L a:  U[         R                  La'  UR                  S5      (       a  [         R                  Up!U(       d  U(       a  [        R                  " [
        UUS9nXl        X l        X4 Vs/ s H  nU[         R                  Ld  M  UPM     snU l        X0l	        X@l
        XPl        X`l        Xpl        Xl        Xl        Xl        Xl        Xl        U R                  U R                  U R                  U R                  U R                  U R                  U R                  U R                   U R"                  U R$                  S.
U l        Xl        Xl        Xl        SU l        U(       a8  U[         R                  L a  [1        S5      eUSS R3                  SS5      U l        SU l        gs  snf )	az  Initialize an Option instance.

The following are all passed directly through to argparse.

:param short_option_name:
    The short name of the option (e.g., ``-x``). This will be the
    first argument passed to ``ArgumentParser.add_argument``
:param long_option_name:
    The long name of the option (e.g., ``--xtra-long-option``). This
    will be the second argument passed to
    ``ArgumentParser.add_argument``
:param default:
    Default value of the option.
:param dest:
    Attribute name to store parsed option value as.
:param nargs:
    Number of arguments to parse for this option.
:param const:
    Constant value to store on a common destination. Usually used in
    conjunction with ``action="store_const"``.
:param choices:
    Possible values for the option.
:param help:
    Help text displayed in the usage information.
:param metavar:
    Name to use instead of the long option name for help text.
:param required:
    Whether this option is required or not.

The following options may be passed directly through to :mod:`argparse`
but may need some massaging.

:param type:
    A callable to normalize the type (as is the case in
    :mod:`argparse`).
:param action:
    Any action allowed by :mod:`argparse`.

The following parameters are for Flake8's option handling alone.

:param parse_from_config:
    Whether or not this option should be parsed out of config files.
:param comma_separated_list:
    Whether the option is a comma separated list when parsing from a
    config file.
:param normalize_paths:
    Whether the option is expecting a path or list of paths and should
    attempt to normalize the paths to absolute paths.
z--r   )
actiondefaulttypedestnargsconstchoiceshelpmetavarrequiredNzRWhen specifying parse_from_config=True, a long_option_name must also be specified.   -_)r	   r
   
startswith	functoolspartialr   short_option_namelong_option_nameoption_argsr   r   r    r!   r"   r#   r$   r%   r&   r'   option_kwargsparse_from_configr   r   config_name
ValueErrorreplace_opt)selfr.   r/   r   r   r    r!   r"   r#   r$   r%   r&   r'   r2   r   r   xs                    r   __init__Option.__init__,   s   L '!0!,,T2226'';L/  ?$$!%9 /D "3 0 (:
: :

 		

	 kk||IIIIZZZZ||II||5
 "3$8!.'+477* A   03;;CED	U
s   G"Gc                    U R                   R                  5        VVs0 s H  u  pU[        R                  Ld  M  X_M     snn$ s  snnf )z(Return any actually-specified arguments.)r1   itemsr	   r
   )r7   kvs      r   filtered_option_kwargsOption.filtered_option_kwargs   sF     "//557
7TQ1DGG;KDAD7
 	
 
s
   AAc                    / nU R                    H  nUR                  U5        M     U R                  R                  5        H  u  p4UR                  U SU< 35        M     SSR	                  U5       S3$ )N=zOption(z, ))r0   appendr?   r<   join)r7   partsargr=   r>   s        r   __repr__Option.__repr__   sm    ##CLL $//557DALLA3au& 85)*!,,r   c                *   U R                   (       a+  [        U[        5      (       a  [        R                  " U5      nU R
                  (       aE  [        U[        5      (       a  [        R
                  " U/UQ76 nU$ [        R                  " U/UQ76 nU$ )z6Normalize the value based on the option configuration.)r   r   r   r   r   r   listr   )r7   r   normalize_argss      r   	normalizeOption.normalize   su    $$E3)?)?44U;E%&&--eEnE  ,,UD^Dr   c                2    U R                   U R                  4$ )z?Convert a Flake8 Option to argparse ``add_argument`` arguments.)r0   r?   )r7   s    r   to_argparseOption.to_argparse   s    !<!<<<r   )r6   r   r$   r   r3   r#   r   r!   r%   r/   r&   r"   r   r0   r1   r2   r'   r.   r    N) r.   
str | _ARGr/   rR   r   z"str | type[argparse.Action] | _ARGr   
Any | _ARGr    zCallable[..., Any] | _ARGr!   rR   r"   zint | str | _ARGr#   rS   r$   zSequence[Any] | _ARGr%   rR   r&   rR   r'   zbool | _ARGr2   boolr   rT   r   rT   returnNone)rU   zdict[str, Any])rU   r   )r   r   rL   r   rU   r   )rU   z tuple[list[str], dict[str, Any]])__name__
__module____qualname____firstlineno____doc__r	   r
   r9   propertyr?   rH   rM   rP   __static_attributes__ r   r   r   r   )   s<   J )-'+ww59WW"gg*.''77"&'' GG(,77"gg $"'%* %%@%@ %@
 3@ @ (@ @  @ @ &@ @ @ @   !@" ##@$ %@& 
'@D 
 
-=r   r   c                  z    \ 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S	 jjr
S
rg)OptionManager   z=Manage Options and OptionParser while adding post-processing.c          
     6   X@l         [        R                  " SSUSU 3S9U l        U R                  R	                  SSU SU S[
        R                  " 5        3S	9  U R                  R	                  S
SSS9  0 U l        / U l        / U l	        / U l
        SU l        g)z+Initialize an instance of an OptionManager.flake8z %(prog)s [options] file file ...zInstalled plugins: )progusageparentsepilogz	--versionversionz (z) )r   rh   	filenames*filename)r"   r&   N)formatter_namesargparseArgumentParserparseradd_argumentr   get_python_versionconfig_options_dictoptionsextended_default_ignoreextended_default_select_current_group)r7   rh   plugin_versionsrf   rl   s        r   r9   OptionManager.__init__   s      /--4((9:	
 	  )2o.b++-.0	 	! 	
 	  C L68 %'24$24$>Br   c                b  ^ ^ 0 mSUU 4S jjnUR                  5        H  n[        UR                  SS5      nU(       a$  U" UR                  R                  5        U" T 5        UR                  R
                  R                  S:X  d  Mk  T R                  UR                  /5        M     ST l	        g)z(Register the plugin options (if needed).c                   >  TU    Tl         g ! [         a*    TR                  R                  U 5      nU=Tl         TU '    g f = fr   )rv   KeyErrorro   add_argument_group)namegroupgroupsr7   s     r   
_set_group2OptionManager.register_plugins.<locals>._set_group   sH    ;&,Tl# ;66t<5::#fTl;s   
 1AAadd_optionsNzflake8.extension)r}   r   rU   rV   )
all_pluginsgetattrobjpluginpackageentry_pointr~   extend_default_select
entry_namerv   )r7   pluginsr   loadedr   r   s   `    @r   register_pluginsOptionManager.register_plugins   s    57	; 	; ))+F!&**mTBK6==001D!}}((..2DD**F,=,=+>? , #r   c                   [        U0 UD6nUR                  5       u  pEU R                  b  U R                  R                  " U0 UD6  OU R                  R                  " U0 UD6  U R
                  R                  U5        UR                  (       a=  UR                  nUc   eX0R                  U'   X0R                  UR                  SS5      '   [        R                  SU5        g)a  Create and register a new option.

See parameters for :class:`~flake8.options.manager.Option` for
acceptable arguments to this method.

.. note::

    ``short_option_name`` and ``long_option_name`` may be specified
    positionally as they are with argparse normally.
Nr*   r)   zRegistered option "%s".)r   rP   rv   rp   ro   rs   rD   r2   r3   rr   r5   LOGdebug)r7   r   kwargsoptionr0   r1   r}   s          r   
add_optionOptionManager.add_option  s     ((%+%7%7%9"*,,kK]KKK$$kC]CF###%%D###-3$$T*?E$$T\\#s%;<		+V4r   c                f    [         R                  SU5        U R                  R                  U5        g)zExtend the default ignore list with the error codes provided.

:param error_codes:
    List of strings that are the error/warning codes with which to
    extend the default ignore list.
z%Extending default ignore list with %rN)r   r   rt   extendr7   error_codess     r   extend_default_ignore#OptionManager.extend_default_ignore$  '     			9;G$$++K8r   c                f    [         R                  SU5        U R                  R                  U5        g)zExtend the default select list with the error codes provided.

:param error_codes:
    List of strings that are the error/warning codes with which
    to extend the default select list.
z%Extending default select list with %rN)r   r   ru   r   r   s     r   r   #OptionManager.extend_default_select.  r   r   Nc                    U(       a%  U R                   R                  " S0 [        U5      D6  U R                   R                  U5      $ )z6Proxy to calling the OptionParser's parse_args method.r^   )ro   set_defaultsvars
parse_args)r7   r   valuess      r   r   OptionManager.parse_args8  s5     KK$$4tF|4{{%%d++r   )rv   rr   rt   ru   rl   rs   ro   )
rh   r   rw   r   rf   zlist[argparse.ArgumentParser]rl   z	list[str]rU   rV   )r   r   rU   rV   )r   r   r   r   rU   rV   )r   zSequence[str]rU   rV   )NN)r   zSequence[str] | Noner   zargparse.Namespace | NonerU   zargparse.Namespace)rW   rX   rY   rZ   r[   r9   r   r   r   r   r   r]   r^   r   r   r`   r`      s    GC C 	C
 /C #C 
CD#.5299 &*,0,", *, 
	, ,r   r`   )
r   r   r   r   r   rT   r   rT   rU   zstr | list[str])r[   
__future__r   rm   enumr,   loggingtypingr   r   r   rc   r   flake8.plugins.finderr   	getLoggerrW   r   Enumr	   r   r   r`   r^   r   r   <module>r      s    2 "         )! yy "'!	  	
 &c= c=Lq, q,r   