diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-01 12:55:49 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-01 12:55:49 +0000 |
commit | 211b56614083fbb4f78b74f28a3962f97bf684d5 (patch) | |
tree | 9358a35593b08d5b140dcf9d5569b7ce7c7cab51 /pym/portage/cache/mappings.py | |
parent | 56aea2672000174743514bcc7f58f41733f64ce4 (diff) | |
download | portage-211b56614083fbb4f78b74f28a3962f97bf684d5.tar.gz portage-211b56614083fbb4f78b74f28a3962f97bf684d5.tar.bz2 portage-211b56614083fbb4f78b74f28a3962f97bf684d5.zip |
Py3k compatibility patch #6 by Ali Polatel <hawking@g.o>.
Replace dict.has_key() calls with "in" and "not in" operators.
svn path=/main/trunk/; revision=10875
Diffstat (limited to 'pym/portage/cache/mappings.py')
-rw-r--r-- | pym/portage/cache/mappings.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pym/portage/cache/mappings.py b/pym/portage/cache/mappings.py index 2ccc96b05..d0ca487f0 100644 --- a/pym/portage/cache/mappings.py +++ b/pym/portage/cache/mappings.py @@ -4,6 +4,7 @@ # $Id$ import UserDict +import warnings import weakref class ProtectedDict(UserDict.DictMixin): @@ -55,9 +56,14 @@ 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): """ @@ -91,6 +97,9 @@ 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 |