# Path: gauged/utilities.py
# def table_repr(columns, rows, data, padding=2):
#     """Generate a table for cli output"""
#     padding = ' ' * padding
#     column_lengths = [len(column) for column in columns]
#     for row in rows:
#         for i, column in enumerate(columns):
#             item = str(data[row][column])
#             column_lengths[i] = max(len(item), column_lengths[i])
#     max_row_length = max(len(row) for row in rows) if len(rows) else 0
#     table_row = ' ' * max_row_length
#     for i, column in enumerate(columns):
#         table_row += padding + column.rjust(column_lengths[i])
#     table_rows = [table_row]
#     for row in rows:
#         table_row = row.rjust(max_row_length)
#         for i, column in enumerate(columns):
#             item = str(data[row][column])
#             table_row += padding + item.rjust(column_lengths[i])
#         table_rows.append(table_row)
#     return '\n'.join(table_rows)
# 
# def to_datetime(milliseconds):
#     """Convert a timestamp in milliseconds to a datetime"""
#     return datetime.fromtimestamp(milliseconds // 1000)


from ..utilities import table_repr, to_datetime
                           if x in lookup])

    def __ipow__(self, operand):
        if not isinstance(operand, TimeSeries):
            self.points = [(x, y ** operand) for x, y in self.points]
        else:
            lookup = dict(operand.points)
            self.points = [(x, y ** lookup[x]) for x, y in self.points
                           if x in lookup]
        return self

    def __getitem__(self, x):
        return dict(self.points)[x]

    def __iter__(self):
        return iter(self.points)

    def __len__(self):
        return len(self.points)

    def __repr__(self):
        if not len(self.points):
            return 'TimeSeries([])'
        data = {}
        columns = ['Value']
        rows = []
        for date, value in self.points:
            date = to_datetime(date).isoformat(' ')
            rows.append(date)
            data[date] = {'Value': value}

# Path: gauged/utilities.py
# def table_repr(columns, rows, data, padding=2):
#     """Generate a table for cli output"""
#     padding = ' ' * padding
#     column_lengths = [len(column) for column in columns]
#     for row in rows:
#         for i, column in enumerate(columns):
#             item = str(data[row][column])
#             column_lengths[i] = max(len(item), column_lengths[i])
#     max_row_length = max(len(row) for row in rows) if len(rows) else 0
#     table_row = ' ' * max_row_length
#     for i, column in enumerate(columns):
#         table_row += padding + column.rjust(column_lengths[i])
#     table_rows = [table_row]
#     for row in rows:
#         table_row = row.rjust(max_row_length)
#         for i, column in enumerate(columns):
#             item = str(data[row][column])
#             table_row += padding + item.rjust(column_lengths[i])
#         table_rows.append(table_row)
#     return '\n'.join(table_rows)
# 
# def to_datetime(milliseconds):
#     """Convert a timestamp in milliseconds to a datetime"""
#     return datetime.fromtimestamp(milliseconds // 1000)


# Path: gauged/results/time_series.py
from ..utilities import table_repr, to_datetime

                           if x in lookup])

    def __ipow__(self, operand):
        if not isinstance(operand, TimeSeries):
            self.points = [(x, y ** operand) for x, y in self.points]
        else:
            lookup = dict(operand.points)
            self.points = [(x, y ** lookup[x]) for x, y in self.points
                           if x in lookup]
        return self

    def __getitem__(self, x):
        return dict(self.points)[x]

    def __iter__(self):
        return iter(self.points)

    def __len__(self):
        return len(self.points)

    def __repr__(self):
        if not len(self.points):
            return 'TimeSeries([])'
        data = {}
        columns = ['Value']
        rows = []
        for date, value in self.points:
            date = to_datetime(date).isoformat(' ')
            rows.append(date)
            data[date] = {'Value': value}

        return table_repr(columns, rows, data)