MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / _format_line

Function _format_line

tensorboard/encode_png_benchmark.py:89–109  ·  view source on GitHub ↗

Format a line of a table. Arguments: headers: A list of strings that are used as the table headers. fields: A list of the same length as `headers` where `fields[i]` is the entry for `headers[i]` in this row. Elements can be of arbitrary types. Pass `headers` to print

(headers, fields)

Source from the content-addressed store, hash-verified

87
88
89def _format_line(headers, fields):
90 """Format a line of a table.
91
92 Arguments:
93 headers: A list of strings that are used as the table headers.
94 fields: A list of the same length as `headers` where `fields[i]` is
95 the entry for `headers[i]` in this row. Elements can be of
96 arbitrary types. Pass `headers` to print the header row.
97
98 Returns:
99 A pretty string.
100 """
101 assert len(fields) == len(headers), (fields, headers)
102 fields = [
103 "%2.4f" % field if isinstance(field, float) else str(field)
104 for field in fields
105 ]
106 return " ".join(
107 " " * max(0, len(header) - len(field)) + field
108 for (header, field) in zip(headers, fields)
109 )
110
111
112def main(unused_argv):

Callers 1

mainFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…