source: projects/hwdata/trunk/check_monitorsdb.py @ 7989

Revision 7989, 1.2 KB checked in by daisuke, 10 years ago (diff)

forked.

  • Property svn:executable set to *
Line 
1#!/usr/bin/python
2
3f = open("MonitorsDB", "r")
4out = open("MonitorsDBOut", "w")
5
6monIds = dict()
7
8for line in f.readlines():
9    if len(line.strip()) and not line.strip().startswith('#'):
10        values = map(lambda x: x.strip(), line.split(';'))
11        if len(values) < 5:
12            print "This line contains two few values\n%s" % line
13        manufacturer = values[0]
14        model = values[1]
15        monId = values[2]
16        vGh = values[3]
17        hGh = values[4]
18        if len(manufacturer) == 0:
19            print "This line doesn't contain Manufacturer\t%s" % line
20            continue
21        if len(model) == 0:
22            print "This line contains empty model\t%s" % line
23            continue
24        if len(monId) == 0 or monId == "0":
25            print "This line contains empty monitor Id\n%s" % line
26            continue
27        if len(vGh) == 0 or len(hGh) == 0:
28            print "This line contains wrong Gh\t%s" % line
29            continue
30        if monIds.has_key(monId):
31            print "Two line have the same monitor Ids\n%s%s" % (monIds[monId], line)
32            continue
33        else:
34            monIds[monId] = line
35    out.write(line)
36f.close()
37out.close()
38
Note: See TracBrowser for help on using the repository browser.