added utils function for sorting Departures
[pywienerlinien] / gotovienna / utils.py
1 # -*- coding: utf-8 -*-
2
3 def inred(x):
4     return '\033[91m' + x + '\033[0m'
5
6 def ingreen(x):
7     return '\033[92m' + x + '\033[0m'
8
9 def inblue(x):
10     return '\033[94m' + x + '\033[0m'
11
12 def sort_departures(dep):
13     print 'sorting ...'
14     d = sorted(dep, lambda x, y: cmp(x['atime'], y['atime']))
15     print map(lambda x: x['atime'], d)
16     return d