Consume a single line from a Google args section.
(line_info, state)
| 384 | |
| 385 | |
| 386 | def _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 | |
| 411 | def _consume_line(line_info, state): |
no test coverage detected