summaryrefslogtreecommitdiff
path: root/utils.py
blob: fa37568f0ff2124b13f0a7bc05ed44e1d53b235c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

def fl(number, precision=6):
	formatstring = '{:.'+str(precision)+'f}'
	return float(formatstring.format(number))


def depth(myList, counter):
	counter += 1
	depthList = []
	for item in myList:
	    if isinstance(item, list):
	        depthList.append(depth(item, counter))
	    else:
	        depthList.append(counter)
	return depthList

def flatten(pool):
    res = []
    for v in pool:
        if isinstance(v, list):
          res += flatten(v)
        else:
          if isinstance(v, int) or isinstance(v, str):
            res.append(v)
    return res

def isOversliced(bars):
	targets = [bar > 0 and bar < 2.5 for bar in bars]
	return (True in targets)