Determine if the given parameter is an argument that can still accept values. :param ctx: Invocation context for the command represented by the parsed complete args. :param param: Argument object being checked.
(ctx: Context, param: Parameter)
| 541 | |
| 542 | |
| 543 | def _is_incomplete_argument(ctx: Context, param: Parameter) -> bool: |
| 544 | """Determine if the given parameter is an argument that can still |
| 545 | accept values. |
| 546 | |
| 547 | :param ctx: Invocation context for the command represented by the |
| 548 | parsed complete args. |
| 549 | :param param: Argument object being checked. |
| 550 | """ |
| 551 | if not isinstance(param, Argument): |
| 552 | return False |
| 553 | |
| 554 | value = ctx.params.get(param.name) |
| 555 | return ( |
| 556 | param.nargs == -1 |
| 557 | or ctx.get_parameter_source(param.name) is not ParameterSource.COMMANDLINE |
| 558 | or ( |
| 559 | param.nargs > 1 |
| 560 | and isinstance(value, (tuple, list)) |
| 561 | and len(value) < param.nargs |
| 562 | ) |
| 563 | ) |
| 564 | |
| 565 | |
| 566 | def _start_of_option(ctx: Context, value: str) -> bool: |
no test coverage detected