
    g                         d dl Z  G d de j                  Z G d de          Z G d de          Z G d d	e j                  Z G d
 de j                  ZdS )    Nc                   *     e Zd ZdZ fdZddZ xZS )_StoreActionzS
    Custom action that allows for `-` or `_` to be passed in for an argument.
    c                      t                      j        |i | g }| j        D ]L}|                    |           d|dd          v r)|                    |                    dd                     M|| _        d S )N_   -)super__init__option_stringsappendreplace)selfargskwargsnew_option_stringsoption_string	__class__s        U/var/www/html/ai-engine/env/lib/python3.11/site-packages/accelerate/commands/utils.pyr
   z_StoreAction.__init__   s    $)&)))!0 	K 	KM%%m444mABB'''"))-*?*?S*I*IJJJ0    Nc                 2    t          || j        |           d S N)setattrdestr   parser	namespacevaluesr   s        r   __call__z_StoreAction.__call__!   s    	49f-----r   r   __name__
__module____qualname____doc__r
   r   __classcell__r   s   @r   r   r      sV         1 1 1 1 1. . . . . . . .r   r   c                   ,     e Zd ZdZd fd	ZddZ xZS )_StoreConstActionzR
    Same as `argparse._StoreConstAction` but uses the custom `_StoreAction`.
    NFc           	      X    t                                          ||d||||           d S )Nr   )r   r   nargsconstdefaultrequiredhelpr	   r
   )r   r   r   r*   r+   r,   r-   r   s          r   r
   z_StoreConstAction.__init__*   sC    ) 	 	
 	
 	
 	
 	
r   c                 <    t          || j        | j                   d S r   )r   r   r*   r   s        r   r   z_StoreConstAction.__call__5   s    	49dj11111r   NFNr   r   r%   s   @r   r'   r'   %   s[         	
 	
 	
 	
 	
 	
2 2 2 2 2 2 2 2r   r'   c                   *     e Zd ZdZ	 	 	 d fd	Z xZS )_StoreTrueActionzV
    Same as `argparse._StoreTrueAction` but uses the custom `_StoreConstAction`.
    NFc                 V    t                                          ||d|||           d S )NT)r   r   r*   r+   r,   r-   r.   )r   r   r   r+   r,   r-   r   s         r   r
   z_StoreTrueAction.__init__>   s?     	)D'\dko 	 	
 	
 	
 	
 	
r   r0   )r    r!   r"   r#   r
   r$   r%   s   @r   r2   r2   9   sR          

 

 

 

 

 

 

 

 

 

r   r2   c                   "     e Zd ZdZ fdZ xZS )CustomArgumentGroupz
    Custom argument group that allows for the use of `-` or `_` in arguments passed and overrides the help for each
    when applicable.
    c           	         t          |          }t          |t          j                  r2t          |d         |d         |d         |d         |d                   }nyt          |t          j                  r9t	          |d         |d         |d         |d         |d         |d                   }n&t          |t          j                  rt          di |}t                                          |          }|S )Nr   r   r+   r,   r-   r*    )vars
isinstanceargparser2   r'   r   r	   _add_action)r   actionr   r   s      r   r;   zCustomArgumentGroup._add_actionQ   s    F||fh788 	*%%&Vd9otJGWY]^dYe FF  :;; 
	*&%&VWYZ V FF  566 	*!))D))F$$V,,r   )r    r!   r"   r#   r;   r$   r%   s   @r   r5   r5   K   sB         
        r   r5   c                   (     e Zd ZdZ fdZd Z xZS )CustomArgumentParserz
    Custom argument parser that allows for the use of `-` or `_` in arguments passed and overrides the help for each
    when applicable.
    c                     d|v r|d         dk    r
t           |d<   n
t          |d<    t                      j        |i | d S )Nr<   
store_true)r2   r   r	   add_argument)r   r   r   r   s      r   rA   z!CustomArgumentParser.add_argumentl   sU    vh<//#3x +F8d-f-----r   c                 Z    t          | g|R i |}| j                            |           |S r   )r5   _action_groupsr   )r   r   r   groups       r   add_argument_groupz'CustomArgumentParser.add_argument_groupu   s;    #D:4:::6::""5)))r   )r    r!   r"   r#   rA   rE   r$   r%   s   @r   r>   r>   f   sQ         
. . . . .      r   r>   )	r:   Actionr   r'   r2   _ArgumentGroupr5   ArgumentParserr>   r7   r   r   <module>rI      s    . . . . .8? . . .&2 2 2 2 2 2 2 2(
 
 
 
 
( 
 
 
$    (1   6    82     r   