Skip to content

Commit d0e879e

Browse files
committed
Tweak some more the builtins display.
1 parent 2dfbf1a commit d0e879e

2 files changed

Lines changed: 29 additions & 16 deletions

File tree

src/hunter/actions.py

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def __call__(self, event):
453453
if event.kind == 'call':
454454
if event.builtin:
455455
self.output(
456-
'{}{}{}{KIND}{:9} {}{COLOR} >{NORMAL} {}.{}: {}{RESET}\n',
456+
'{}{}{}{KIND}{:9} {}{COLOR} >{BUILTIN} {}.{}: {}{RESET}\n',
457457
pid_prefix,
458458
thread_prefix,
459459
filename_prefix,
@@ -462,7 +462,7 @@ def __call__(self, event):
462462
event.module,
463463
event.function,
464464
self.try_source(event).strip(),
465-
COLOR=self.event_colors['builtin'],
465+
COLOR=self.event_colors.get(event.kind),
466466
)
467467
else:
468468
code = event.code
@@ -484,29 +484,42 @@ def __call__(self, event):
484484
COLOR=self.event_colors.get(event.kind),
485485
)
486486
elif event.kind == 'exception':
487-
self.output(
488-
'{}{}{}{KIND}{:9} {}{COLOR} !{NORMAL} {}: {RESET}{}\n',
489-
pid_prefix,
490-
thread_prefix,
491-
filename_prefix,
492-
event.kind,
493-
' ' * (len(stack) - 1),
494-
event.function,
495-
self.try_str(event.arg) if event.detached else self.try_repr(event.arg),
496-
COLOR=self.event_colors.get(event.kind),
497-
)
487+
if event.builtin:
488+
self.output(
489+
'{}{}{}{KIND}{:9} {}{COLOR} ! {BUILTIN}{}.{}{RESET}\n',
490+
pid_prefix,
491+
thread_prefix,
492+
filename_prefix,
493+
event.kind,
494+
' ' * (len(stack) - 1),
495+
event.module,
496+
event.function,
497+
COLOR=self.event_colors.get(event.kind),
498+
)
499+
else:
500+
self.output(
501+
'{}{}{}{KIND}{:9} {}{COLOR} !{NORMAL} {}: {RESET}{}\n',
502+
pid_prefix,
503+
thread_prefix,
504+
filename_prefix,
505+
event.kind,
506+
' ' * (len(stack) - 1),
507+
event.function,
508+
self.try_str(event.arg) if event.detached else self.try_repr(event.arg),
509+
COLOR=self.event_colors.get(event.kind),
510+
)
498511
elif event.kind == 'return':
499512
if event.builtin:
500513
self.output(
501-
'{}{}{}{KIND}{:9} {}{COLOR} <{NORMAL} {}.{}{RESET}\n',
514+
'{}{}{}{KIND}{:9} {}{COLOR} <{BUILTIN} {}.{}{RESET}\n',
502515
pid_prefix,
503516
thread_prefix,
504517
filename_prefix,
505518
event.kind,
506519
' ' * (len(stack) - 1),
507520
event.module,
508521
event.function,
509-
COLOR=self.event_colors['builtin'],
522+
COLOR=self.event_colors.get(event.kind),
510523
)
511524
else:
512525
self.output(

src/hunter/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
'INTERNAL-DETAIL': Fore.WHITE,
7272
'SOURCE-FAILURE': Style.BRIGHT + Back.YELLOW + Fore.YELLOW,
7373
'SOURCE-DETAIL': Fore.WHITE,
74+
'BUILTIN': Style.NORMAL + Fore.MAGENTA,
7475

7576
'RESET': Style.RESET_ALL,
7677
}
@@ -83,7 +84,6 @@
8384
OTHER_COLORS['{}({})'.format(name, key) if name else key] = getattr(group, key)
8485
CALL_COLORS = {
8586
'call': Style.BRIGHT + Fore.BLUE,
86-
'builtin': Style.BRIGHT + Fore.MAGENTA,
8787
'line': Fore.RESET,
8888
'return': Style.BRIGHT + Fore.GREEN,
8989
'exception': Style.BRIGHT + Fore.RED,

0 commit comments

Comments
 (0)