summaryrefslogtreecommitdiffstats
path: root/utils.py
blob: 1a222c85c0f9697417a7f40a44edd1b5e6706549 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python2
import collections

def get_os_name(name):
  try: return name.split(' ')[0].lower()
  except: pass

def select_with_attribute(iterable, attribute, result=True):
    return [value for value in iterable if (attribute in value) == result]

def is_iterable(obj):
    if isinstance(obj, collections.Iterable):
       return True
    return False

filters = [
    ('select_with_attribute', select_with_attribute),
    ('get_os_name', get_os_name)
]

tests = [
    ('iterable', is_iterable)
]