Permalink
Browse files

refactored value printing code in _input_locals_cmd into seperate fun…

…ction
  • Loading branch information...
1 parent 1bada24 commit 59712bdea96ec059f383ce04865d168bd3fd8ef7 @devhawk committed Mar 28, 2009
Showing with 16 additions and 16 deletions.
  1. +16 −16 ipydbg.py
View
32 ipydbg.py
@@ -324,30 +324,30 @@ def _input_quit_cmd(self, keyinfo):
self.process.Stop(0)
self.process.Terminate(255)
return True
-
+
@inputcmd(_inputcmds, ConsoleKey.L)
def _input_locals_cmd(self, keyinfo):
- print "\nLocals"
- show_hidden = (keyinfo.Modifiers & ConsoleModifiers.Alt) == ConsoleModifiers.Alt
- locals = get_locals(self.active_thread.ActiveFrame, show_hidden)
- args = get_arguments(self.active_thread.ActiveFrame, show_hidden)
- count = 0
- for name,value in ((name, extract_value(value)) for name, value in locals):
- display, type_name = display_value(value)
+ def print_value(name, value):
+ display, type_name = display_value(extract_value(value))
with CC.Magenta: print " ", name,
print display,
with CC.Green: print type_name
+
+ print "\nLocals"
+ show_hidden = (keyinfo.Modifiers & ConsoleModifiers.Alt) == ConsoleModifiers.Alt
+ locals = get_locals(self.active_thread.ActiveFrame, show_hidden = show_hidden)
+ args = get_arguments(self.active_thread.ActiveFrame, show_hidden = show_hidden)
+
+ count = 0
+ for name,value in locals:
+ print_value(name, value)
count+=1
- for name,value in ((name, extract_value(value)) for name, value in args):
- display, type_name = display_value(value)
- with CC.Magenta: print " ", name,
- print display,
- with CC.Green: print type_name
+ for name,value in args:
+ print_value(name, value)
count+=1
- else:
- if count == 0:
+
+ if count == 0:
with CC.Magenta: print " No Locals Found"
- return False
@inputcmd(_inputcmds, ConsoleKey.T)
def _input_stack_trace_cmd(self, keyinfo):

0 comments on commit 59712bd

Please sign in to comment.