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

Function _as_arg_names

fire/docstrings.py:345–364  ·  view source on GitHub ↗

Converts names_str to a list of arg names. Example: _as_arg_names("a, b, c") == ["a", "b", "c"] Args: names_str: A string with multiple space or comma separated arg names. Returns: A list of arg names, or None if names_str doesn't look like a list of arg names.

(names_str)

Source from the content-addressed store, hash-verified

343
344
345def _as_arg_names(names_str):
346 """Converts names_str to a list of arg names.
347
348 Example:
349 _as_arg_names("a, b, c") == ["a", "b", "c"]
350
351 Args:
352 names_str: A string with multiple space or comma separated arg names.
353 Returns:
354 A list of arg names, or None if names_str doesn't look like a list of arg
355 names.
356 """
357 names = re.split(',| ', names_str)
358 names = [name.strip() for name in names if name.strip()]
359 for name in names:
360 if not _is_arg_name(name):
361 return None
362 if not names:
363 return None
364 return names
365
366
367def _cast_to_known_type(name):

Callers 1

_consume_lineFunction · 0.85

Calls 1

_is_arg_nameFunction · 0.85

Tested by

no test coverage detected