Esempio n. 1
0
    def show(self):
        """Print out human-readable summary of records retrieved"""

        table = [[str(datetime.strptime(record.time.start, TIMEFORMAT)), 
          str(datetime.strptime(record.time.end, TIMEFORMAT)), 
          record.source,
          record.instrument,
          record.extent.type] for record in self]
        table.insert(0, ['----------','--------','------','----------','----'])        
        table.insert(0, ['Start time','End time','Source','Instrument','Type'])

        print(print_table(table, colsep = '  ', linesep='\n'))
Esempio n. 2
0
def test_print_table():
    """
    This should return a string representation of lst with table elements
    left-justified and with columns separated by dashes.
    """
    lst = [['n', 'sqrt(n)', 'n^2'], ['1', '1', '1'], ['4', '2', '16'],
           ['3', '1.732', '9']]
    expected = ('n|sqrt(n)|n^2\n'
                '1|1      |1  \n'
                '4|2      |16 \n'
                '3|1.732  |9  ')
    assert util.print_table(lst, colsep='|') == expected
Esempio n. 3
0
    def show(self):
        """Print out human-readable summary of records retrieved"""

        table = [[
            str(datetime.strptime(record.time.start, TIMEFORMAT)),
            str(datetime.strptime(record.time.end, TIMEFORMAT)), record.source,
            record.instrument, record.extent.type
        ] for record in self]
        table.insert(
            0, ['----------', '--------', '------', '----------', '----'])
        table.insert(
            0, ['Start time', 'End time', 'Source', 'Instrument', 'Type'])

        print(print_table(table, colsep='  ', linesep='\n'))
Esempio n. 4
0
def test_print_table():
    """
    This should return a string representation of lst with table elements
    left-justified and with columns separated by dashes.
    """
    lst = [['n', 'sqrt(n)', 'n^2'], \
           ['1', '1', '1'], \
           ['4', '2', '16'], \
           ['3', '1.732', '9']]
    expected = ('n|sqrt(n)|n^2\n'
               '1|1      |1  \n'
               '4|2      |16 \n'
               '3|1.732  |9  ')
    assert util.print_table(lst, colsep='|') == expected
Esempio n. 5
0
    def show(self):
        """Print out human-readable summary of records retreived"""

        table = [
            [
                str(datetime.strptime(record.time.start, TIMEFORMAT)),
                str(datetime.strptime(record.time.end, TIMEFORMAT)),
                record.source,
                record.instrument,
                record.extent.type,
            ]
            for record in self
        ]
        table.insert(0, ["----------", "--------", "------", "----------", "----"])
        table.insert(0, ["Start time", "End time", "Source", "Instrument", "Type"])

        print (print_table(table, colsep="  ", linesep="\n"))