Skip to content

Commit

Permalink
Support config.get*(..., fallback=...)
Browse files Browse the repository at this point in the history
This upgrades ConfigParser -> configparser (required for python 2->3),
and resolves associated metaclass conflict by dropping use of Singleton
mixin class.
  • Loading branch information
benjimin committed Apr 12, 2019
1 parent 11e1ac9 commit 90e6da0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Utilities/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"""

import io
from ConfigParser import RawConfigParser
from Utilities.singleton import Singleton
from configparser import RawConfigParser
#from ast import literal_eval as eval

def parseBool(txt):
"""
Expand Down Expand Up @@ -234,7 +234,7 @@ def formatList(lst):
"""

class _ConfigParser(RawConfigParser, Singleton):
class _ConfigParser(RawConfigParser):

"""
A configuration file parser that extends
Expand Down Expand Up @@ -311,8 +311,9 @@ def set(self, section, option, value=None):
newvalue = value
RawConfigParser.set(self, section, option, newvalue)

def ConfigParser(defaults=DEFAULTS):
return _ConfigParser.getInstance(defaults)
singleton = _ConfigParser(defaults=DEFAULTS)
def ConfigParser():
return singleton

def cnfGetIniValue(configFile, section, option, default=None):
"""
Expand Down

0 comments on commit 90e6da0

Please sign in to comment.