Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Portage Developer (http://www.linux-archive.org/gentoo-portage-developer/)
-   -   Fix warning for lib2to3/fixes/fix_map.py (http://www.linux-archive.org/gentoo-portage-developer/143543-fix-warning-lib2to3-fixes-fix_map-py.html)

Ali Polatel 08-15-2008 03:13 PM

Fix warning for lib2to3/fixes/fix_map.py
 
2to3 gives a warning while converting portage codebase using map¹ fix:
RefactoringTool: Warnings/messages while refactoring:
RefactoringTool: ### In file ./pym/portage/dbapi/porttree.py ###
RefactoringTool: Line 266: You should use a for loop here

This is a valid warning because map() will change in py3k. Read the docstring of
fix_map.py for more information.

¹: http://svn.python.org/view/python/trunk/Lib/lib2to3/fixes/fix_map.py

---
pym/portage/dbapi/porttree.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 2948ba6..4e76b1e 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -263,7 +263,8 @@ class portdbapi(dbapi):
# if newer version, wipe everything and negate eapi
eapi = metadata["EAPI"]
metadata = {}
- map(lambda x: metadata.setdefault(x, ""), auxdbkeys)
+ for x in auxdbkeys:
+ metadata.setdefault(x, "")
metadata["EAPI"] = "-" + eapi

if metadata.get("INHERITED", False):
--
Regards,
Ali Polatel


All times are GMT. The time now is 04:12 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.