Gentoo Archives: gentoo-portage-dev

From: Ali Polatel <hawking@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] Fix warning for lib2to3/fixes/fix_map.py
Date: Fri, 15 Aug 2008 15:13:12
Message-Id: 1218813185-32162-1-git-send-email-hawking@gentoo.org
1 2to3 gives a warning while converting portage codebase using map¹ fix:
2 RefactoringTool: Warnings/messages while refactoring:
3 RefactoringTool: ### In file ./pym/portage/dbapi/porttree.py ###
4 RefactoringTool: Line 266: You should use a for loop here
5
6 This is a valid warning because map() will change in py3k. Read the docstring of
7 fix_map.py for more information.
8
9 ¹: http://svn.python.org/view/python/trunk/Lib/lib2to3/fixes/fix_map.py
10
11 ---
12 pym/portage/dbapi/porttree.py | 3 ++-
13 1 files changed, 2 insertions(+), 1 deletions(-)
14
15 diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
16 index 2948ba6..4e76b1e 100644
17 --- a/pym/portage/dbapi/porttree.py
18 +++ b/pym/portage/dbapi/porttree.py
19 @@ -263,7 +263,8 @@ class portdbapi(dbapi):
20 # if newer version, wipe everything and negate eapi
21 eapi = metadata["EAPI"]
22 metadata = {}
23 - map(lambda x: metadata.setdefault(x, ""), auxdbkeys)
24 + for x in auxdbkeys:
25 + metadata.setdefault(x, "")
26 metadata["EAPI"] = "-" + eapi
27
28 if metadata.get("INHERITED", False):
29 --
30 Regards,
31 Ali Polatel

Replies