def _table_rows(datapoints): def format_row(result, value): return result + ("|{:>" + str(CELL_SIZE) + "}").format(value) return [ reduce(format_row, [ pick_hour(dp['instant']) + 'h', symbol_for(dp['symbol']), str(dp['temperature']) + '°', space_for_zero(dp['precip']['value']), bar_for(dp['precip']['min']) + bar_for(dp['precip']['value']) + bar_for(dp['precip']['max']), str(dp['wind']['speed']) + arrow_for(dp['wind']['direction']) ], '') for dp in datapoints ]
def _table_rows(datapoints): def format_row(result, value): return result + ("|{:>" + str(CELL_SIZE) + "}").format(value) return [ reduce( format_row, [ pick_hour(dp["instant"]) + "h", symbol_for(dp["symbol"]), str(dp["temperature"]) + "°", space_for_zero(dp["precip"]["value"]), bar_for(dp["precip"]["min"]) + bar_for(dp["precip"]["value"]) + bar_for(dp["precip"]["max"]), str(dp["wind"]["speed"]) + arrow_for(dp["wind"]["direction"]), ], "", ) for dp in datapoints ]
def symbol_row(datapoints, columns): return [ format_row([symbol_for(dp['symbol']) + ' ' for dp in datapoints], columns) ]
def symbol_row(datapoints, columns): return [format_row([symbol_for(dp["symbol"]) + " " for dp in datapoints], columns)]