MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / extend

Method extend

tensorflow/python/debug/cli/debugger_cli_common.py:270–300  ·  view source on GitHub ↗

Extend this instance of RichTextLines with another instance. The extension takes effect on the text lines, the font attribute segments, as well as the annotations. The line indices in the font attribute segments and the annotations are adjusted to account for the existing lines. If

(self, other)

Source from the content-addressed store, hash-verified

268 lines, font_attr_segs=font_attr_segs, annotations=annotations)
269
270 def extend(self, other):
271 """Extend this instance of RichTextLines with another instance.
272
273 The extension takes effect on the text lines, the font attribute segments,
274 as well as the annotations. The line indices in the font attribute
275 segments and the annotations are adjusted to account for the existing
276 lines. If there are duplicate, non-line-index fields in the annotations,
277 the value from the input argument "other" will override that in this
278 instance.
279
280 Args:
281 other: (RichTextLines) The other RichTextLines instance to be appended at
282 the end of this instance.
283 """
284
285 orig_num_lines = self.num_lines() # Record original number of lines.
286
287 # Merge the lines.
288 self._lines.extend(other.lines)
289
290 # Merge the font_attr_segs.
291 for line_index in other.font_attr_segs:
292 self._font_attr_segs[orig_num_lines + line_index] = (
293 other.font_attr_segs[line_index])
294
295 # Merge the annotations.
296 for key in other.annotations:
297 if isinstance(key, int):
298 self._annotations[orig_num_lines + key] = (other.annotations[key])
299 else:
300 self._annotations[key] = other.annotations[key]
301
302 def _extend_before(self, other):
303 """Add another RichTextLines object to the front.

Callers 15

_run_info_handlerMethod · 0.95
get_run_start_introFunction · 0.95
format_tensorFunction · 0.95
get_helpMethod · 0.95
list_profileMethod · 0.95
list_tensorsMethod · 0.95
node_infoMethod · 0.95
_list_node_dumpsMethod · 0.95

Calls 1

num_linesMethod · 0.95