Exemple #1
0
def _extract_cli_options(
    attrdict, ) -> List[Tuple[str, Union[_Option, _MutuallyExclusiveGroup]]]:
    """Returns any members that are CLI options as a list of tuples on the form
    (member_name, option).
    """
    return [(key, value) for key, value in attrdict.items()
            if cli.is_cli_arg(value)]
Exemple #2
0
def _flatten_arg(arg_tup):
    name, arg = arg_tup
    assert cli.is_cli_arg(arg)

    if isinstance(arg, _MutuallyExclusiveGroup):
        return itertools.chain.from_iterable(map(_flatten_arg, arg.options))
    else:
        return [arg_tup]