Make PEP8 cleanup of line spaces and character distances as well as indents

This commit is contained in:
Griatch 2017-08-19 23:16:36 +02:00
parent 7ff783fea1
commit b278337172
189 changed files with 2039 additions and 1583 deletions

View file

@ -322,6 +322,7 @@ class EvCell(object):
and resize as needed.
"""
def __init__(self, data, **kwargs):
"""
Args:
@ -472,7 +473,7 @@ class EvCell(object):
"""
if m_len(text) > width:
crop_string = self.crop_string
return text[:width-m_len(crop_string)] + crop_string
return text[:width - m_len(crop_string)] + crop_string
return text
def _reformat(self):
@ -661,7 +662,7 @@ class EvCell(object):
left = self.border_left_char * self.border_left + ANSIString('|n')
right = ANSIString('|n') + self.border_right_char * self.border_right
cwidth = self.width + self.pad_left + self.pad_right + max(0, self.border_left-1) + max(0, self.border_right-1)
cwidth = self.width + self.pad_left + self.pad_right + max(0, self.border_left - 1) + max(0, self.border_right - 1)
vfill = self.corner_top_left_char if left else ""
vfill += cwidth * self.border_top_char
@ -849,7 +850,7 @@ class EvCell(object):
return unicode(ANSIString("\n").join(self.formatted))
## EvColumn class
# EvColumn class
class EvColumn(object):
"""
@ -861,7 +862,8 @@ class EvColumn(object):
incorporated into an EvTable (like EvCells)
"""
def __init__(self, *args, **kwargs):
def __init__(self, *args, **kwargs):
"""
Args:
Text for each row in the column
@ -918,7 +920,7 @@ class EvColumn(object):
self.column.extend([EvCell(data, **self.options) for data in args])
else:
# insert cells before given index
ypos = min(len(self.column)-1, max(0, int(ypos)))
ypos = min(len(self.column) - 1, max(0, int(ypos)))
new_cells = [EvCell(data, **self.options) for data in args]
self.column = self.column[:ypos] + new_cells + self.column[ypos:]
# self._balance(**kwargs)
@ -1223,7 +1225,7 @@ class EvTable(object):
"""
Add borders to table. This is called from self._balance.
"""
nx, ny = self.ncols-1, self.nrows-1
nx, ny = self.ncols - 1, self.nrows - 1
options = self.options
for ix, col in enumerate(self.worktable):
for iy, cell in enumerate(col):
@ -1254,7 +1256,7 @@ class EvTable(object):
self.worktable[icol].reformat(**options)
if nrow < nrowmax:
# add more rows to too-short columns
empty_rows = ["" for _ in range(nrowmax-nrow)]
empty_rows = ["" for _ in range(nrowmax - nrow)]
self.worktable[icol].add_rows(*empty_rows)
self.ncols = ncols
self.nrows = nrowmax
@ -1441,7 +1443,7 @@ class EvTable(object):
self.table.append(column)
else:
# insert column
xpos = min(wtable-1, max(0, int(xpos)))
xpos = min(wtable - 1, max(0, int(xpos)))
self.table.insert(xpos, column)
self.ncols += 1
# self._balance()
@ -1491,7 +1493,7 @@ class EvTable(object):
col.add_rows(row[icol], **options)
else:
# insert row elsewhere
ypos = min(htable-1, max(0, int(ypos)))
ypos = min(htable - 1, max(0, int(ypos)))
for icol, col in enumerate(self.table):
col.add_rows(row[icol], ypos=ypos, **options)
self.nrows += 1
@ -1575,9 +1577,9 @@ def _test():
print(unicode(table))
return table
def _test2():
table = EvTable("|yHeading1|n", "|B|[GHeading2|n", "Heading3")
for i in range(100):
table.add_row("This is col 0, row %i" % i, "|gThis is col 1, row |w%i|n|g.|n" % i, "This is col 2, row %i" % i)
return table