Handle readfp deprecation

In py3.4 notice method readfp will removed in the future,so use
method readfile to replace it.This warning is only in py3 and
above.Py2,configparse do not have.Actually in py3,This function
is finally pointed to the readfile function

warnings.warn(
            "This method will be removed in future versions.  "
            "Use 'parser.read_file()' instead.",
            DeprecationWarning, stacklevel=2
        )
self.read_file(fp, source=filename)

Change-Id: I22a2dca71008469a8c8b7afcc0934f3b4adcdae4
This commit is contained in:
jiansong 2017-01-11 22:46:02 -08:00 committed by jian.song
parent 57148d701d
commit 6dce5f4f19
2 changed files with 11 additions and 2 deletions

View File

@ -405,6 +405,12 @@
"Instance of 'API' has no 'mongodb_add_shard_cluster' member",
"MongoDbCluster.add_shard"
],
[
"trove/common/stream_codecs.py",
"no-member",
"Instance of 'ConfigParser' has no 'read_file' member",
"IniCodec.deserialize"
],
[
"trove/common/utils.py",
"E1127",
@ -1667,4 +1673,4 @@
"--rcfile=./pylintrc",
"-E"
]
}
}

View File

@ -206,7 +206,10 @@ class IniCodec(StreamCodec):
def deserialize(self, stream):
parser = self._init_config_parser()
parser.readfp(self._pre_parse(stream))
if sys.version_info >= (3, 2):
parser.read_file(self._pre_parse(stream))
else:
parser.readfp(self._pre_parse(stream))
return {s: {k:
StringConverter({None: self._default_value}).to_objects(v)