Replace deprecated readfp method with read_file
The readfp method has been deprecated since version 3.2 [1]. [1] https://docs.python.org/3/library/configparser.html?highlight=deprecated#configparser.ConfigParser.readfp Change-Id: Ib9549509bfcc749740953e3769030d787b2bf251
This commit is contained in:
parent
1eadf23b94
commit
2290f58eb9
|
@ -27,12 +27,13 @@ from pbr import util
|
|||
|
||||
def config_from_ini(ini):
|
||||
config = {}
|
||||
ini = textwrap.dedent(six.u(ini))
|
||||
if sys.version_info >= (3, 2):
|
||||
parser = configparser.ConfigParser()
|
||||
parser.read_file(io.StringIO(ini))
|
||||
else:
|
||||
parser = configparser.SafeConfigParser()
|
||||
ini = textwrap.dedent(six.u(ini))
|
||||
parser.readfp(io.StringIO(ini))
|
||||
parser.readfp(io.StringIO(ini))
|
||||
for section in parser.sections():
|
||||
config[section] = dict(parser.items(section))
|
||||
return config
|
||||
|
|
Loading…
Reference in New Issue