def _coerce_flags_data(data): if isinstance(data, list): return data elif isinstance(data, dict): return flag_util.flag_assigns(data) else: _error("invalid flags value %r" % data)
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.flag_assigns(non_null, truncate_floats=True, shorten_paths=True) )
def _step_flag_args(step): return flag_util.flag_assigns(step.flags)
def _resources_desc(resources): from guild import flag_util return " ".join(flag_util.flag_assigns(resources))
def flags_desc(flags, truncate_floats=False, delim=", "): formatted = flag_util.flag_assigns(flags, truncate_floats) return delim.join(formatted)