
    ;i6                         S SK r  " S S\ R                  5      r " S S\5      r " S S\5      r " S S	\ R
                  5      r " S
 S\ R                  5      rg)    Nc                   6   ^  \ rS rSrSrU 4S jrSS jrSrU =r$ )_StoreAction   zK
Custom action that allows for `-` or `_` to be passed in for an argument.
c                    > [         TU ]  " U0 UD6  / nU R                   H@  nUR                  U5        SUSS  ;   d  M  UR                  UR	                  SS5      5        MB     X0l        g )N_   -)super__init__option_stringsappendreplace)selfargskwargsnew_option_stringsoption_string	__class__s        i/home/dmtnaga/Documents/work/airagagent/rag_env/lib/python3.13/site-packages/accelerate/commands/utils.pyr   _StoreAction.__init__   sk    $)&)!00M%%m4mAB''"))-*?*?S*IJ	 1
 1    c                     [        X R                  U5        [        US5      (       d  [        5       Ul        UR                  R                  U R                  5        g )N
nondefault)setattrdesthasattrsetr   add)r   parser	namespacevaluesr   s        r   __call___StoreAction.__call__!   s?    	99f-y,//#&5I   +r   )r   N	__name__
__module____qualname____firstlineno____doc__r   r"   __static_attributes____classcell__r   s   @r   r   r      s    1, ,r   r   c                   @   ^  \ rS rSrSrSU 4S jjrSU 4S jjrSrU =r$ )_StoreConstAction(   zJ
Same as `argparse._StoreConstAction` but uses the custom `_StoreAction`.
c           
      ,   > [         TU ]  UUSUUUUS9  g )Nr   )r   r   nargsconstdefaultrequiredhelpr
   r   )r   r   r   r3   r4   r5   r6   r   s          r   r   _StoreConstAction.__init__-   s*    ) 	 	
r   c                 <   > [         TU ]  XU R                  U5        g r$   )r
   r"   r3   )r   r   r    r!   r   r   s        r   r"   _StoreConstAction.__call__8   s    DJJFr    NFNr$   r%   r-   s   @r   r/   r/   (   s    	
G Gr   r/   c                   6   ^  \ rS rSrSr   SU 4S jjrSrU =r$ )_StoreTrueAction<   zN
Same as `argparse._StoreTrueAction` but uses the custom `_StoreConstAction`.
c           	      &   > [         TU ]  XSX4US9  g )NT)r   r   r3   r4   r5   r6   r7   )r   r   r   r4   r5   r6   r   s         r   r   _StoreTrueAction.__init__A   s!     	)D'ko 	 	
r   r;   r<   )r&   r'   r(   r)   r*   r   r+   r,   r-   s   @r   r>   r>   <   s     

 

r   r>   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )CustomArgumentGroupN   z
Custom argument group that allows for the use of `-` or `_` in arguments passed and overrides the help for each
when applicable.
c           	        > [        U5      n[        U[        R                  5      (       a  [        US   US   US   US   US   5      nOl[        U[        R                  5      (       a#  [	        US   US   US   US   US   US   5      nO*[        U[        R
                  5      (       a  [        S0 UD6n[        TU ]  U5      nU$ )Nr   r   r4   r5   r6   r3   r;   )vars
isinstanceargparser>   r/   r   r
   _add_action)r   actionr   r   s      r   rI   CustomArgumentGroup._add_actionT   s    F|fh7788%%&Vd9otJGWY]^dYeF  : :;;&%&VWYZ VF  5 566!)D)F$V,r   r;   )r&   r'   r(   r)   r*   rI   r+   r,   r-   s   @r   rC   rC   N   s    
 r   rC   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )CustomArgumentParseri   z
Custom argument parser that allows for the use of `-` or `_` in arguments passed and overrides the help for each
when applicable.
c                 j   > SU;   a  US   S:X  a	  [         US'   O	[        US'   [        TU ]  " U0 UD6  g )NrJ   
store_true)r>   r   r
   add_argument)r   r   r   r   s      r   rQ   !CustomArgumentParser.add_argumento   s?    vh</#3x +F8d-f-r   c                 Z    [        U /UQ70 UD6nU R                  R                  U5        U$ r$   )rC   _action_groupsr   )r   r   r   groups       r   add_argument_group'CustomArgumentParser.add_argument_groupx   s/    #D:4:6:""5)r   r;   )	r&   r'   r(   r)   r*   rQ   rV   r+   r,   r-   s   @r   rM   rM   i   s    
. r   rM   )	rH   Actionr   r/   r>   _ArgumentGrouprC   ArgumentParserrM   r;   r   r   <module>r[      sY    ,8?? ,,G G(
( 
$(11 6822 r   