1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 """
21 Kenozooid utility funtions.
22 """
23
24 import math
25 import operator
26 import string
27
28 from cytoolz.curried import accumulate
29
30
31 FMT_DIVETIME = '%Y-%m-%d %H:%M'
32
34 """
35 Convert decimal minutes (i.e. 38.84) into MM:SS string (i.e. 38:50).
36
37 >>> min2str(38.84)
38 '38:50'
39
40 >>> min2str(67.20)
41 '67:12'
42 """
43 return '%02d:%02d' % (int(t), math.modf(t)[0] * 60)
44
45
59
60
61 nformat = _Formatter().format
62
63
64 -def pipe(data, *gens):
65 """
66 Pipe data through list of geneators.
67
68 :Parameters:
69 data
70 Data to pipe through the generators.
71 gens
72 List of generators to process the data.
73 """
74 for g in gens:
75 data = g(data)
76 return data
77
78
79
80
81 nit = lambda it: () if it is None else it
82
83 cumsum = accumulate(operator.add)
84
85
86