2929information.
3030"""
3131
32+ from __future__ import annotations
33+
3234import collections
3335import itertools
3436
@@ -91,7 +93,7 @@ def HelpText(component, trace=None, verbose=False):
9193 )
9294
9395
94- def _NameSection (component , info , trace = None , verbose = False ):
96+ def _NameSection (component , info , trace = None , verbose = False ) -> tuple [ str , str ] :
9597 """The "Name" section of the help string."""
9698
9799 # Only include separators in the name in verbose mode.
@@ -113,7 +115,7 @@ def _NameSection(component, info, trace=None, verbose=False):
113115
114116
115117def _SynopsisSection (component , actions_grouped_by_kind , spec , metadata ,
116- trace = None ):
118+ trace = None ) -> tuple [ str , str ] :
117119 """The "Synopsis" section of the help string."""
118120 current_command = _GetCurrentCommand (trace = trace , include_separators = True )
119121
@@ -136,7 +138,7 @@ def _SynopsisSection(component, actions_grouped_by_kind, spec, metadata,
136138 return ('SYNOPSIS' , text )
137139
138140
139- def _DescriptionSection (component , info ):
141+ def _DescriptionSection (component , info ) -> tuple [ str , str ] | None :
140142 """The "Description" sections of the help string.
141143
142144 Args:
@@ -185,7 +187,7 @@ def _GetShortFlags(flags):
185187 return [v for v in short_flags if short_flag_counts [v ] == 1 ]
186188
187189
188- def _ArgsAndFlagsSections (info , spec , metadata ):
190+ def _ArgsAndFlagsSections (info , spec , metadata ) -> tuple [ list [ tuple [ str , str ]], list [ tuple [ str , str ]]] :
189191 """The "Args and Flags" sections of the help string."""
190192 args_with_no_defaults = spec .args [:len (spec .args ) - len (spec .defaults )]
191193 args_with_defaults = spec .args [len (spec .args ) - len (spec .defaults ):]
@@ -408,7 +410,7 @@ def _GetCurrentCommand(trace=None, include_separators=True):
408410 return current_command
409411
410412
411- def _CreateOutputSection (name , content ) :
413+ def _CreateOutputSection (name : str , content : str ) -> str :
412414 return f"""{ formatting .Bold (name )}
413415{ formatting .Indent (content , SECTION_INDENTATION )} """
414416
0 commit comments