diff options
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 |