Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Data
rows = self._get_rows(options)
formatted_rows = self._format_rows(rows, options)
aligns = []
valigns = []
for field in self._field_names:
aligns.append({"l": "left", "r": "right", "c": "center"}[self._align[field]])
valigns.append({"t": "top", "m": "middle", "b": "bottom"}[self._valign[field]])
for row in formatted_rows:
lines.append(" ")
for field, datum, align, valign in zip(self._field_names, row, aligns, valigns):
if options["fields"] and field not in options["fields"]:
continue
lines.append(
" %s" % (
lpad, rpad, align, valign, escape(datum).replace("\n", linebreak)))
lines.append(" ")
lines.append("")
return self._unicode("\n").join(lines)
# Title
title = options["title"] or self._title
if title:
cols = len(options["fields"]) if options["fields"] else len(self.field_names)
lines.append(" ")
lines.append(" %s" % (cols, title))
lines.append(" ")
# Headers
if options["header"]:
lines.append(" ")
for field in self._field_names:
if options["fields"] and field not in options["fields"]:
continue
lines.append(" %s" % escape(field).replace("\n", linebreak))
lines.append(" ")
# Data
rows = self._get_rows(options)
formatted_rows = self._format_rows(rows, options)
for row in formatted_rows:
lines.append(" ")
for field, datum in zip(self._field_names, row):
if options["fields"] and field not in options["fields"]:
continue
lines.append(" %s" % escape(datum).replace("\n", linebreak))
lines.append(" ")
lines.append("")
return self._unicode("\n").join(lines)
title = options["title"] or self._title
if title:
cols = len(options["fields"]) if options["fields"] else len(self.field_names)
lines.append(" ")
lines.append(" %s" % (cols, title))
lines.append(" ")
# Headers
if options["header"]:
lines.append(" ")
for field in self._field_names:
if options["fields"] and field not in options["fields"]:
continue
lines.append(
" %s" % (
lpad, rpad, escape(field).replace("\n", linebreak)))
lines.append(" ")
# Data
rows = self._get_rows(options)
formatted_rows = self._format_rows(rows, options)
aligns = []
valigns = []
for field in self._field_names:
aligns.append({"l": "left", "r": "right", "c": "center"}[self._align[field]])
valigns.append({"t": "top", "m": "middle", "b": "bottom"}[self._valign[field]])
for row in formatted_rows:
lines.append(" ")
for field, datum, align, valign in zip(self._field_names, row, aligns, valigns):
if options["fields"] and field not in options["fields"]:
continue
lines.append(
lines.append(" ")
for field in self._field_names:
if options["fields"] and field not in options["fields"]:
continue
lines.append(" %s" % escape(field).replace("\n", linebreak))
lines.append(" ")
# Data
rows = self._get_rows(options)
formatted_rows = self._format_rows(rows, options)
for row in formatted_rows:
lines.append(" ")
for field, datum in zip(self._field_names, row):
if options["fields"] and field not in options["fields"]:
continue
lines.append(" %s" % escape(datum).replace("\n", linebreak))
lines.append(" ")
lines.append("")
return self._unicode("\n").join(lines)