o
    Sia                     @   sv   d Z ddlZddlZddlmZ dd ZG dd dejZ	G d	d
 d
e	Z
G dd dejZdadd ZdddZdS )zGeneric entry point script.    N   )flagsc              
   C   s  t jd j}|sdt jd  }tj|ddd}n%|dd|d	  }z|t jd f| ; }W n ttt	fy<   Y nw | rEtj
 }nttj
}zt j| |r_t jd
 t j| t jd W dS  ty } z|jtjkrv W Y d}~dS d}~ww )zWrites __main__'s docstring to stdout with some help text.

    Args:
      shorthelp: bool, if True, prints only flags from the main module,
          rather than all flags.
    __main__z
USAGE: %s [flags]
r   z        )indentfirstline_indent%   z%%z
flags:

N)_sysmodules__doc__argvr   	text_wrapcountOverflowError	TypeError
ValueErrorFLAGSmain_module_helpstrstdoutwriteIOErrorerrno_errnoEPIPE)	shorthelpdocnum_specifiersflag_stre r"   Z/home/ubuntu/.local/lib/python3.10/site-packages/tensorboard/compat/tensorflow_stub/app.py_usage   s2   
r$   c                       s0   e Zd ZdZdZdZ fddZdd Z  ZS )	_HelpFlagz?Special boolean flag that displays usage and raises SystemExit.helphc                    s   t  j| jdd| jd d S )NFzshow this help)
short_name)super__init__NAME
SHORT_NAMEself	__class__r"   r#   r*   B   s   
z_HelpFlag.__init__c                 C   s.   |rt dd t  td td d S d S )NTr   z*Try --helpfull to get a list of all flags.r   )r$   printr   exitr.   argr"   r"   r#   parseG   s   
z_HelpFlag.parse)	__name__
__module____qualname__r   r+   r,   r*   r6   __classcell__r"   r"   r/   r#   r%   <   s    r%   c                   @   s   e Zd ZdZdZdZdS )_HelpshortFlagz#--helpshort is an alias for --help.	helpshortN)r7   r8   r9   r   r+   r,   r"   r"   r"   r#   r;   O   s    r;   c                       s(   e Zd ZdZ fddZdd Z  ZS )_HelpfullFlagz@Display help for flags in main module and all dependent modules.c                    s   t  ddd d S )NhelpfullFzshow full help)r)   r*   r-   r/   r"   r#   r*   Y   s   z_HelpfullFlag.__init__c                 C   s    |rt dd td d S d S )NFr1   r   )r$   r   r3   r4   r"   r"   r#   r6   \   s   
z_HelpfullFlag.parse)r7   r8   r9   r   r*   r6   r:   r"   r"   r/   r#   r=   V   s    r=   Fc                   C   s4   t stt  tt  tt  da d S d S )NT)_define_help_flags_calledr   DEFINE_flagr%   r=   r;   r"   r"   r"   r#   _define_help_flagse   s   rA   c                 C   sD   t   tj|du rtjn|dd}| ptjd j} t| | dS )zBRuns the program with an optional 'main' function and 'argv' list.NT)
known_onlyr   )rA   r   r   r   r   r   mainr3   )rC   r   r"   r"   r#   runo   s   rD   )NN)r   r   r   sysr   r   r   r$   BooleanFlagr%   r;   r=   r?   rA   rD   r"   r"   r"   r#   <module>   s   $
