
    #
3j                    2    S SK Jr  S SKJr   S\SS.S jjrg)    )annotations)RichHelpFormatterN__init__)formatter_classmethod_namec              :   ^^^ SSK mUUU4S jnU c  U$ U" U 5      $ )a  Patch the default `formatter_class` parameter of an argument parser constructor.

Parameters
----------
cls : (type, optional)
    The class to patch. If not provided, a decorator is returned.
formatter_class : (type, optional)
    The new formatter class to use. Defaults to ``RichHelpFormatter``.
method_name : (str, optional)
    The method name to patch. Defaults to ``__init__``.

Examples
--------
Can be used as a normal function to patch an existing class::

    # Patch the default formatter class of `argparse.ArgumentParser`
    patch_default_formatter_class(argparse.ArgumentParser)

    # Patch the default formatter class of django commands
    from django.core.management.base import BaseCommand, DjangoHelpFormatter
    class DjangoRichHelpFormatter(DjangoHelpFormatter, RichHelpFormatter): ...
    patch_default_formatter_class(
        BaseCommand, formatter_class=DjangoRichHelpFormatter, method_name="create_parser"
    )
Or as a decorator to patch a new class::

    @patch_default_formatter_class
    class MyArgumentParser(argparse.ArgumentParser):
        pass

    @patch_default_formatter_class(formatter_class=RawDescriptionRichHelpFormatter)
    class MyOtherArgumentParser(argparse.ArgumentParser):
        pass
r   Nc                  >^ [        U T5      m[        T5      (       d  [        SU R                   ST S35      eTR	                  T5      UU4S j5       n[        U TU5        U $ )N'.z' is not callablec                 8   > UR                  ST5        T" U 0 UD6$ )Nr   )
setdefault)argskwargsr   methods     Q/home/wildlama/miniconda3/lib/python3.13/site-packages/rich_argparse/_patching.pywrapperApatch_default_formatter_class.<locals>.decorator.<locals>.wrapper6   s$    /A4*6**    )getattrcallable	TypeError__name__wrapssetattr)clsr   r   r   	functoolsr   s     @r   	decorator0patch_default_formatter_class.<locals>.decorator1   sg    k*a~Q{m;LMNN		 	+ 
!	+ 	['*
r   )r   )r   r   r   r   r   s    `` @r   patch_default_formatter_classr   
   s%    J  {S>r   )N)
__future__r   rich_argparse._argparser   r    r   r   <module>r#      s!   
 # 5 	6$5:6r   