Skip to content

Commit

Permalink
refactored value looping code into print_all_values function
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Pierson committed Apr 3, 2009
1 parent 59712bd commit b858056
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions ipydbg.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,18 @@ def print_value(name, value):
print display,
with CC.Green: print type_name

def print_all_values(f, show_hidden):
count = 0
for name,value in f(self.active_thread.ActiveFrame, show_hidden = show_hidden):
print_value(name, value)
count+=1
return count

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 args:
print_value(name, value)
count+=1

count = print_all_values(get_locals, show_hidden)
count += print_all_values(get_arguments, show_hidden)

if count == 0:
with CC.Magenta: print " No Locals Found"

Expand Down

0 comments on commit b858056

Please sign in to comment.