diff options
author | VG <vg@devys.org> | 2016-06-12 20:27:02 +0200 |
---|---|---|
committer | VG <vg@devys.org> | 2016-06-12 20:27:02 +0200 |
commit | 98a69a37bc8e33f3b53b59aa4bd2fb34d9ccc619 (patch) | |
tree | 1d5ce161e953e3ec89f41c370e40e7bff6272b48 /confparser.py | |
parent | 05da3e42858499a463769a44125fca900eca71e9 (diff) | |
download | climl-98a69a37bc8e33f3b53b59aa4bd2fb34d9ccc619.tar.gz climl-98a69a37bc8e33f3b53b59aa4bd2fb34d9ccc619.tar.bz2 climl-98a69a37bc8e33f3b53b59aa4bd2fb34d9ccc619.zip |
Change confparser to a package, add it to setup.py
Diffstat (limited to 'confparser.py')
-rw-r--r-- | confparser.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/confparser.py b/confparser.py deleted file mode 100644 index e43443b..0000000 --- a/confparser.py +++ /dev/null @@ -1,27 +0,0 @@ -#!python3 - -__all__ = ['read_conf'] - -import csv - -class conf_dialect(csv.Dialect): - delimiter = '=' - quotechar = '"' - escapechar = '\\' - doublequote = True - skipinitialspace = True - lineterminator = '\n' - quoting = csv.QUOTE_MINIMAL - -def genestrip(geneorg): - for line in geneorg: - line = line.strip() - if not len(line) or line.startswith('#'): - continue - yield line - -def read_conf(filename): - with open(filename, 'r', encoding='utf8') as linegen: - reader = csv.reader(genestrip(linegen), dialect=conf_dialect) - dic = {row[0].strip(): row[1] for row in reader if len(row) >= 2} - return dic |