diff options
author | Patrice Clement <monsieurp@gentoo.org> | 2017-06-23 15:42:06 +0200 |
---|---|---|
committer | Patrice Clement <monsieurp@gentoo.org> | 2017-06-23 15:42:06 +0200 |
commit | 86a6c54fd428f02c3c77b97cbc096b438648636c (patch) | |
tree | ff3e1561dffbe7052ae69f2427802fd5214048e2 | |
parent | remove a bunch of useless elses (diff) | |
download | java-config-86a6c54fd428f02c3c77b97cbc096b438648636c.tar.gz java-config-86a6c54fd428f02c3c77b97cbc096b438648636c.tar.bz2 java-config-86a6c54fd428f02c3c77b97cbc096b438648636c.zip |
remove else condition
-rw-r--r-- | src/java_config_2/FileParser.py | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/java_config_2/FileParser.py b/src/java_config_2/FileParser.py index a7a70f4..bf8a60e 100644 --- a/src/java_config_2/FileParser.py +++ b/src/java_config_2/FileParser.py @@ -23,26 +23,25 @@ class FileParser: line = line.strip('\n') if line.isspace() or line == '' or line.startswith('#'): continue - else: - index = line.find('=') - name = line[:index] - value = line [index+1:] - - if value == '': - continue - #raise InvalidConfigError(file) - - value = value.strip('\\\'\"') - - while value.find('${') >= 0: - item = value[value.find('${')+2:value.find('}')] - - if item in self.config: - val = self.config[item] - else: - val = '' - value = value.replace('${%s}' % item, val) - self.pair(name,value) + + index = line.find('=') + name = line[:index] + value = line[index+1:] + + if value == '': + continue + + value = value.strip('\\\'\"') + + while value.find('${') >= 0: + item = value[value.find('${')+2:value.find('}')] + + if item in self.config: + val = self.config[item] + else: + val = '' + value = value.replace('${%s}' % item, val) + self.pair(name,value) def pair(self, key, value): pass |