예제 #1
0
def _coerce_flags_data(data):
    if isinstance(data, list):
        return data
    elif isinstance(data, dict):
        return flag_util.format_flag_assigns(data)
    else:
        _error("invalid flags value %r" % data)
예제 #2
0
def _default_run_label(flag_vals):
    """Returns a default run label for a map of flag values.

    The default label is a string containing flag assign as NAME=VALUE.
    """
    non_null = {
        name: val
        for name, val in flag_vals.items() if val is not None
    }
    return " ".join(
        flag_util.format_flag_assigns(non_null,
                                      truncate_floats=True,
                                      shorten_paths=True))
예제 #3
0
def flags_desc(flags, truncate_floats=False, delim=", "):
    formatted = flag_util.format_flag_assigns(flags, truncate_floats)
    return delim.join(formatted)
예제 #4
0
def _step_flag_args(step):
    return flag_util.format_flag_assigns(step.flags)