§
    ¯eîiÍj  ã                  óˆ  — d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ dd
lmZ dZdZdZd9d„Zd9d:d„Z	 d;d:d„Zd<d„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd=d„Zd>d „Zd?d$„Zd%„ Z 	 	 d@d&„Z!d'„ Z"d(„ Z#dAd*„Z$d+„ Z%d,„ Z&d-„ Z'd.„ Z(d9d/„Z)d0„ Z*d1„ Z+d2„ Z,dBd3„Z-d4„ Z.d)d5efd6„Z/ G d7„ d8¦  «        Z0dS )CaÆ  Utilities for producing help strings for use in Fire CLIs.

Can produce help strings suitable for display in Fire CLIs for any type of
Python object, module, class, or function.

There are two types of informative strings: Usage and Help screens.

Usage screens are shown when the user accesses a group or accesses a command
without calling it. A Usage screen shows information about how to use that group
or command. Usage screens are typically short and show the minimal information
necessary for the user to determine how to proceed.

Help screens are shown when the user requests help with the help flag (--help).
Help screens are shown in a less-style console view, and contain detailed help
information.
é    )ÚannotationsN)Ú
completion)Úcustom_descriptions)Ú
decorators)Ú
docstrings)Ú
formatting)Úinspectutils)Úvalue_typeséP   é   Fc                óì  — t          j        | ¦  «        }t          | |¬¦  «        }t          j        | ¦  «        }t	          j        | ¦  «        }t          | |||¬¦  «        }t          | ||||¬¦  «        }t          | |¦  «        }	t          | ¦  «        rt          |||¦  «        \  }
}ng }
g }t          | |¦  «        }|||	g|
z   |z   |z   }d„ |D ¦   «         }d                     d„ |D ¦   «         ¦  «        S )a�  Gets the help string for the current component, suitable for a help screen.

  Args:
    component: The component to construct the help string for.
    trace: The Fire trace of the command so far. The command executed so far
      can be extracted from this trace.
    verbose: Whether to include private members in the help screen.

  Returns:
    The full help screen as a string.
  ©Úverbose)Útracer   )r   c                ó   — g | ]}|®|‘ŒS ©N© )Ú.0Úsections     úQ/home/div/.hermes/hermes-agent/venv/lib/python3.11/site-packages/fire/helptext.pyú
<listcomp>zHelpText.<locals>.<listcomp>Z   s   € ÐKÐKÐK °wÐ7J�GÐ7JÐ7JÐ7Jó    ú

c              3  ó<   K  — | ]\  }}t          ||¦  «        V — Œd S r   )Ú_CreateOutputSection)r   ÚnameÚcontents      r   ú	<genexpr>zHelpText.<locals>.<genexpr>[   sD   è è € ð ð á
ˆ$�õ ˜4 Ñ)Ô)ðð ð ð ð ð r   )r	   ÚInfoÚ_GetActionsGroupedByKindÚGetFullArgSpecr   ÚGetMetadataÚ_NameSectionÚ_SynopsisSectionÚ_DescriptionSectionÚcallableÚ_ArgsAndFlagsSectionsÚ_UsageDetailsSectionsÚjoin)Ú	componentr   r   ÚinfoÚactions_grouped_by_kindÚspecÚmetadataÚname_sectionÚsynopsis_sectionÚdescription_sectionÚargs_and_flags_sectionsÚnotes_sectionsÚusage_details_sectionsÚsectionsÚvalid_sectionss                  r   ÚHelpTextr7   2   s\  € õ 
Ô	˜9Ñ	%Ô	%€$Ý4°YÈÐPÑPÔPÐÝ	Ô	$ YÑ	/Ô	/€$ÝÔ# IÑ.Ô.€(õ ˜i¨°UÀGÐLÑLÔL€,Ý%ØÐ(¨$°ÀðGñ Gô GÐå+¨I°tÑ<Ô<Ðõ ˆiÑÔð Ý.CØˆd�Hñ/ô /Ñ+Ð˜^˜^ð !ÐØ€NÝ0°Ø1HñJô JÐð Ð%Ð':Ð;Øñ àñð 	ñð ð LÐK¨8ÐKÑKÔK€.Ø	�Šð ð à)ðñ ô ñ 
ô 
ð r   Úreturnútuple[str, str]c                ó  — t          ||¬¦  «        }t          |¦  «        }t          j        | ¦  «        r=t          t
          z
  t          |dz   ¦  «        z
  }t          j        | |t          ¦  «        }|r|› d|› �}n|}d|fS )z&The "Name" section of the help string.©Úinclude_separatorsz - ÚNAME)Ú_GetCurrentCommandÚ_GetSummaryr   ÚNeedsCustomDescriptionÚLINE_LENGTHÚSECTION_INDENTATIONÚlenÚ
GetSummary)r*   r+   r   r   Úcurrent_commandÚsummaryÚavailable_spaceÚtexts           r   r#   r#   a   s©   € õ ' uÀÐIÑIÔI€/Ý˜ÑÔ€'õ Ô/°	Ñ:Ô:ð :Ý!Õ$7Ñ7½#¸oØ>Cñ?Dñ ;Eô ;Eñ E€Oå!Ô,¨Y¸Ý-8ñ:ô :€Gð ð ØÐ+Ð+ 'Ð+Ð+€D€Dà€DØ
�$ˆÐr   c                ót  — t          |d¬¦  «        }t          |¦  «        }g }|r"|                     t          |¦  «        ¦  «         t	          | ¦  «        rDt          ||¦  «        }|r|                     |¦  «         n|r|                     |j        ¦  «         d                     |¦  «        }	|› d|	› �}
d|
fS )z*The "Synopsis" section of the help string.T)r   r<   ú | Ú ÚSYNOPSIS)r>   Ú_GetPossibleActionsÚappendÚ_GetPossibleActionsStringr&   Ú_GetArgsAndFlagsStringÚ	separatorr)   )r*   r,   r-   r.   r   rE   Úpossible_actionsÚcontinuationsÚcallable_continuationÚcontinuationrH   s              r   r$   r$   v   sà   € õ '¨UÀtÐLÑLÔL€/å(Ð)@ÑAÔAÐà€-Øð FØ×ÒÕ2Ð3CÑDÔDÑEÔEÐEÝˆiÑÔð ,Ý2°4¸ÑBÔBÐØð ,Ø×ÒÐ0Ñ1Ô1Ð1Ð1Ø	ð ,ð ×Ò˜5œ?Ñ+Ô+Ð+Ø—’˜MÑ*Ô*€,àÐ	,Ð	,˜lÐ	,Ð	,€$Ø
�dÐ	Ðr   útuple[str, str] | Nonec                ó  — t          j        | ¦  «        rFt          t          z
  }t          j        | |t          ¦  «        }t          j        | |t          ¦  «        }nt          |¦  «        }t          |¦  «        }|p|pd}|rd|fS dS )a5  The "Description" sections of the help string.

  Args:
    component: The component to produce the description section for.
    info: The info dict for the component of interest.

  Returns:
    Returns the description if available. If not, returns the summary.
    If neither are available, returns None.
  NÚDESCRIPTION)r   r@   rA   rB   ÚGetDescriptionrD   Ú_GetDescriptionr?   )r*   r+   rG   ÚdescriptionrF   rH   s         r   r%   r%   Ž   s›   € õ Ô/°	Ñ:Ô:ð  Ý!Õ$7Ñ7€OÝ%Ô4°YÀÝ5@ñBô B€Kå!Ô,¨Y¸Ý-8ñ:ô :€G€Gõ " $Ñ'Ô'€KÝ˜$ÑÔ€Gà	Ð	'˜Ð	' 4€$Ø	ð Ø˜4Ð Ð àˆ4r   c                ó8   — t          | ||| |j        v|¬¦  «        S )N©ÚrequiredÚ	short_arg)Ú_CreateFlagItemÚkwonlydefaults)ÚflagÚdocstring_infor-   r_   s       r   Ú_CreateKeywordOnlyFlagItemrd   ª   s-   € Ý	Ø
ˆN˜D¨4°tÔ7JÐ+JØð
ñ 
ô 
ð r   c                ó`   ‡— d„ | D ¦   «         }t          j        |¦  «        Šˆfd„|D ¦   «         S )zòGets a list of single-character flags that uniquely identify a flag.

  Args:
    flags: list of strings representing flags

  Returns:
    List of single character short flags,
    where the character occurred at the start of a flag once.
  c                ó   — g | ]
}|d          ‘ŒS )r   r   ©r   Úfs     r   r   z"_GetShortFlags.<locals>.<listcomp>º   s   € Ð%Ð%Ð%˜!��1”Ð%Ð%Ð%r   c                ó,   •— g | ]}‰|         d k    ¯|‘ŒS )é   r   )r   ÚvÚshort_flag_countss     €r   r   z"_GetShortFlags.<locals>.<listcomp>¼   s)   ø€ Ð	>Ð	>Ð	>�Ð$5°aÔ$8¸AÒ$=Ð$=ˆ!Ð$=Ð$=Ð$=r   )ÚcollectionsÚCounter)ÚflagsÚshort_flagsrl   s     @r   Ú_GetShortFlagsrq   °   sC   ø€ ð &Ð%˜uÐ%Ñ%Ô%€+Ý!Ô)¨+Ñ6Ô6ÐØ	>Ð	>Ð	>Ð	>�[Ð	>Ñ	>Ô	>Ð>r   c                óä  ‡‡‡‡— ‰j         dt          ‰j         ¦  «        t          ‰j        ¦  «        z
  …         }‰j         t          ‰j         ¦  «        t          ‰j        ¦  «        z
  d…         }|                     t          j        ¦  «        }g }g }| d         Šˆˆfd„|D ¦   «         }‰j        r)|                     t          ‰j        ‰‰¦  «        ¦  «         |r^|rdnd}	|	d 	                    |¦  «         
                    d¦  «        f}
|                     |
¦  «         |r|r|                     d¦  «         t          |¦  «        Šˆˆˆfd„|D ¦   «         }t          ‰j        ¦  «        Šˆˆˆfd	„‰j        D ¦   «         }||z   }‰j        �r0g }‰j         pg }d
„ |D ¦   «         }t          |¦  «        }|D ]}}t          |t          j        ¦  «        ra|j        d         |v r|j        d         }d|› d|j        › �}n
d|j        › �}t%          |j        ‰‰|¬¦  «        }|                     |¦  «         Œ~|r@|r)d}t'          |dd¬¦  «        }|                     |¦  «         |                     |¦  «         t+          ‰j        ‰¦  «        }|rd}n|rd}nd}t'          ||d¬¦  «        }|                     |¦  «         |r,dd 	                    |¦  «        f}|                     |¦  «         ||fS )z1The "Args and Flags" sections of the help string.Nrc   c                ó2   •— g | ]}t          |‰‰¦  «        ‘ŒS r   )Ú_CreateArgItem)r   Úargrc   r-   s     €€r   r   z)_ArgsAndFlagsSections.<locals>.<listcomp>Ì   s5   ø€ ð ð ð à
õ �S˜.¨$Ñ/Ô/ðð ð r   zPOSITIONAL ARGUMENTSÚ	ARGUMENTSÚ
)ÚNOTESz6You can also use flags syntax for POSITIONAL ARGUMENTSc           
     óH   •— g | ]}t          |‰‰d |d         ‰v ¬¦  «        ‘ŒS )Fr   r]   )r`   )r   rb   rc   r-   Úunique_short_argss     €€€r   r   z)_ArgsAndFlagsSections.<locals>.<listcomp>à   sP   ø€ ð ð ð ð
 õ	 Ø
� ¨uØ˜”GÐ0Ð0ðñ ô ðð ð r   c           	     óF   •— g | ]}t          |‰‰|d          ‰v ¬¦  «        ‘ŒS )r   )r_   )rd   )r   rb   rc   r-   Úunique_short_kwonly_flagss     €€€r   r   z)_ArgsAndFlagsSections.<locals>.<listcomp>é   sN   ø€ ð ð ð ð
 õ	 !Ø
� Ø˜”GÐ8Ð8ðñ ô ðð ð r   c                ó   — g | ]	}|j         ‘Œ
S r   ©r   rg   s     r   r   z)_ArgsAndFlagsSections.<locals>.<listcomp>ø   s   € Ð(Ð(Ð(˜Q�!”&Ð(Ð(Ð(r   r   Ú-z, --ú--)Úflag_stringz&The following flags are also accepted.r   ©Úindentz3Additional undocumented flags may also be accepted.zAdditional flags are accepted.zFlags are accepted.ÚFLAGS)ÚargsrC   ÚdefaultsÚgetr   ÚACCEPTS_POSITIONAL_ARGSÚvarargsrN   rt   r)   Úrstriprq   Ú
kwonlyargsÚvarkwÚ
isinstancer   Ú	KwargInfor   r`   Ú_CreateItemÚextendÚ_GetArgDescription)r+   r-   r.   Úargs_with_no_defaultsÚargs_with_defaultsÚaccepts_positional_argsr2   r3   Ú	arg_itemsÚtitleÚarguments_sectionÚpositional_flag_itemsÚkwonly_flag_itemsÚ
flag_itemsÚdocumented_kwargsro   Ú
flag_namesÚunique_short_flagsrb   Ú
short_namer�   Ú	flag_itemÚmessageÚitemr[   Úflags_sectionrc   rz   r|   s    `                        @@@r   r'   r'   ¿   sÏ  øøøø€ àœ)Ð$H¥S¨¬¡^¤^µc¸$¼-Ñ6HÔ6HÑ%HÐ$HÔIÐØ”y¥ T¤Y¡¤µ#°d´mÑ2DÔ2DÑ!DÐ!EÐ!EÔFÐð %ŸLšL­Ô)KÑLÔLÐàÐØ€.àÐ(Ô)€.ðð ð ð ð à&ðñ ô €)ð
 
„\ð Ø×ÒÝ�t”| ^°TÑ:Ô:ñô ð ð ð Ø&=ÐNÐ"Ð"À;€EØ §	¢	¨)Ñ 4Ô 4× ;Ò ;¸DÑ AÔ AÐBÐØ×"Ò"Ð#4Ñ5Ô5Ð5Øð Ð!8ð Ø×ÒØ
Mñô ð õ %Ð%7Ñ8Ô8Ððð ð ð ð ð ð
 %ðñ ô Ðõ -¨T¬_Ñ=Ô=Ððð ð ð ð ð ð
 ”/ðñ ô Ðð %Ð'8Ñ8€*à	„Zñ $àÐð ÔÐ% 2€EØ(Ð( %Ð(Ñ(Ô(€JÝ'¨
Ñ3Ô3ÐØð ,ð ,ˆÝ	�D�*Ô.Ñ	/Ô	/ð 
,ØŒ9�QŒ<Ð-Ð-Ð-Ø”y ”|ˆ*Ø7˜JÐ7Ð7¨D¬IÐ7Ð7ˆ+ˆ+à(˜TœYÐ(Ð(ˆ+å#ØŒI�~ tØ#ð%ñ %ô %ˆ	ð 	× Ò  Ñ+Ô+Ð+øØð +à	ð  Ø:ˆÝ˜7 D°Ð3Ñ3Ô3ˆØ×Ò˜$ÑÔÐØ×ÒÐ)Ñ*Ô*Ð*å$ T¤Z°Ñ@Ô@€KØð &ØE€g€gØ	ð &Ø0€g€gà%€gÝ�w °AÐ6Ñ6Ô6€DØ×Ò�dÑÔÐàð 2Ø˜dŸiši¨
Ñ3Ô3Ð4€MØ×"Ò" =Ñ1Ô1Ð1à	  .Ð	0Ð0r   c                ór  — |\  }}}}g }|j         r"|                     t          |¦  «        ¦  «         |j         r"|                     t          |¦  «        ¦  «         |j         r#|                     t          | |¦  «        ¦  «         |j         r*|                     dt	          d|j        ¦  «        f¦  «         |S )z.The usage details sections of the help string.ÚINDEXESÚINDEX)ÚmembersrN   Ú_MakeUsageDetailsSectionÚ_ValuesUsageDetailsSectionÚ_NewChoicesSectionÚnames)r*   r,   ÚgroupsÚcommandsÚvaluesÚindexesr5   s          r   r(   r(     s¼   € à&=Ñ#€&ˆ(�F˜Gà€(Ø„^ð 6Ø‡O‚OÕ,¨VÑ4Ô4Ñ5Ô5Ð5ØÔð 8Ø‡O‚OÕ,¨XÑ6Ô6Ñ7Ô7Ð7Ø„^ð CØ‡O‚OÕ.¨y¸&ÑAÔAÑBÔBÐBØ„_ð MØ‡O‚O�YÕ 2°7¸G¼MÑ JÔ JÐKÑLÔLÐLà	€/r   c                ó2   — | d         }|j         r|j         nd S ©Nrc   )rF   ©r+   rc   s     r   r?   r?   0  s#   € ØÐ(Ô)€.Ø#1Ô#9Ð	CˆÔ	Ð	¸tÐCr   c                ó2   — | d         }|j         r|j         nd S r°   )r[   r±   s     r   rZ   rZ   5  s#   € ØÐ(Ô)€.Ø'5Ô'AÐ	KˆÔ	#Ð	#ÀtÐKr   c                óŽ  — | j         dt          | j         ¦  «        t          | j        ¦  «        z
  …         }| j         t          | j         ¦  «        t          | j        ¦  «        z
  d…         }|                     t          j        ¦  «        }g }|r0|rd„ |D ¦   «         }nd„ |D ¦   «         }|                     |¦  «         |s| j        s| j        r| 	                    d¦  «         | j
        rFt          j        | j
                             ¦   «         ¦  «        }d|› d�}| 	                    |¦  «         d                     |¦  «        S )a-  The args and flags string for showing how to call a function.

  If positional arguments are accepted, the args will be shown as positional.
  E.g. "ARG1 ARG2 [--flag=FLAG]"

  If positional arguments are disallowed, the args will be shown with flags
  syntax.
  E.g. "--arg1=ARG1 [--flag=FLAG]"

  Args:
    spec: The full arg spec for the component to construct the args and flags
      string for.
    metadata: Metadata for the component, including whether it accepts
      positional arguments.

  Returns:
    The constructed args and flags string.
  Nc                óZ   — g | ](}t          j        |                     ¦   «         ¦  «        ‘Œ)S r   ©r   Ú	UnderlineÚupper©r   ru   s     r   r   z*_GetArgsAndFlagsString.<locals>.<listcomp>V  s;   € ð 7ð 7ð 7Øõ  Ô)¨#¯)ª)©+¬+Ñ6Ô6ð 7ð 7ð 7r   c           	     óf   — g | ].}d |› dt          j        |                     ¦   «         ¦  «        › �‘Œ/S ©r€   Ú=rµ   r¸   s     r   r   z*_GetArgsAndFlagsString.<locals>.<listcomp>Y  sK   € ð ð ð àð 9ˆsÐ
8Ð
8•ZÔ)¨#¯)ª)©+¬+Ñ6Ô6Ð
8Ð
8ðð ð r   ú<flags>Ú[ú]...rK   )r…   rC   r†   r‡   r   rˆ   r�   r‹   rŒ   rN   r‰   r   r¶   r·   r)   )	r-   r.   r’   r“   r”   Úarg_and_flag_stringsÚarg_stringsÚvarargs_underlinedÚvarargs_strings	            r   rP   rP   :  sj  € ð& œ)Ð$H¥S¨¬¡^¤^µc¸$¼-Ñ6HÔ6HÑ%HÐ$HÔIÐØ”y¥ T¤Y¡¤µ#°d´mÑ2DÔ2DÑ!DÐ!EÐ!EÔFÐð %ŸLšL­Ô)KÑLÔLÐàÐØð 	-Øð ð7ð 7Ø 5ð7ñ 7ô 7€k€kðð à*ðñ ô €kð ×Ò Ñ,Ô,Ð,ð ð +˜4œ?ð +¨d¬jð +Ø×Ò 	Ñ*Ô*Ð*à	„\ð 0Ý#Ô-¨d¬l×.@Ò.@Ñ.BÔ.BÑCÔCÐØ1Ð+Ð1Ð1Ð1€NØ×Ò Ñ/Ô/Ð/à	�ŠÐ&Ñ	'Ô	'Ð'r   c                óV   — g }| D ]#}|j         r|                     |j        ¦  «         Œ$|S )z"The list of possible action kinds.)r¦   rN   r   )r,   rR   Úaction_groups      r   rM   rM   k  s@   € àÐØ-ð 1ð 1€lØÔð 1Ø×Ò˜lÔ/Ñ0Ô0Ð0øØ	Ðr   c                ó@   — d                      d„ | D ¦   «         ¦  «        S )zAA help screen string listing the possible action kinds available.rJ   c              3  ób   K  — | ]*}t          j        |                     ¦   «         ¦  «        V — Œ+d S r   rµ   )r   Úactions     r   r   z,_GetPossibleActionsString.<locals>.<genexpr>v  sI   è è € ð 4ð 4Øõ Ô(¨¯ª©¬Ñ8Ô8ð 4ð 4ð 4ð 4ð 4ð 4r   ©r)   )rR   s    r   rO   rO   t  s4   € à	�Šð 4ð 4Ø"2ð4ñ 4ô 4ñ 
4ô 
4ð 4r   c                ó  — t          dd¬¦  «        }t          dd¬¦  «        }t          dd¬¦  «        }t          dd	¬¦  «        }t          j        | |¬
¦  «        }|D ]•\  }}t          |¦  «        }t	          j        |¦  «        r|                     ||¬¦  «         t	          j        |¦  «        r|                     ||¬¦  «         t	          j        |¦  «        r|                     ||¬¦  «         Œ–t          | t          t          f¦  «        rt| rrt          | ¦  «        }	|	dk     rA|                     d                     d„ t          |	¦  «        D ¦   «         ¦  «        ¬¦  «         n|                     d|	dz
  › �¬¦  «         ||||gS )z8Gets lists of available actions, grouped by action kind.Úgroupr«   )r   ÚpluralÚcommandr¬   Úvaluer­   Úindexr®   r   )r   Úmemberé
   ú, c              3  ó4   K  — | ]}t          |¦  «        V — Œd S r   )Ústr)r   Úxs     r   r   z+_GetActionsGroupedByKind.<locals>.<genexpr>Ž  s(   è è € Ð FÐ F¨A¥ Q¡¤Ð FÐ FÐ FÐ FÐ FÐ Fr   r~   z0..rj   )ÚActionGroupr   ÚVisibleMembersrÓ   r
   ÚIsGroupÚAddÚ	IsCommandÚIsValuer�   ÚlistÚtuplerC   r)   Úrange)
r*   r   r«   r¬   r­   r®   r¦   Úmember_namerÏ   Úcomponent_lens
             r   r    r    z  s™  € å˜G¨HÐ5Ñ5Ô5€&Ý˜i°
Ð;Ñ;Ô;€(Ý˜G¨HÐ5Ñ5Ô5€&Ý˜W¨YÐ7Ñ7Ô7€'åÔ% i¸ÐAÑAÔA€'Ø$ð 2ð 2Ñ€k�6Ý�kÑ"Ô"€KÝÔ˜6Ñ"Ô"ð 2Ø‡j‚j�k¨&€jÑ1Ô1Ð1ÝÔ˜VÑ$Ô$ð 4Ø‡l‚l˜¨F€lÑ3Ô3Ð3ÝÔ˜6Ñ"Ô"ð 2Ø‡j‚j�k¨&€jÑ1Ô1Ð1øå�	�D¥%˜=Ñ)Ô)ð 0¨ið 0Ý˜	‘N”N€MØ�rÒÐØ‡k‚k�t—y’yÐ FÐ Fµ°}Ñ1EÔ1EÐ FÑ FÔ FÑFÔF€kÑGÔGÐGÐGà‡k‚kÐ.˜]¨1™_Ð.Ð.€kÑ/Ô/Ð/à
�(˜F GÐ	,Ð,r   Tc                ó<   — | r|                       |¬¦  «        }nd}|S )z@Returns current command for the purpose of generating help text.r;   Ú )Ú
GetCommand)r   r<   rE   s      r   r>   r>   •  s.   € à
ð Ø×&Ò&Ð:LÐ&ÑMÔM€O€Oà€OØ	Ðr   r   rÓ   r   c                ód   — t          j        | ¦  «        › dt          j        |t          ¦  «        › �S ©Nrw   )r   ÚBoldÚIndentrB   )r   r   s     r   r   r   ž  s9   € ÝŒo˜dÑ#Ô#ð 
5ð 
5ÝÔ�7Õ/Ñ0Ô0ð
5ð 
5ð 5r   c                óŽ  — t           t          z
  t          z
  }t          | |¦  «        }t	          j        |                      ¦   «         ¦  «        }t          | |¦  «        }|rd|› �nd}|t          |¦  «        z
  }t	          j	        |||¦  «        }d 
                    d„ ||fD ¦   «         ¦  «        }t          ||t          ¬¦  «        S )aÇ  Returns a string describing a positional argument.

  Args:
    arg: The name of the positional argument.
    docstring_info: A docstrings.DocstringInfo namedtuple with information about
      the containing function's docstring.
    spec: An instance of fire.inspectutils.FullArgSpec, containing type and
      default information about the arguments to a callable.

  Returns:
    A string to be used in constructing the help screen for the function.
  úType: rá   rw   c              3  ó   K  — | ]}|¯|V — Œ	d S r   r   ©r   Úparts     r   r   z!_CreateArgItem.<locals>.<genexpr>¿  s'   è è € ÐKÐK 4ÀdÐK˜$ÐKÐKÐKÐKÐKÐKr   r‚   )rA   rB   ÚSUBSECTION_INDENTATIONr‘   r   ÚBoldUnderliner·   Ú_GetArgTyperC   ÚEllipsisTruncater)   r�   )ru   rc   r-   Úmax_str_lengthr[   Ú
arg_stringÚarg_typerG   s           r   rt   rt   £  sÇ   € õ  Õ!4Ñ4Õ7MÑM€.å" 3¨Ñ7Ô7€+åÔ'¨¯	ª	©¬Ñ4Ô4€*å˜˜dÑ#Ô#€(Ø$,Ð4Ð �hÐ Ð Ð °"€(Ø"¥S¨¡]¤]Ñ2€/åÔ! (¨O¸^ÑLÔLð ð —	’	ÐKÐK¨H°kÐ+BÐKÑKÔKÑKÔK€+å	�Z Õ5KÐ	LÑ	LÔ	LÐLr   c                óp  — t           t          z
  t          z
  }t          | |¦  «        }|s.t	          j        |                      ¦   «         ¦  «        }d| › d|› �}|r|dz  }|r| d         }	d|	› d|› �}t          | |¦  «        }
t          | |¦  «        }|dk    rd|
› d	�}
|
rd
|
› �nd}
|t          |
¦  «        z
  }t	          j
        |
||¦  «        }
|rd|› �nd}|t          |¦  «        z
  }t	          j
        |||¦  «        }d                     d„ |
||fD ¦   «         ¦  «        }t          ||t          ¬¦  «        S )aª  Returns a string describing a flag using docstring and FullArgSpec info.

  Args:
    flag: The name of the flag.
    docstring_info: A docstrings.DocstringInfo namedtuple with information about
      the containing function's docstring.
    spec: An instance of fire.inspectutils.FullArgSpec, containing type and
     default information about the arguments to a callable.
    required: Whether the flag is required.
    flag_string: If provided, use this string for the flag, rather than
      constructing one from the flag name.
    short_arg: Whether the flag has a short variation or not.
  Returns:
    A string to be used in constructing the help screen for the function.
  r€   r»   z (required)r   r   rÑ   ÚNonez	Optional[Ú]rè   rá   z	Default: rw   c              3  ó   K  — | ]}|¯|V — Œ	d S r   r   rê   s     r   r   z"_CreateFlagItem.<locals>.<genexpr>û  s;   è è € ð ð Ø¸tðØ
ðð ð ð ð ð r   r‚   )rA   rB   rì   r‘   r   r¶   r·   rî   Ú_GetArgDefaultrC   rï   r)   r�   )rb   rc   r-   r^   r�   r_   rð   r[   Úflag_name_upperÚ
short_flagrò   Úarg_defaultrG   s                r   r`   r`   Ä  sž  € õ0 Õ!4Ñ4Õ7MÑM€.å" 4¨Ñ8Ô8€+à	ð 0Ý Ô*¨4¯:ª:©<¬<Ñ8Ô8€OØ/�tÐ/Ð/˜oÐ/Ð/€KØð !Ø�=Ñ €KØð 2Ø�a”€JØ1�jÐ1Ð1 KÐ1Ð1€Kå˜˜tÑ$Ô$€(Ý˜t TÑ*Ô*€+ð �FÒÐØ&˜8Ð&Ð&Ð&€Hà$,Ð4Ð �hÐ Ð Ð °"€(Ø"¥S¨¡]¤]Ñ2€/åÔ! (¨O¸^ÑLÔLð ð .9Ð@Ð)˜KÐ)Ð)Ð)¸b€+Ø"¥S¨Ñ%5Ô%5Ñ5€/åÔ! +¨ÀÑOÔOð ð —	’	ð ð Ø  +¨{Ð;ðñ ô ñ ô €+õ 
�[ +Õ6LÐ	MÑ	MÔ	MÐMr   c                ó€   — | |j         v r4|j         |          }	 |j        S # t          $ r t          |¦  «        cY S w xY wdS )a|  Returns a string describing the type of an argument.

  Args:
    arg: The name of the argument.
    spec: An instance of fire.inspectutils.FullArgSpec, containing type and
     default information about the arguments to a callable.
  Returns:
    A string to be used in constructing the help screen for the function, the
    empty string if the argument type is not available.
  rá   )r   Ú__qualname__ÚAttributeErrorÚrepr)ru   r-   rò   s      r   rî   rî     sc   € ð 	ˆDÔÐÐØÔ Ô$€HðØÔ"Ð"øÝð ð ð õ �(‰^Œ^ÐÐÐð	øøøð
 
ˆs   ˜ Ÿ;º;c                óø   — t          |j        ¦  «        }|j        | d…         }t          ||j        ¦  «        D ]\  }}|| k    rt	          |¦  «        c S Œ| |j        v rt	          |j        |          ¦  «        S dS )aš  Returns a string describing a flag's default value.

  Args:
    flag: The name of the flag.
    spec: An instance of fire.inspectutils.FullArgSpec, containing type and
     default information about the arguments to a callable.
  Returns:
    A string to be used in constructing the help screen for the function, the
    empty string if the flag does not have a default or the default is not
    available.
  Nrá   )rC   r†   r…   Úziprþ   ra   )rb   r-   Únum_defaultsr“   ru   Údefaults         r   r÷   r÷     s�   € õ �T”]Ñ#Ô#€,Ø”y ,   Ô0ÐåÐ,¨d¬mÑ<Ô<ð ð �l€cˆ7Ø
ˆd‚{€{Ý�'‰]Œ]ÐÐÐð à	ˆTÔ Ð Ð Ý�Ô# DÔ)Ñ*Ô*Ð*Ø	ˆr   é   c                óB   — |s| S t          j        ||¦  «        }| › d|› �S rä   )r   ræ   )r   r[   rƒ   s      r   r�   r�   0  s@   € Ø	ð Ø€KÝÔ! +¨vÑ6Ô6€+Øð 
ð 
Øð
ð 
ð r   c                ó^   — |j         r%|j         D ]}|j        | d| › �d| › �fv r	|j        c S Œd S )NÚ*z**)r…   r   r[   )r   rc   Úarg_in_docstrings      r   r‘   r‘   8  s[   € ØÔð ,Ø*Ô/ð ,ð ,ÐØ	Ô	 4¨¨T¨¨°[¸$°[°[Ð"AÐ	AÐ	AØÔ+Ð+Ð+Ð+ð 
Bà	ˆr   c                ó  — g }|                       ¦   «         D ]²\  }}t          j        |¦  «        }|}|                     d¦  «        }|rt	          j        |¦  «        s|j        }n?t	          j        |¦  «        r)t	          j        |t          t          z
  t          ¦  «        }nd}t          ||¦  «        }|                     |¦  «         Œ³| j                             ¦   «         t          | j                             ¦   «         |¦  «        fS )z>Creates a usage details section for the provided action group.rc   N)ÚGetItemsr	   r   r‡   r   r@   rF   rD   rA   rB   r�   rN   rË   r·   r©   r   )rÄ   Úitem_stringsr   rÏ   r+   r¡   rc   rF   s           r   r§   r§   @  s  € à€,Ø"×+Ò+Ñ-Ô-ð ð �l€dˆFÝÔ˜VÑ$Ô$€DØ€DØ—X’XÐ.Ñ/Ô/€NØð Ý#Ô:¸6ÑBÔBðàÔ&€g€gÝ	Ô	3°FÑ	;Ô	;ð Ý#Ô.Ø
•+Õ 3Ñ3µ[ñBô B€g€gð €gÝ�t˜WÑ%Ô%€DØ×Ò˜ÑÔÐÐØ
Ô
×
#Ò
#Ñ
%Ô
%Ý
˜\Ô.×4Ò4Ñ6Ô6¸Ñ
EÔ
Eð
Gð Gr   c                óf  — g }|                      ¦   «         D ]‰\  }}~t          j        | j        j        ¦  «        }d}d|v r9|d         }|j        r*|j        D ]"}|j        |k    rt          ||j        ¦  «        }Œ#|€t          |¦  «        }| 
                    |¦  «         ŒŠdt          d|¦  «        fS )zDCreates a section tuple for the values section of the usage details.Nrc   ÚVALUESÚVALUE)r	  r	   r   Ú	__class__Ú__init__r…   r   r�   r[   rÓ   rN   r©   )	r*   r­   Úvalue_item_stringsÚ
value_namerÍ   Ú	init_infoÚ
value_itemÚinit_docstring_infoÚarg_infos	            r   r¨   r¨   U  sÚ   € àÐØ!Ÿ?š?Ñ,Ô,ð *ð *Ñ€j�%ØÝÔ! )Ô"5Ô">Ñ?Ô?€IØ€JØ˜9Ð$Ð$Ø%Ð&6Ô7ÐØ	Ô	!ð GØ+Ô0ð 	Gð 	GˆHØŒ]˜jÒ(Ð(Ý$ Z°Ô1EÑFÔFˆJøØÐÝ�z‘?”?€jØ×Ò˜jÑ)Ô)Ð)Ð)Ø
Õ& wÐ0BÑCÔCÐ	DÐDr   c                ó¤   — t          j        t          j        | ¦  «        ¦  «        }t          |› d�dd                     |¦  «        z   d¬¦  «        S )Nz is one of the following:rw   r   rj   r‚   )r   rå   r¶   r�   r)   )r   ÚchoicesÚname_formatteds      r   r©   r©   h  sV   € Ý”?¥:Ô#7¸Ñ#=Ô#=Ñ>Ô>€.Ý	Ø	Ð2Ð2Ð2Ø
ˆV�[Š[˜Ñ!Ô!Ñ!Øð
ñ 
ô 
ð r   c                ó  — |r)|                      ¦   «         }|                     ¦   «         }nd}d}|sd}|}t          j        | ¦  «        }t	          j        | ¦  «        }t          | |¬¦  «        }t          |¦  «        }	g }
|	r"|
                     t          |	¦  «        ¦  «         t          |¦  «        }t          | ¦  «        ryt          ||¦  «        }|r)|
                     d                     |¦  «        ¦  «         n|r|
                     |j        ¦  «         |                     t!          |¦  «        ¦  «         |
r|dd                     |
¦  «        z   z  }||rdndz   dz   }d	|› d
d                     |¦  «        › d|› �S )aD  Returns usage text for the given component.

  Args:
    component: The component to determine the usage text for.
    trace: The Fire trace object containing all metadata of current execution.
    verbose: Whether to display the usage text in verbose mode.

  Returns:
    String suitable for display in an error screen.
  NFrá   r   rK   rJ   z -- z--helpzUsage: rw   z2
For detailed information on this command, run:
  )râ   ÚNeedsSeparatingHyphenHyphenr	   r!   r   r"   r    rM   rN   Ú_GetPossibleActionsUsageStringÚ_UsageAvailabilityLinesr&   Ú_GetCallableUsageItemsr)   rQ   r�   Ú_GetCallableAvailabilityLines)r*   r   r   rÌ   Úneeds_separating_hyphen_hyphenÚcontinued_commandr-   r.   r,   rR   rS   Úavailability_linesÚcallable_itemsÚhelp_commands                 r   Ú	UsageTextr$  p  sÜ  € ð ð +Ø×ÒÑ Ô €GØ%*×%FÒ%FÑ%HÔ%HÐ"Ð"à€GØ%*Ð"à	ð Ø€Gð Ðå	Ô	$ YÑ	/Ô	/€$ÝÔ# IÑ.Ô.€(õ 5°YÈÐPÑPÔPÐÝ(Ð)@ÑAÔAÐà€-Øð KØ×ÒÕ7Ð8HÑIÔIÑJÔJÐJå.Ð/FÑGÔGÐåˆiÑÔð CÝ+¨D°(Ñ;Ô;€NØð ,Ø×Ò˜3Ÿ8š8 NÑ3Ô3Ñ4Ô4Ð4Ð4Ø	ð ,Ø×Ò˜5œ?Ñ+Ô+Ð+Ø×ÒÕ;¸DÑAÔAÑBÔBÐBàð 9Ø˜˜uŸzšz¨-Ñ8Ô8Ñ8Ñ8ÐàØ1Ð	:ˆˆ°sñ<àñð ð
Ð&ð 
ð 
Ø‡‚Ð	ÑÔð
ð 
ð ð
ð 
ð r   c                ó@   — | rd                      | ¦  «        }d|› d�S d S )NÚ|Ú<Ú>rÈ   )rR   Úactions_strs     r   r  r  ¬  s2   € Øð Ø—(’(Ð+Ñ,Ô,€KØˆ{ÐÐÐÐØ	ˆr   c                óŠ   — g }| D ]=}|j         r4t          d|j        › d�|j        ¬¦  «        }|                     |¦  «         Œ>|S )Nz
available ú:)ÚheaderÚitems)r¦   Ú_CreateAvailabilityLinerË   rª   rN   )r,   r!  rÄ   Úavailability_lines       r   r  r  ³  sl   € ØÐØ-ð 3ð 3€lØÔð 3Ý1Ø4˜lÔ1Ð4Ð4Ð4ØÔ"ðñ ô Ðð ×ÒÐ 1Ñ2Ô2Ð2øØ	Ðr   c                ó
  — | j         dt          | j         ¦  «        t          | j        ¦  «        z
  …         }| j         t          | j         ¦  «        t          | j        ¦  «        z
  d…         }|                     t          j        ¦  «        }|sd„ |D ¦   «         }nd„ |D ¦   «         }|s| j        s| j        r|                     d¦  «         | j	        r0|                     d| j	         
                    ¦   «         › d�¦  «         |S )zBA list of elements that comprise the usage summary for a callable.Nc                óB   — g | ]}d |› d|                      ¦   «         › �‘ŒS rº   ©r·   r¸   s     r   r   z*_GetCallableUsageItems.<locals>.<listcomp>È  s@   € ð /ð /ð /Øð &�#Ð%Ð%˜Ÿ	š	™œÐ%Ð%ð /ð /ð /r   c                ó6   — g | ]}|                      ¦   «         ‘ŒS r   r2  r¸   s     r   r   z*_GetCallableUsageItems.<locals>.<listcomp>Ë  s    € Ð:Ð:Ð:˜SˆS�YŠY‰[Œ[Ð:Ð:Ð:r   r¼   r½   r¾   )r…   rC   r†   r‡   r   rˆ   r‹   rŒ   rN   r‰   r·   )r-   r.   r’   r“   r”   r-  s         r   r  r  ¿  s  € àœ)Ð$H¥S¨¬¡^¤^µc¸$¼-Ñ6HÔ6HÑ%HÐ$HÔIÐØ”y¥ T¤Y¡¤µ#°d´mÑ2DÔ2DÑ!DÐ!EÐ!EÔFÐð %ŸLšL­Ô)KÑLÔLÐà	 ð ;ð/ð /Ø-ð/ñ /ô /€E€Eð ;Ð:Ð$9Ð:Ñ:Ô:€Eð ð ˜4œ?ð ¨d¬jð Ø	‡L‚L�ÑÔÐà	„\ð 1Ø	‡L‚LÐ/�T”\×'Ò'Ñ)Ô)Ð/Ð/Ð/Ñ0Ô0Ð0à	€,r   c                ó.   ‡ ‡— ˆˆ fd„‰ j         D ¦   «         S )Nc              3  ó6   •K  — | ]}‰|‰j         v k    ¯|V — Œd S r   )ra   )r   rb   r^   r-   s     €€r   r   z(_KeywordOnlyArguments.<locals>.<genexpr>Ø  sA   øè è € ð 
8ð 
8�4Ø˜$ $Ô"5Ð5Ò6Ð6ð Ø6Ð6Ð6Ð6ð
8ð 
8r   )r‹   )r-   r^   s   ``r   Ú_KeywordOnlyArgumentsr6  ×  s5   øø€ ð
8ð 
8ð 
8ð 
8ð 
8˜4œ?ð 
8ñ 
8ô 
8ð 8r   c                ó  — | j         t          | j         ¦  «        t          | j        ¦  «        z
  d…         }d„ t          j        |t          | d¬¦  «        ¦  «        D ¦   «         }d„ t          | d¬¦  «        D ¦   «         }g }|r%|                     t          d|d¬	¦  «        ¦  «         |r%|                     t          d
|d¬	¦  «        ¦  «         | j        r-|s|rdnd}|                     t          |g d¬	¦  «        ¦  «         |S )zHThe list of availability lines for a callable for use in a usage string.Nc                ó   — g | ]}d |› �‘ŒS ©r€   r   ©r   rb   s     r   r   z1_GetCallableAvailabilityLines.<locals>.<listcomp>á  s0   € ð Hð Hð H D�K˜�K�Kð Hð Hð Hr   F)r^   c                ó   — g | ]}d |› �‘ŒS r9  r   r:  s     r   r   z1_GetCallableAvailabilityLines.<locals>.<listcomp>ã  s+   € ð ð ð Ø€kˆ4€k€kðð ð r   Tzoptional flags:r  )r,  r-  Úheader_indentzrequired flags:zadditional flags are acceptedzflags are accepted)	r…   rC   r†   Ú	itertoolsÚchainr6  rN   r.  rŒ   )r-   r“   Úoptional_flagsÚrequired_flagsr!  Úadditional_flagss         r   r  r  Ü  s~  € à”y¥ T¤Y¡¤µ#°d´mÑ2DÔ2DÑ!DÐ!EÐ!EÔFÐðHð H­I¬OØÕ/°¸uÐEÑEÔEñ-Gô -Gð Hñ Hô H€.ðð Ý3°DÀ4ÐHÑHÔHðñ ô €.ð
 ÐØð 2Ø×ÒÝÐ'8ÀØ./ð	1ñ 	1ô 	1ñ2ô 2ð 2ð ð 2Ø×ÒÝÐ'8ÀØ./ð	1ñ 	1ô 	1ñ2ô 2ð 2ð 
„Zð 2à)ð-Ø-;ð-Ð7Ð7à,ð ð ×ÒÝÐ'7¸rØ./ð	1ñ 	1ô 	1ñ2ô 2ð 2ð 
Ðr   é   c                óð   — ||z
  }d                      t          j        ||¬¦  «        ¦  «        }t          j        ||¬¦  «        }t          j        | |¬¦  «        }||t	          |¦  «        d …         z   dz   S )Nrw   )Úwidth)Úspaces)r)   r   ÚWrappedJoinræ   rC   )	r,  r-  r<  Úitems_indentÚline_lengthÚitems_widthÚ
items_textÚindented_items_textÚindented_headers	            r   r.  r.  û  s~   € ð ˜lÑ*€+Ø�yŠy�Ô/°¸[ÐIÑIÔIÑJÔJ€*Ý"Ô)¨*¸\ÐJÑJÔJÐÝÔ% f°]ÐCÑCÔC€/Ø	Ð.­s°?Ñ/CÔ/CÐ/DÐ/DÔEÑ	EÈÑ	LÐLr   c                  ó&   — e Zd ZdZd„ Zdd„Zd„ ZdS )rÕ   z$A group of actions of the same kind.c                ó>   — || _         || _        g | _        g | _        d S r   )r   rË   rª   r¦   )Úselfr   rË   s      r   r  zActionGroup.__init__  s"   € Ø€D„IØ€D„KØ€D„JØ€D„L€L€Lr   Nc                ón   — | j                              |¦  «         | j                             |¦  «         d S r   )rª   rN   r¦   )rO  r   rÏ   s      r   rØ   zActionGroup.Add  s4   € Ø„J×Ò�dÑÔÐØ„L×Ò˜ÑÔÐÐÐr   c                ó6   — t          | j        | j        ¦  «        S r   )r   rª   r¦   )rO  s    r   r	  zActionGroup.GetItems  s   € ÝˆtŒz˜4œ<Ñ(Ô(Ð(r   r   )Ú__name__Ú
__module__rü   Ú__doc__r  rØ   r	  r   r   r   rÕ   rÕ     sL   € € € € € Ø,Ð,ðð ð ð ð  ð  ð  ð)ð )ð )ð )ð )r   rÕ   )NF)r8   r9   r   )r8   rV   )F)NT)r   rÓ   r   rÓ   r8   rÓ   )FNF)r  )T)1rT  Ú
__future__r   rm   r=  Úfirer   r   r   r   r   r	   r
   rA   rB   rì   r7   r#   r$   r%   rd   rq   r'   r(   r?   rZ   rP   rM   rO   r    r>   r   rt   r`   rî   r÷   r�   r‘   r§   r¨   r©   r$  r  r  r  r6  r  r.  rÕ   r   r   r   ú<module>rW     sZ  ððð ð" #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø Ð Ð Ð à Ð Ð Ð Ð Ð Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à€ØÐ ØÐ ð,ð ,ð ,ð ,ð^ð ð ð ð ð,  ðð ð ð ð ð0ð ð ð ð8ð ð ð?ð ?ð ?ð]1ð ]1ð ]1ð@ð ð ð"Dð Dð Dð
Lð Lð Lð
.(ð .(ð .(ðbð ð ð4ð 4ð 4ð-ð -ð -ð -ð6ð ð ð ð5ð 5ð 5ð 5ð
Mð Mð MðB :?Ø05ð;Nð ;Nð ;Nð ;Nð|ð ð ð.ð ð ð.ð ð ð ðð ð ðGð Gð Gð*Eð Eð Eð&ð ð ð9ð 9ð 9ð 9ðxð ð ð	ð 	ð 	ðð ð ð08ð 8ð 8ð 8ð
ð ð ð@ +,¸"Ø(3ðMð Mð Mð Mð)ð )ð )ð )ð )ñ )ô )ð )ð )ð )r   