# Path: deepcpg/utils.py
# def format_table(table, colwidth=None, precision=2, header=True, sep=' | '):
#     """Format a table of values as string.
# 
#     Formats a table represented as a `dict` with keys as column headers and
#     values as a lists of values in each column.
# 
#     Parameters
#     ----------
#     table: `dict` or `OrderedDict`
#         `dict` or `OrderedDict` with keys as column headers and values as lists
#         of values in each column.
#     precision: int or list of ints
#         Precision of floating point values in each column. If `int`, uses same
#         precision for all columns, otherwise formats columns with different
#         precisions.
#     header: bool
#         If `True`, print column names.
#     sep: str
#         Column separator.
# 
#     Returns
#     -------
#     str
#         String of formatted table values.
#     """
# 
#     col_names = list(table.keys())
#     if not isinstance(precision, list):
#         precision = [precision] * len(col_names)
#     col_widths = []
#     tot_width = 0
#     nb_row = None
#     ftable = OrderedDict()
#     for col_idx, col_name in enumerate(col_names):
#         width = max(len(col_name), precision[col_idx] + 2)
#         values = []
#         for value in table[col_name]:
#             if value is None:
#                 value = ''
#             elif isinstance(value, float):
#                 value = '{0:.{1}f}'.format(value, precision[col_idx])
#             else:
#                 value = str(value)
#             width = max(width, len(value))
#             values.append(value)
#         ftable[col_name] = values
#         col_widths.append(width)
#         if not nb_row:
#             nb_row = len(values)
#         else:
#             nb_row = max(nb_row, len(values))
#         tot_width += width
#     tot_width += len(sep) * (len(col_widths) - 1)
#     rows = []
#     if header:
#         rows.append(format_table_row(col_names, col_widths, sep=sep))
#         rows.append('-' * tot_width)
#     for row in range(nb_row):
#         values = []
#         for col_values in six.itervalues(ftable):
#             if row < len(col_values):
#                 values.append(col_values[row])
#             else:
#                 values.append(None)
#         rows.append(format_table_row(values, col_widths, sep=sep))
#     return '\n'.join(rows)


from collections import OrderedDict
from time import time
from keras.callbacks import Callback
from .utils import format_table
import os
import numpy as np
import six
            self._batch_logs[name].append(tmp)
        self._update_means(self._batch_logs, self._batch_metrics)

        # Show logs table at a certain frequency
        do_log = False
        if self._step % self._log_freq == 0:
            do_log = True
        do_log |= self._step == 1 or self._step == self._steps

        if do_log:
            table = OrderedDict()
            prog = self._step / self._steps
            prog *= 100
            precision = []
            table['done (%)'] = [prog]
            precision.append(1)
            table['time'] = [(time() - self._time_start) / 60]
            precision.append(1)
            for mean_name in self._batch_metrics:
                table[mean_name] = []
            if self.verbose:
                for mean_name, names in six.iteritems(self._batch_metrics):
                    for name in names:
                        table[name] = []
                        precision.append(self.precision)
            for name, logs in six.iteritems(self._batch_logs):
                if name in table:
                    table[name].append(logs[-1])
                    precision.append(self.precision)


# Path: deepcpg/utils.py
# def format_table(table, colwidth=None, precision=2, header=True, sep=' | '):
#     """Format a table of values as string.
# 
#     Formats a table represented as a `dict` with keys as column headers and
#     values as a lists of values in each column.
# 
#     Parameters
#     ----------
#     table: `dict` or `OrderedDict`
#         `dict` or `OrderedDict` with keys as column headers and values as lists
#         of values in each column.
#     precision: int or list of ints
#         Precision of floating point values in each column. If `int`, uses same
#         precision for all columns, otherwise formats columns with different
#         precisions.
#     header: bool
#         If `True`, print column names.
#     sep: str
#         Column separator.
# 
#     Returns
#     -------
#     str
#         String of formatted table values.
#     """
# 
#     col_names = list(table.keys())
#     if not isinstance(precision, list):
#         precision = [precision] * len(col_names)
#     col_widths = []
#     tot_width = 0
#     nb_row = None
#     ftable = OrderedDict()
#     for col_idx, col_name in enumerate(col_names):
#         width = max(len(col_name), precision[col_idx] + 2)
#         values = []
#         for value in table[col_name]:
#             if value is None:
#                 value = ''
#             elif isinstance(value, float):
#                 value = '{0:.{1}f}'.format(value, precision[col_idx])
#             else:
#                 value = str(value)
#             width = max(width, len(value))
#             values.append(value)
#         ftable[col_name] = values
#         col_widths.append(width)
#         if not nb_row:
#             nb_row = len(values)
#         else:
#             nb_row = max(nb_row, len(values))
#         tot_width += width
#     tot_width += len(sep) * (len(col_widths) - 1)
#     rows = []
#     if header:
#         rows.append(format_table_row(col_names, col_widths, sep=sep))
#         rows.append('-' * tot_width)
#     for row in range(nb_row):
#         values = []
#         for col_values in six.itervalues(ftable):
#             if row < len(col_values):
#                 values.append(col_values[row])
#             else:
#                 values.append(None)
#         rows.append(format_table_row(values, col_widths, sep=sep))
#     return '\n'.join(rows)


# Path: deepcpg/callbacks.py
from collections import OrderedDict
from time import time
from keras.callbacks import Callback
from .utils import format_table
import os
import numpy as np
import six

            self._batch_logs[name].append(tmp)
        self._update_means(self._batch_logs, self._batch_metrics)

        # Show logs table at a certain frequency
        do_log = False
        if self._step % self._log_freq == 0:
            do_log = True
        do_log |= self._step == 1 or self._step == self._steps

        if do_log:
            table = OrderedDict()
            prog = self._step / self._steps
            prog *= 100
            precision = []
            table['done (%)'] = [prog]
            precision.append(1)
            table['time'] = [(time() - self._time_start) / 60]
            precision.append(1)
            for mean_name in self._batch_metrics:
                table[mean_name] = []
            if self.verbose:
                for mean_name, names in six.iteritems(self._batch_metrics):
                    for name in names:
                        table[name] = []
                        precision.append(self.precision)
            for name, logs in six.iteritems(self._batch_logs):
                if name in table:
                    table[name].append(logs[-1])
                    precision.append(self.precision)


            self._log(format_table(table, precision=precision,