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

Function _GetShortFlags

fire/helptext.py:176–188  ·  view source on GitHub ↗

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.

(flags)

Source from the content-addressed store, hash-verified

174
175
176def _GetShortFlags(flags):
177 """Gets a list of single-character flags that uniquely identify a flag.
178
179 Args:
180 flags: list of strings representing flags
181
182 Returns:
183 List of single character short flags,
184 where the character occurred at the start of a flag once.
185 """
186 short_flags = [f[0] for f in flags]
187 short_flag_counts = collections.Counter(short_flags)
188 return [v for v in short_flags if short_flag_counts[v] == 1]
189
190
191def _ArgsAndFlagsSections(info, spec, metadata):

Callers 1

_ArgsAndFlagsSectionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected