##// 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 92 else:
93 93 return False
94 94
95 # .has_key is deprecated for dictionaries.
96 def has_key(self, key):
95 def __contains__(self, key):
97 96 if self._is_section_key(key):
98 97 return True
99 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 103 def _has_section(self, key):
103 104 if self._is_section_key(key):
104 if key in self:
105 if super(Config, self).__contains__(key):
105 106 return True
106 107 return False
107 108
General Comments 0
You need to be logged in to leave comments. Login now