FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Portage Developer

 
 
LinkBack Thread Tools
 
Old 07-01-2008, 11:26 AM
Ali Polatel
 
Default Replace has_key() with the in operator (portage.cache)

---
pym/portage/cache/metadata_overlay.py | 2 +-
pym/portage/cache/sql_template.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/cache/metadata_overlay.py b/pym/portage/cache/metadata_overlay.py
index 13d1278..e25759c 100644
--- a/pym/portage/cache/metadata_overlay.py
+++ b/pym/portage/cache/metadata_overlay.py
@@ -61,7 +61,7 @@ class database(template.database):

def _delitem(self, cpv):
value = self[cpv] # validates whiteout and/or raises a KeyError when necessary
- if self.db_ro.has_key(cpv):
+ if cpv in self.db_ro:
self.db_rw[cpv] = self._create_whiteout(value)
else:
del self.db_rw[cpv]
diff --git a/pym/portage/cache/sql_template.py b/pym/portage/cache/sql_template.py
index f32a728..3c5cbd4 100644
--- a/pym/portage/cache/sql_template.py
+++ b/pym/portage/cache/sql_template.py
@@ -150,7 +150,7 @@ class SQLDatabase(template.database):
# so we store only what's handed to us and is a known key
db_values = []
for key in self._known_keys:
- if values.has_key(key) and values[key] != ':
+ if key in values and values[key] != ':
db_values.append({"key":key, "value":values[key]})

if len(db_values) > 0:
--
1.5.6.1

--
gentoo-portage-dev@lists.gentoo.org mailing list
 

Thread Tools




All times are GMT. The time now is 09:59 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org