Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_chaining():
table = Texttable()
table.reset()
table.set_max_width(50)
table.set_chars(list('-|+='))
table.set_deco(Texttable.BORDER)
table.set_header_align(list('lll'))
table.set_cols_align(list('lll'))
table.set_cols_valign(list('mmm'))
table.set_cols_dtype(list('ttt'))
table.set_cols_width([3, 3, 3])
table.set_precision(3)
table.header(list('abc'))
table.add_row(list('def'))
table.add_rows([list('ghi')], False)
s1 = table.draw()
s2 = (Texttable()
.reset()
.set_max_width(50)
.set_chars(list('-|+='))
.set_deco(Texttable.BORDER)
.set_header_align(list('lll'))
def print_header(self):
if self.timeout > 0:
logger.info("Timeout set to {} minute(s)".format(self.timeout))
table = self.__create_table()
table.add_rows([EVENT_TABLE_HEADERS])
table.set_deco(Texttable.BORDER | Texttable.VLINES)
logger.info(table.draw())
def display(i, names: list, descriptions: list, values: list):
for k in i:
names.append(k)
descriptions.append(i[k][0])
values.append(i[k][1])
t = table.Texttable()
headings = ["Name", "Desc.", "Val"]
t.header(headings)
#t.set_chars(["-"," ","+","~"])
t.set_deco(table.Texttable.BORDER)
for row in zip(names, descriptions, values):
t.add_row(row)
s = t.draw()
print(s + "\n")
return names, descriptions, values
def summary(self,
deco : int = Texttable.BORDER,
cols_align : List[str] = ["l", "l", "l"],
cols_valign : List[str] = ["t", "t", "t"]) -> TypeVar("DataloaderCollator"):
r"""Get summary of trainer.
Args:
deco (int): Border of texttable
cols_align (List[str]): List of string of columns' align
cols_valign (List[str]): List of string of columns' valign
Returns:
torecsys.data.dataloader.DataloaderCollator: self
"""
# Create and configurate Texttable
t = Texttable()
t.set_deco(deco)
t.set_cols_align(cols_align)
#. data per hyperparameter (e.g. dropout size, hidden size)
#. training loss per epochs
#. metrics, including AUC, logloss
#. matplotlib line chart of data
Returns:
str: string of result of texttable.draw
"""
raise NotImplementedError("not implemented.")
# initialize and configurate Texttable
t = Texttable()
t.set_deco(Texttable.BORDER)
t.set_cols_align(["l", "l"])
t.set_cols_valign(["t", "t"])
# append data to texttable
return t.draw()
def _bulk(self, files: List[Tuple[str, ...]], op: Callable[[str, str], None],
column_descriptions: List[str] = [], src_index=0, dest_index=1, print_table=True):
from texttable import Texttable
if not print_table and self.dry_run:
return
if print_table:
table = [column_descriptions]
table.extend(files)
t = Texttable(max_width=0)
t.set_deco(Texttable.VLINES | Texttable.HEADER | Texttable.BORDER)
t.add_rows(table)
print(t.draw())
if not self.dry_run:
for file_tuple in files:
src = file_tuple[src_index]
dst = file_tuple[dest_index]
if src and dst:
op(src, dst)
def _has_border(self):
"""Return a boolean, if border is required or not
"""
return self._deco & Texttable.BORDER > 0
def summary(self,
deco : int = Texttable.BORDER,
cols_align : List[str] = ["l", "l"],
cols_valign : List[str] = ["t", "t"]) -> TypeVar("Trainer"):
r"""Get summary of trainer.
Args:
deco (int): Border of texttable
cols_align (List[str]): List of string of columns' align
cols_valign (List[str]): List of string of columns' valign
Returns:
torecsys.trainer.Trainer: self
"""
# Get attributes from self and initialize _vars of parameters
_vars = {
"objective" : self._objective,
"inputs" : self._inputs.__class__.__name__ if self.has_inputs else None,