§
    øyIf-  ã                  óø   — d Z ddlmZ ddlZddlZddlZddlZddlmZ ddlm	Z	 ddlm
Z
 ddlmZ ddlmZ  ej        e¦  «        Z ej        d	d
¦  «        Zdddœdd„Z G d„ d¦  «        Z G d„ d¦  «        ZdS )z,Option handling and Option management logic.é    )ÚannotationsN)ÚAny)ÚCallable)ÚSequence)Úutils)ÚPluginsÚ_ARGÚNOF©Úcomma_separated_listÚnormalize_pathsÚvalueÚstrÚargsr   Úboolr   Úreturnústr | list[str]c               óØ   — | }|r)t          |t          ¦  «        rt          j        | ¦  «        }|r:t          |t          ¦  «        rt          j        |g|¢R Ž }nt          j        |g|¢R Ž }|S ©N)Ú
isinstancer   r   Úparse_comma_separated_listÚnormalize_pathr   )r   r   r   r   Úrets        úJ/var/www/piapp/venv/lib/python3.11/site-packages/flake8/options/manager.pyÚ_flake8_normalizer      sƒ   € ð !€CØð 6¥
¨3µÑ 4Ô 4ð 6ÝÔ.¨uÑ5Ô5ˆàð 4Ý�c�3ÑÔð 	4ÝÔ& sÐ2¨TÐ2Ð2Ð2ˆCˆCåÔ'¨Ð3¨dÐ3Ð3Ð3ˆCà€Jó    c                  óâ   — e Zd ZdZej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        dddfd(d„Zed)d„¦   «         Zd*d „Z	d+d$„Z
d,d&„Zd'S )-ÚOptionz@Our wrapper around an argparse argument parsers to add features.FÚshort_option_nameú
str | _ARGÚlong_option_nameÚactionú"str | type[argparse.Action] | _ARGÚdefaultú
Any | _ARGÚtypeúCallable[..., Any] | _ARGÚdestÚnargsúint | str | _ARGÚconstÚchoicesúSequence[Any] | _ARGÚhelpÚmetavarÚrequiredúbool | _ARGÚparse_from_configr   r   r   r   ÚNonec                óä  — |t           j        u r1|t           j        ur#|                     d¦  «        rt           j        |}}|s|rt          j        t
          ||¬¦  «        }|| _        || _        d„ ||fD ¦   «         | _        || _	        || _
        || _        || _        || _        || _        |	| _        |
| _        || _        || _        | j	        | j
        | j        | j        | j        | j        | j        | j        | j        | j        dœ
| _        || _        || _        || _        d| _        |r@|t           j        u rt1          d¦  «        ‚|dd…                              dd	¦  «        | _        d| _        dS )
aÊ  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   c                ó.   — g | ]}|t           j        u¯|‘ŒS © ©r	   r
   )Ú.0Úxs     r   ú
<listcomp>z#Option.__init__.<locals>.<listcomp>‚   s/   € ð 
ð 
ð 
àØ�œÐÐð àÐÐr   )
r"   r$   r&   r(   r)   r+   r,   r.   r/   r0   NzRWhen specifying parse_from_config=True, a long_option_name must also be specified.é   ú-Ú_)r	   r
   Ú
startswithÚ	functoolsÚpartialr   r   r!   Úoption_argsr"   r$   r&   r(   r)   r+   r,   r.   r/   r0   Úoption_kwargsr2   r   r   Úconfig_nameÚ
ValueErrorÚreplaceÚ_opt)Úselfr   r!   r"   r$   r&   r(   r)   r+   r,   r.   r/   r0   r2   r   r   s                   r   Ú__init__zOption.__init__,   s¶  € ðL ¥¤Ð'Ð'Ø!­¬Ð0Ð0Ø!×,Ò,¨TÑ2Ô2ð 1õ 37´'Ð;LÐ/Ðð  ð 	 ?ð 	ÝÔ$Ý!Ø%9Ø /ðñ ô ˆDð "3ˆÔØ 0ˆÔð
ð 
à'Ð)9Ð:ð
ñ 
ô 
ˆÔð
 ˆŒØˆŒØˆŒ	ØˆŒ	ØˆŒ
ØˆŒ
ØˆŒØˆŒ	ØˆŒØ ˆŒà”kØ”|Ø”IØ”IØ”ZØ”ZØ”|Ø”IØ”|Øœð5
ð 5
ˆÔð "3ˆÔØ$8ˆÔ!Ø.ˆÔà'+ˆÔØð 	FØ¥4¤7Ð*Ð*Ý ðAñô ð ð  0°°°Ô3×;Ò;¸CÀÑEÔEˆDÔàˆŒ	ˆ	ˆ	r   údict[str, Any]c                óH   — d„ | j                              ¦   «         D ¦   «         S )z(Return any actually-specified arguments.c                ó6   — i | ]\  }}|t           j        u¯||“ŒS r6   r7   )r8   ÚkÚvs      r   ú
<dictcomp>z1Option.filtered_option_kwargs.<locals>.<dictcomp>±   s1   € ð 
ð 
ð 
Ù�Q˜¸1ÅDÄGÐ;KÐ;KˆAˆqÐ;KÐ;KÐ;Kr   )rB   Úitems©rG   s    r   Úfiltered_option_kwargszOption.filtered_option_kwargs®   s2   € ð
ð 
Ø!Ô/×5Ò5Ñ7Ô7ð
ñ 
ô 
ð 	
r   r   c                óè   — g }| j         D ]}|                     |¦  «         Œ| j                             ¦   «         D ]\  }}|                     |› d|›�¦  «         Œ dd                     |¦  «        › d�S )Nú=zOption(z, ú))rA   ÚappendrQ   rO   Újoin)rG   ÚpartsÚargrL   rM   s        r   Ú__repr__zOption.__repr__µ   sŒ   € ØˆØÔ#ð 	ð 	ˆCØ�LŠL˜ÑÔÐÐØÔ/×5Ò5Ñ7Ô7ð 	'ð 	'‰DˆAˆqØ�LŠL˜A˜˜ ˜˜Ñ&Ô&Ð&Ð&Ø,˜Ÿš 5Ñ)Ô)Ð,Ð,Ð,Ð,r   r   r   Únormalize_argsc                óè   — | j         r)t          |t          ¦  «        rt          j        |¦  «        }| j        r:t          |t          ¦  «        rt          j        |g|¢R Ž }nt          j        |g|¢R Ž }|S )z6Normalize the value based on the option configuration.)r   r   r   r   r   r   Úlistr   )rG   r   rZ   s      r   Ú	normalizezOption.normalize½   s„   € àÔ$ð 	<­°E½3Ñ)?Ô)?ð 	<ÝÔ4°UÑ;Ô;ˆEàÔð 	EÝ˜%¥Ñ&Ô&ð EÝÔ-¨eÐE°nÐEÐEÐE��åÔ,¨UÐD°^ÐDÐDÐD�àˆr   ú tuple[list[str], dict[str, Any]]c                ó   — | j         | j        fS )z?Convert a Flake8 Option to argparse ``add_argument`` arguments.)rA   rQ   rP   s    r   Úto_argparsezOption.to_argparseÊ   s   € àÔ Ô!<Ð<Ð<r   N) r   r    r!   r    r"   r#   r$   r%   r&   r'   r(   r    r)   r*   r+   r%   r,   r-   r.   r    r/   r    r0   r1   r2   r   r   r   r   r   r   r3   )r   rI   )r   r   )r   r   rZ   r   r   r   )r   r^   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r
   rH   ÚpropertyrQ   rY   r]   r`   r6   r   r   r   r   )   sÜ   € € € € € ØJÐJð )-¬Ø'+¤wà59´WØ"œgØ*.¬'Øœ7Ø"&¤'Ø œGØ(,¬Øœ7Ø"œgØ $¤à"'Ø%*Ø %ð%@ð @ð @ð @ð @ðD ð
ð 
ð 
ñ „Xð
ð-ð -ð -ð -ðð ð ð ð=ð =ð =ð =ð =ð =r   r   c                  óH   — e Zd ZdZdd„Zdd„Zdd„Zd d„Zd d„Z	 	 d!d"d„Z	dS )#ÚOptionManagerz=Manage Options and OptionParser while adding post-processing.Úversionr   Úplugin_versionsÚparentsúlist[argparse.ArgumentParser]Úformatter_namesú	list[str]r   r3   c          
     ó@  — || _         t          j        dd|d|› �¬¦  «        | _        | j                             dd|› d|› dt          j        ¦   «         › �¬	¦  «         | j                             d
dd¬¦  «         i | _        g | _        g | _	        g | _
        d| _        dS )z+Initialize an instance of an OptionManager.Úflake8z %(prog)s [options] file file ...zInstalled plugins: )ÚprogÚusagerj   Úepilogz	--versionrh   z (z) )r"   rh   Ú	filenamesÚ*Úfilename)r)   r/   N)rl   ÚargparseÚArgumentParserÚparserÚadd_argumentr   Úget_python_versionÚconfig_options_dictÚoptionsÚextended_default_ignoreÚextended_default_selectÚ_current_group)rG   rh   ri   rj   rl   s        r   rH   zOptionManager.__init__Ò   sÛ   € ð  /ˆÔÝÔ-ØØ4ØØ:¨Ð:Ð:ð	
ñ 
ô 
ˆŒð 	Œ× Ò ØØàð 0ð 0˜oð 0ð 0ÝÔ+Ñ-Ô-ð0ð 0ð	 	!ñ 	
ô 	
ð 	
ð 	Œ× Ò  °CÀÐ ÑLÔLÐLà68ˆÔ Ø%'ˆŒØ24ˆÔ$Ø24ˆÔ$à>BˆÔÐÐr   Úpluginsr   c                ó(  ‡ ‡— i Šd	ˆˆ fd„}|                      ¦   «         D ]j}t          |j        dd¦  «        }|r  ||j        j        ¦  «          |‰ ¦  «         |j        j        j        dk    r‰                      |j        g¦  «         Œkd‰ _	        dS )
z(Register the plugin options (if needed).Únamer   r   r3   c                ó’   •— 	 ‰|          ‰_         d S # t          $ r* ‰j                             | ¦  «        }|x‰_         ‰| <   Y d S w xY wr   )r   ÚKeyErrorrx   Úadd_argument_group)r‚   ÚgroupÚgroupsrG   s     €€r   Ú
_set_groupz2OptionManager.register_plugins.<locals>._set_groupø   sa   ø€ ð;Ø&,¨T¤l�Ô#Ð#Ð#øÝð ;ð ;ð ;Øœ×6Ò6°tÑ<Ô<�Ø5:Ð:�Ô# f¨T¡l l l lð;øøøs   ƒ ’0AÁAÚadd_optionsNzflake8.extension)r‚   r   r   r3   )
Úall_pluginsÚgetattrÚobjÚpluginÚpackageÚentry_pointr†   Úextend_default_selectÚ
entry_namer   )rG   r€   rˆ   Úloadedr‰   r‡   s   `    @r   Úregister_pluginszOptionManager.register_pluginsô   sÊ   øø€ à57ˆð	;ð 	;ð 	;ð 	;ð 	;ð 	;ð 	;ð ×)Ò)Ñ+Ô+ð 	@ð 	@ˆFÝ! &¤*¨m¸TÑBÔBˆKØð "Ø�
˜6œ=Ô0Ñ1Ô1Ð1Ø�˜DÑ!Ô!Ð!àŒ}Ô(Ô.Ð2DÒDÐDØ×*Ò*¨FÔ,=Ð+>Ñ?Ô?Ð?øð #ˆÔÐÐr   r   r   Úkwargsc                ó‚  — t          |i |¤Ž}|                     ¦   «         \  }}| j        � | j        j        |i |¤Ž n | j        j        |i |¤Ž | j                             |¦  «         |j        r3|j        }|€J ‚|| j	        |<   || j	        | 
                    dd¦  «        <   t                               d|¦  «         dS )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   r`   r   ry   rx   r|   rU   r2   rC   r{   rE   ÚLOGÚdebug)rG   r   r”   ÚoptionrA   rB   r‚   s          r   Ú
add_optionzOptionManager.add_option  sæ   € õ ˜Ð( Ð(Ð(ˆØ%+×%7Ò%7Ñ%9Ô%9Ñ"ˆ�]ØÔÐ*Ø,ˆDÔÔ,¨kÐK¸]ÐKÐKÐKÐKà$ˆDŒKÔ$ kÐC°]ÐCÐCÐCØŒ×Ò˜FÑ#Ô#Ð#ØÔ#ð 	FØÔ%ˆDØÐ#Ð#Ð#Ø-3ˆDÔ$ TÑ*Ø?EˆDÔ$ T§\¢\°#°sÑ%;Ô%;Ñ<Ý�	Š	Ð+¨VÑ4Ô4Ð4Ð4Ð4r   Úerror_codesúSequence[str]c                óp   — t                                d|¦  «         | j                             |¦  «         dS )zÚExtend 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—   r}   Úextend©rG   rš   s     r   Úextend_default_ignorez#OptionManager.extend_default_ignore$  ó6   € õ 	�	Š	Ð9¸;ÑGÔGÐGØÔ$×+Ò+¨KÑ8Ô8Ð8Ð8Ð8r   c                óp   — t                                d|¦  «         | j                             |¦  «         dS )zÚExtend 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—   r~   r�   rž   s     r   r�   z#OptionManager.extend_default_select.  r    r   NúSequence[str] | NoneÚvaluesúargparse.Namespace | Noneúargparse.Namespacec                óx   — |r | j         j        di t          |¦  «        ¤Ž | j                              |¦  «        S )z6Proxy to calling the OptionParser's parse_args method.r6   )rx   Úset_defaultsÚvarsÚ
parse_args)rG   r   r£   s      r   r©   zOptionManager.parse_args8  sC   € ð ð 	5Ø$ˆDŒKÔ$Ð4Ð4¥t¨F¡|¤|Ð4Ð4Ð4ØŒ{×%Ò% dÑ+Ô+Ð+r   )
rh   r   ri   r   rj   rk   rl   rm   r   r3   )r€   r   r   r3   )r   r   r”   r   r   r3   )rš   r›   r   r3   )NN)r   r¢   r£   r¤   r   r¥   )
ra   rb   rc   rd   rH   r“   r™   rŸ   r�   r©   r6   r   r   rg   rg   Ï   s¤   € € € € € ØGÐGðCð Cð Cð CðD#ð #ð #ð #ð.5ð 5ð 5ð 5ð29ð 9ð 9ð 9ð9ð 9ð 9ð 9ð &*Ø,0ð,ð ,ð ,ð ,ð ,ð ,ð ,r   rg   )
r   r   r   r   r   r   r   r   r   r   )rd   Ú
__future__r   rv   Úenumr?   ÚloggingÚtypingr   r   r   ro   r   Úflake8.plugins.finderr   Ú	getLoggerra   r–   ÚEnumr	   r   r   rg   r6   r   r   ú<module>r±      sX  ðØ 2Ð 2Ø "Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð Ø )Ð )Ð )Ð )Ð )Ð )à€gÔ˜Ñ!Ô!€ð €t„y�˜ÑÔ€ð "'Ø!ð	ð ð ð ð ð ð&c=ð c=ð c=ð c=ð c=ñ c=ô c=ð c=ðLq,ð q,ð q,ð q,ð q,ñ q,ô q,ð q,ð q,ð q,r   