configparser.py: changed PendingDeprecationWarnings to DeprecationWarnings, via http://mail.python.org/pipermail/python-dev/2010-November/105391.html
configparser:py: renamed _views to _proxies to be consistent with the SectionProxy name
This commit is contained in:
parent
b9d10d08c4
commit
49afa380fd
|
@ -319,7 +319,7 @@ class ParsingError(Error):
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"This 'filename' attribute will be removed in future versions. "
|
"This 'filename' attribute will be removed in future versions. "
|
||||||
"Use 'source' instead.",
|
"Use 'source' instead.",
|
||||||
PendingDeprecationWarning, stacklevel=2
|
DeprecationWarning, stacklevel=2
|
||||||
)
|
)
|
||||||
return self.source
|
return self.source
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ class ParsingError(Error):
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"The 'filename' attribute will be removed in future versions. "
|
"The 'filename' attribute will be removed in future versions. "
|
||||||
"Use 'source' instead.",
|
"Use 'source' instead.",
|
||||||
PendingDeprecationWarning, stacklevel=2
|
DeprecationWarning, stacklevel=2
|
||||||
)
|
)
|
||||||
self.source = value
|
self.source = value
|
||||||
|
|
||||||
|
@ -410,8 +410,8 @@ class RawConfigParser(MutableMapping):
|
||||||
self._dict = dict_type
|
self._dict = dict_type
|
||||||
self._sections = self._dict()
|
self._sections = self._dict()
|
||||||
self._defaults = self._dict()
|
self._defaults = self._dict()
|
||||||
self._views = self._dict()
|
self._proxies = self._dict()
|
||||||
self._views[DEFAULTSECT] = SectionProxy(self, DEFAULTSECT)
|
self._proxies[DEFAULTSECT] = SectionProxy(self, DEFAULTSECT)
|
||||||
if defaults:
|
if defaults:
|
||||||
for key, value in defaults.items():
|
for key, value in defaults.items():
|
||||||
self._defaults[self.optionxform(key)] = value
|
self._defaults[self.optionxform(key)] = value
|
||||||
|
@ -457,7 +457,7 @@ class RawConfigParser(MutableMapping):
|
||||||
if section in self._sections:
|
if section in self._sections:
|
||||||
raise DuplicateSectionError(section)
|
raise DuplicateSectionError(section)
|
||||||
self._sections[section] = self._dict()
|
self._sections[section] = self._dict()
|
||||||
self._views[section] = SectionProxy(self, section)
|
self._proxies[section] = SectionProxy(self, section)
|
||||||
|
|
||||||
def has_section(self, section):
|
def has_section(self, section):
|
||||||
"""Indicate whether the named section is present in the configuration.
|
"""Indicate whether the named section is present in the configuration.
|
||||||
|
@ -553,7 +553,7 @@ class RawConfigParser(MutableMapping):
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"This method will be removed in future versions. "
|
"This method will be removed in future versions. "
|
||||||
"Use 'parser.read_file()' instead.",
|
"Use 'parser.read_file()' instead.",
|
||||||
PendingDeprecationWarning, stacklevel=2
|
DeprecationWarning, stacklevel=2
|
||||||
)
|
)
|
||||||
self.read_file(fp, source=filename)
|
self.read_file(fp, source=filename)
|
||||||
|
|
||||||
|
@ -702,13 +702,13 @@ class RawConfigParser(MutableMapping):
|
||||||
existed = section in self._sections
|
existed = section in self._sections
|
||||||
if existed:
|
if existed:
|
||||||
del self._sections[section]
|
del self._sections[section]
|
||||||
del self._views[section]
|
del self._proxies[section]
|
||||||
return existed
|
return existed
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
if key != DEFAULTSECT and not self.has_section(key):
|
if key != DEFAULTSECT and not self.has_section(key):
|
||||||
raise KeyError(key)
|
raise KeyError(key)
|
||||||
return self._views[key]
|
return self._proxies[key]
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
# To conform with the mapping protocol, overwrites existing values in
|
# To conform with the mapping protocol, overwrites existing values in
|
||||||
|
@ -812,7 +812,7 @@ class RawConfigParser(MutableMapping):
|
||||||
cursect = self._dict()
|
cursect = self._dict()
|
||||||
cursect['__name__'] = sectname
|
cursect['__name__'] = sectname
|
||||||
self._sections[sectname] = cursect
|
self._sections[sectname] = cursect
|
||||||
self._views[sectname] = SectionProxy(self, sectname)
|
self._proxies[sectname] = SectionProxy(self, sectname)
|
||||||
elements_added.add(sectname)
|
elements_added.add(sectname)
|
||||||
# So sections can't start with a continuation line
|
# So sections can't start with a continuation line
|
||||||
optname = None
|
optname = None
|
||||||
|
|
Loading…
Reference in New Issue