MCPcopy
hub / github.com/google/python-fire / _ValuesUsageDetailsSection

Function _ValuesUsageDetailsSection

fire/helptext.py:597–613  ·  view source on GitHub ↗

Creates a section tuple for the values section of the usage details.

(component, values)

Source from the content-addressed store, hash-verified

595
596
597def _ValuesUsageDetailsSection(component, values):
598 """Creates a section tuple for the values section of the usage details."""
599 value_item_strings = []
600 for value_name, value in values.GetItems():
601 del value
602 init_info = inspectutils.Info(component.__class__.__init__)
603 value_item = None
604 if 'docstring_info' in init_info:
605 init_docstring_info = init_info['docstring_info']
606 if init_docstring_info.args:
607 for arg_info in init_docstring_info.args:
608 if arg_info.name == value_name:
609 value_item = _CreateItem(value_name, arg_info.description)
610 if value_item is None:
611 value_item = str(value_name)
612 value_item_strings.append(value_item)
613 return ('VALUES', _NewChoicesSection('VALUE', value_item_strings))
614
615
616def _NewChoicesSection(name, choices):

Callers 1

_UsageDetailsSectionsFunction · 0.85

Calls 3

_CreateItemFunction · 0.85
_NewChoicesSectionFunction · 0.85
GetItemsMethod · 0.80

Tested by

no test coverage detected