##// END OF EJS Templates
Tidy up dictionary-style methods of Config (2to3 converts 'has_key' calls to use the 'in' operator, which will be that of the parent dict unless we define it).
Thomas Kluyver -
Show More
@@ -92,16 +92,17 b' class Config(dict):'
92 else:
92 else:
93 return False
93 return False
94
94
95 # .has_key is deprecated for dictionaries.
95 def __contains__(self, key):
96 def has_key(self, key):
97 if self._is_section_key(key):
96 if self._is_section_key(key):
98 return True
97 return True
99 else:
98 else:
100 return key in self
99 return super(Config, self).__contains__(key)
100 # .has_key is deprecated for dictionaries.
101 has_key = __contains__
101
102
102 def _has_section(self, key):
103 def _has_section(self, key):
103 if self._is_section_key(key):
104 if self._is_section_key(key):
104 if key in self:
105 if super(Config, self).__contains__(key):
105 return True
106 return True
106 return False
107 return False
107
108
General Comments 0
You need to be logged in to leave comments. Login now