Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pyrevitlib/pyrevit/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@

from __future__ import print_function
import os.path as op
import itertools
import sys
from pyrevit.compat import PY2, PY3
if PY2:
from itertools import izip_longest as zip_longest
elif PY3:
from itertools import zip_longest

from pyrevit import HOST_APP, EXEC_PARAMS
from pyrevit import framework
Expand Down Expand Up @@ -543,6 +548,8 @@ def print_md(md_str):
markdown_html = markdown_html.replace('\n', '').replace('\r', '')
html_code = coreutils.prepare_html_str(markdown_html)
print(html_code, end="")
if PY3:
sys.stdout.flush()

def print_table(self, table_data, columns=None, formats=None,
title='', last_line_style=''):
Expand Down Expand Up @@ -579,7 +586,6 @@ def print_table(self, table_data, columns=None, formats=None,
self.add_style('tr:last-child {{ {style} }}'
.format(style=last_line_style))

zipper = itertools.izip_longest #pylint: disable=E1101
adjust_base_col = '|'
adjust_extra_col = ':---|'
base_col = '|'
Expand All @@ -591,7 +597,7 @@ def print_table(self, table_data, columns=None, formats=None,
header = ''
if columns:
header = base_col
for idx, col_name in zipper(range(max_col), columns, fillvalue=''): #pylint: disable=W0612
for idx, col_name in zip_longest(range(max_col), columns, fillvalue=''): #pylint: disable=W0612
header += extra_col.format(data=col_name)

header += '\n'
Expand All @@ -606,7 +612,7 @@ def print_table(self, table_data, columns=None, formats=None,
for entry in table_data:
row = base_col
for idx, attrib, attr_format \
in zipper(range(max_col), entry, formats, fillvalue=''):
in zip_longest(range(max_col), entry, formats, fillvalue=''):
if attr_format:
value = attr_format.format(attrib)
else:
Expand Down