Replace dict.has_key() calls with "in" and "not in" operators.
svn path=/main/trunk/; revision=10875
import UserDict
from itertools import chain, izip
import platform
+ import warnings
except ImportError, e:
sys.stderr.write("\n\n")
sys.stderr.write("!!! Failed to complete python imports. These are internal modules for\n")
return v
def has_key(self,mykey):
+ warnings.warn("portage.config.has_key() is deprecated, "
+ "use the in operator instead",
+ DeprecationWarning)
return mykey in self
def __contains__(self, mykey):
# $Id$
import UserDict
+import warnings
import weakref
class ProtectedDict(UserDict.DictMixin):
return list(self.__iter__())
- def has_key(self, key):
+ def __contains__(self, key):
return key in self.new or (key not in self.blacklist and key in self.orig)
+ def has_key(self, key):
+ warnings.warn("portage.cache.mapping.ProtectedDict.has_key() is"
+ " deprecated, use the in operator instead",
+ DeprecationWarning)
+ return key in self
class LazyLoad(UserDict.DictMixin):
"""
def has_key(self, key):
+ warnings.warn("portage.cache.mappings.LazyLoad.has_key() is "
+ "deprecated, use the in operator instead",
+ DeprecationWarning)
return key in self
from portage.cache import cache_errors
from portage.cache.cache_errors import InvalidRestriction
from portage.cache.mappings import ProtectedDict
+import warnings
class database(object):
# this is for metadata/cache transfer.
if self.has_key is database.has_key:
# prevent a possible recursive loop
raise NotImplementedError
+ warnings.warn("portage.cache.template.database.has_key() is "
+ "deprecated, override __contains__ instead",
+ DeprecationWarning)
return self.has_key(cpv)
def __iter__(self):