MCPcopy Index your code
hub / github.com/google/python-fire / _DescriptionSection

Function _DescriptionSection

fire/helptext.py:142–167  ·  view source on GitHub ↗

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

(component, info)

Source from the content-addressed store, hash-verified

140
141
142def _DescriptionSection(component, info) -> tuple[str, str] | None:
143 """The "Description" sections of the help string.
144
145 Args:
146 component: The component to produce the description section for.
147 info: The info dict for the component of interest.
148
149 Returns:
150 Returns the description if available. If not, returns the summary.
151 If neither are available, returns None.
152 """
153 if custom_descriptions.NeedsCustomDescription(component):
154 available_space = LINE_LENGTH - SECTION_INDENTATION
155 description = custom_descriptions.GetDescription(component, available_space,
156 LINE_LENGTH)
157 summary = custom_descriptions.GetSummary(component, available_space,
158 LINE_LENGTH)
159 else:
160 description = _GetDescription(info)
161 summary = _GetSummary(info)
162 # Fall back to summary if description is not available.
163 text = description or summary or None
164 if text:
165 return ('DESCRIPTION', text)
166 else:
167 return None
168
169
170def _CreateKeywordOnlyFlagItem(flag, docstring_info, spec, short_arg):

Callers 1

HelpTextFunction · 0.85

Calls 2

_GetDescriptionFunction · 0.85
_GetSummaryFunction · 0.85

Tested by

no test coverage detected