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

Function _consume_google_args_line

fire/docstrings.py:386–408  ·  view source on GitHub ↗

Consume a single line from a Google args section.

(line_info, state)

Source from the content-addressed store, hash-verified

384
385
386def _consume_google_args_line(line_info, state):
387 """Consume a single line from a Google args section."""
388 split_line = line_info.remaining.split(':', 1)
389 if len(split_line) > 1:
390 first, second = split_line # first is either the "arg" or "arg (type)"
391 if _is_arg_name(first.strip()):
392 arg = _get_or_create_arg_by_name(state, first.strip())
393 arg.description.lines.append(second.strip())
394 state.current_arg = arg
395 else:
396 arg_name_and_type = _as_arg_name_and_type(first)
397 if arg_name_and_type:
398 arg_name, type_str = arg_name_and_type
399 arg = _get_or_create_arg_by_name(state, arg_name)
400 arg.type.lines.append(type_str)
401 arg.description.lines.append(second.strip())
402 state.current_arg = arg
403 else:
404 if state.current_arg:
405 state.current_arg.description.lines.append(split_line[0])
406 else:
407 if state.current_arg:
408 state.current_arg.description.lines.append(split_line[0])
409
410
411def _consume_line(line_info, state):

Callers 1

_consume_lineFunction · 0.85

Calls 3

_is_arg_nameFunction · 0.85
_as_arg_name_and_typeFunction · 0.85

Tested by

no test coverage detected