diff options
author | 2013-07-20 21:19:14 +0200 | |
---|---|---|
committer | 2013-07-20 21:19:14 +0200 | |
commit | 37e135d40931617e9e135e15cb0e6dad0667b0cb (patch) | |
tree | 62aebc280d4137ab8846b6a3b6982c563f8727c0 /tests/helper/parser.py | |
parent | added missing init file (diff) | |
download | pyload-37e135d40931617e9e135e15cb0e6dad0667b0cb.tar.xz |
tried to fix hoster tester, removed unneeded files
Diffstat (limited to 'tests/helper/parser.py')
-rw-r--r-- | tests/helper/parser.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/helper/parser.py b/tests/helper/parser.py new file mode 100644 index 000000000..5031ca7c3 --- /dev/null +++ b/tests/helper/parser.py @@ -0,0 +1,22 @@ + +import codecs + +def parse_config(path): + f = codecs.open(path, "rb", "utf_8") + result = {} + + current_section = None + for line in f.readlines(): + line = line.strip() + if not line or line.startswith("#"): + continue + + if line.startswith("["): + current_section = line.replace("[", "").replace("]", "") + result[current_section] = [] + else: + if not current_section: + raise Exception("Line without section: %s" % line) + result[current_section].append(line) + + return result |