commit f56e2b85d5dd133c40955e9438f4109c31cd9f30 Author: Damian Johnson atagar@torproject.org Date: Sat Jun 4 20:20:16 2011 -0700
Replacing list comprehension with map
Couple minor refactoring changes from a code review comment of Robert's. I'm actually not sure why the first was working since it was missing the brackets... --- src/cli/popups.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cli/popups.py b/src/cli/popups.py index b90f95d..52e5376 100644 --- a/src/cli/popups.py +++ b/src/cli/popups.py @@ -26,7 +26,7 @@ def init(height = -1, width = -1, top = 0, left = 0, belowStatic = True):
control = cli.controller.getController() if belowStatic: - stickyHeight = sum(stickyPanel.getHeight() for stickyPanel in control.getStickyPanels()) + stickyHeight = sum(map(getHeight, control.getStickyPanels())) else: stickyHeight = 0
popup = panel.Panel(control.getScreen(), "popup", top + stickyHeight, left, height, width) @@ -272,7 +272,7 @@ def showMenu(title, options, oldSelection): selection without a carrot if -1) """
- maxWidth = max([len(label) for label in options]) + 9 + maxWidth = max(map(len, options)) + 9 popup, _, _ = init(len(options) + 2, maxWidth) if not popup: return key, selection = 0, oldSelection if oldSelection != -1 else 0
tor-commits@lists.torproject.org