summaryrefslogtreecommitdiff
path: root/portato/config_parser.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/config_parser.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/portato/config_parser.py b/portato/config_parser.py
index 2ef52c5..45a2e66 100644
--- a/portato/config_parser.py
+++ b/portato/config_parser.py
@@ -37,9 +37,11 @@ Thus it keeps comments and structuring of the file.
Regular expression defining a normal option-value pair.
"""
-from __future__ import absolute_import, with_statement
+
__docformat__ = "restructuredtext"
+from future_builtins import map, filter, zip
+
import re
from threading import Lock
@@ -181,7 +183,7 @@ class ConfigParser:
"yes" : "no",
"ja" : "nein",
"wahr" : "falsch"}
- true_false.update(zip(true_false.values(), true_false.keys()))
+ true_false.update(list(zip(list(true_false.values()), list(true_false.keys()))))
def __init__ (self, file):
"""
@@ -348,7 +350,7 @@ class ConfigParser:
if val.is_bool():
return val.boolean
- raise ValueError, "\"%s\" is not a boolean. (%s)" % (key, val.value)
+ raise ValueError("\"%s\" is not a boolean. (%s)" % (key, val.value))
def set (self, key, value, section = "MAIN"):
"""
@@ -382,7 +384,7 @@ class ConfigParser:
val.boolean = value
val.value = self._invert(val.value)
else:
- raise ValueError, "\"%s\" is not a boolean." % key
+ raise ValueError("\"%s\" is not a boolean." % key)
def add_section (self, section, comment = None, with_blankline = True):
"""
@@ -405,7 +407,7 @@ class ConfigParser:
self.cache.append("\n")
if comment:
- if isinstance(comment, basestring):
+ if isinstance(comment, str):
comment = comment.split("\n")
# add newlines to comment at the beginning and the end
@@ -450,7 +452,7 @@ class ConfigParser:
# find line# to add
if self.vars[section]:
- mline = max((x.line for x in self.vars[section].itervalues())) + 1
+ mline = max((x.line for x in self.vars[section].values())) + 1
else: # no value inside the section at the moment
mline = self.sections[section] + 1
@@ -459,7 +461,7 @@ class ConfigParser:
mline += 1
if comment:
- if isinstance(comment, basestring):
+ if isinstance(comment, str):
comment = comment.split("\n")
for c in comment:
@@ -479,8 +481,8 @@ class ConfigParser:
return
with self.writelock:
- for sec in self.vars.itervalues():
- for val in sec.itervalues():
+ for sec in self.vars.values():
+ for val in sec.values():
if val.changed:
part1 = self.cache[val.line][:self.pos[val.line][0]] # key+DELIMITER
part2 = val.value # value
an> 2020-04-19IMAP: Create foldersRené 'Necoro' Neumann1-4/+38 2020-04-19Improved IMAPRené 'Necoro' Neumann1-3/+88 2020-04-19Started IMAP connectionRené 'Necoro' Neumann4-0/+152 2020-04-19Use our own logger for debug for convenience sakeRené 'Necoro' Neumann1-2/+3 2020-04-19Fix debug logging m(René 'Necoro' Neumann1-2/+2 2020-04-19Rename util.go to log.go. Add verbose modeRené 'Necoro' Neumann4-24/+54 2020-04-19Clean go.modRené 'Necoro' Neumann2-3/+0 2020-04-19Do not print the parsedCfg anymoreRené 'Necoro' Neumann1-1/+1 2020-04-19Increase go-version to 1.14René 'Necoro' Neumann1-2/+2 2020-04-19CI: go vetRené 'Necoro' Neumann1-0/+3 2020-04-19Fetching and parsing the feedsRené 'Necoro' Neumann5-4/+113 2020-04-19Ignore all config*.ymlRené 'Necoro' Neumann1-1/+1