+
    iy                        R t ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHt  ! R R]	]P                  R7      t ! R R	]4      t ! R
 R]4      t ! R R]P                  4      tR# )a  Customized ArgumentParser.

The default behvaior of argparse.ArgumentParser's parse_args() method  is to
exit with a SystemExit exception in the following cases:
1. When the user requests a help message (with the --help or -h flags), or
2. When there's a parsing error (e.g. missing required flags or mistyped flags)

To make the errors more user-friendly, this class customizes
argparse.ArgumentParser and raises either ParserNormalExit for (1) or
ParserError for (2); this way the caller has control over how to display them
to the user.
)annotationsN)Sequence)ipython_envc                  z   a  ] tR t^$tRtR V 3R lltR R ltR tR R lt]	P                  R	 R
 l4       tRtV ;t# )_ParserBaseExceptionz7Base class for parser exceptions including normal exit.c                   V ^8  d   QhRR/# )   msgsSequence[str] )formats   "/Users/igloo/.openclaw/workspace/scratch/fb_ad_env/lib/python3.14/site-packages/google/generativeai/notebook/argument_parser.py__annotate__!_ParserBaseException.__annotate__'   s     @ @] @    c                	h   < \         SV `  ! R P                  V4      .VO5/ VB  Wn        RV n        R# ) N)super__init__join_msgs_ipython_env)selfr	   argskwargs	__class__s   &&*,r   r   _ParserBaseException.__init__'   s/    888
;?r   c                    V ^8  d   QhRRRR/# )r   envzipython_env.IPythonEnvreturnNoner   )r   s   "r   r   r   ,   s        #9  d  r   c                	    Wn         R # N)r   r   r   s   &&r   set_ipython_env$_ParserBaseException.set_ipython_env,   s    r   c                	<    V P                  V P                  4       R # r"   )displayr   r   s   &r   _ipython_display_&_ParserBaseException._ipython_display_/   s    T&&'r   c                   V ^8  d   QhRR/# )r   r   r
   r   )r   s   "r   r   r   2   s      m r   c                	    V P                   # r"   )r   r(   s   &r   r	   _ParserBaseException.msgs2   s    zzr   c                    V ^8  d   QhRRRR/# r   r   zipython_env.IPythonEnv | Noner   r    r   )r   s   "r   r   r   6   s     < <8 <T <r   c                    R# )z-Display this exception on an IPython console.Nr   r#   s   &&r   r'   _ParserBaseException.display5   s    r   )r   r   )__name__
__module____qualname____firstlineno____doc__r   r$   r)   r	   abcabstractmethodr'   __static_attributes____classcell__r   s   @r   r   r   $   s;    A@ @
 ( 	< <r   r   )	metaclassc                  &    ] tR t^>tRtR R ltRtR# )ParserNormalExitzrException thrown when the parser exits normally.

This is usually thrown when the user requests the help message.
c                    V ^8  d   QhRRRR/# r/   r   )r   s   "r   r   ParserNormalExit.__annotate__D   s      8 T r   c                	B    V P                    F  p\        V4       K  	  R # r"   )r   printr   r   msgs   && r   r'   ParserNormalExit.displayD   s    ::C#J r   r   Nr2   r3   r4   r5   r6   r'   r9   r   r   r   r>   r>   >   s    
 r   r>   c                  &    ] tR t^ItRtR R ltRtR# )ParserErrorz(Exception thrown when there is an error.c                    V ^8  d   QhRRRR/# r/   r   )r   s   "r   r   ParserError.__annotate__L   s     M M8 MT Mr   c                	p    V P                    F  p\        V4       K  	  Ve   VP                  R4       R # R # )Nz,<b style='font-family:courier new'>ERROR</b>)r   rB   display_htmlrC   s   && r   r'   ParserError.displayL   s0    ::C#J ?KL r   r   NrF   r   r   r   rH   rH   I   s    2M Mr   rH   c                  @   a  ] tR t^TtRtV 3R ltRR ltRR ltRtV ;t	# )ArgumentParsera  Customized ArgumentParser for LLM Magics.

This class overrides the parent argparse.ArgumentParser's error-handling
methods to avoid side-effects like printing to stderr. The messages are
accumulated and passed into the raised exceptions for the caller to
handle them.
c                	6   < \         SV `  ! V/ VB  . V n        R # r"   )r   r   	_messages)r   r   r   r   s   &*,r   r   ArgumentParser.__init__]   s    $)&)$&r   c                >    ?V P                   P                  V4       R# )z2Override ArgumentParser's _print_message() method.N)rQ   append)r   messagefiles   &&&r   _print_messageArgumentParser._print_messagea   s    g&r   c                    V'       d   V P                  V4       V P                  p. V n        V^ 8X  d   \        VR7      h\        VR7      h)z(Override ArgumentParser's exit() method.)r	   )rW   rQ   r>   rH   )r   statusrU   r	   s   &&& r   exitArgumentParser.exitf   s@    (~~Q;"--4((r   )rQ   r"   )    N)
r2   r3   r4   r5   r6   r   rW   r[   r9   r:   r;   s   @r   rO   rO   T   s    ''

) 
)r   rO   )r6   
__future__r   r7   argparsetypingr   google.generativeai.notebookr   RuntimeErrorABCMetar   r>   rH   rO   r   r   r   <module>rd      s[    # 
   4<<3;; <4+ M& M)X,, )r   