Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/tools/lint/lib/whitelist.py

raw
1 def parse(handle):
2 '''Parse the contents of the provided file descriptor as a linting
3 whitelist file. Return a dictionary whose keys are test file names and
4 whose values are Python sets of "Check" ID strings.'''
5
6 whitelist = dict()
7
8 for line in handle:
9 if line.startswith('#'):
10 continue
11
12 parts = line.split()
13 file_name = parts[0]
14 check_names = set(parts[1:])
15
16 assert file_name not in whitelist, (
17 'Whitelist should have a single entry for each file')
18
19 assert len(check_names) > 0, (
20 'Each whitelist entry should specify at least on check')
21
22 whitelist[file_name] = check_names
23
24 return whitelist