MCPcopy Create free account
hub / github.com/aws/aws-cli / _render_rows

Method _render_rows

awscli/table.py:349–380  ·  view source on GitHub ↗
(self, section, max_width, stream)

Source from the content-addressed store, hash-verified

347 stream.write(''.join(parts))
348
349 def _render_rows(self, section, max_width, stream):
350 if not section.rows:
351 return
352 widths = section.calculate_column_widths(
353 padding=4, max_width=max_width
354 )
355 if not widths:
356 return
357 self._write_line_break(stream, widths)
358 for row in section.rows:
359 # TODO: Built the string in a list then join instead of using +=,
360 # it's more efficient.
361 current = ''
362 length_so_far = 0
363 first = True
364 for width, element in zip(widths, row):
365 if first:
366 left_edge = '|'
367 first = False
368 else:
369 left_edge = ''
370 stylized = self._styler.style_row_element(element)
371 current += align_left(
372 text=stylized,
373 length=width,
374 left_edge=left_edge,
375 right_edge=self._column_separator,
376 text_length=get_text_length(element),
377 )
378 length_so_far += width
379 stream.write(current + '\n')
380 self._write_line_break(stream, widths)
381
382
383class Section:

Callers 1

_render_sectionMethod · 0.95

Calls 6

_write_line_breakMethod · 0.95
align_leftFunction · 0.85
get_text_lengthFunction · 0.85
style_row_elementMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected