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


Reply via email to