def stats_to_str(stats, isyeb=False): """ Pretty print build statistics to string. """ if not isinstance(stats, (OrderedDict, dict)): raise EasyBuildError("Can only pretty print build stats in dictionary form, not of type %s", type(stats)) txt = "{\n" pref = " " for key in sorted(stats): if isyeb: val = stats[key] if isinstance(val, tuple): val = list(val) key, val = quote_yaml_special_chars(key), quote_yaml_special_chars(val) else: key, val = quote_str(key), quote_str(stats[key]) txt += "%s%s: %s,\n" % (pref, key, val) txt += "}" return txt
def stats_to_str(stats, isyeb=False): """ Pretty print build statistics to string. """ if not isinstance(stats, (OrderedDict, dict)): raise EasyBuildError("Can only pretty print build stats in dictionary form, not of type %s", type(stats)) txt = "{\n" pref = " " for key in sorted(stats): if isyeb: val = stats[key] if isinstance(val, tuple): val = list(val) key, val = quote_yaml_special_chars(key), quote_yaml_special_chars(val) else: key, val = quote_str(key), quote_str(stats[key]) txt += "%s%s: %s,\n" % (pref, key, val) txt += "}" return txt