Skip to content

Commit

Permalink
Filtered out irrelevant variables
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanMabille committed Mar 5, 2021
1 parent 55c34e4 commit e05426d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions ipykernel/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ def _handle_event(self, msg):
if msg['event'] == 'stopped':
self.stopped_threads.append(msg['body']['threadId'])
elif msg['event'] == 'continued':
self.stopped_threads.remove(msg['body']['threadId'])
try:
self.stopped_threads.remove(msg['body']['threadId'])
except:
pass
self.event_callback(msg)

async def _forward_message(self, msg):
Expand Down Expand Up @@ -324,7 +327,10 @@ async def stackTrace(self, message):
return reply

def accept_variable(self, variable):
return variable['type'] != 'list' and variable['type'] != 'ZMQExitAutocall' and variable['type'] != 'dict'
cond = variable['type'] != 'list' and variable['type'] != 'ZMQExitAutocall' and variable['type'] != 'dict'
cond = cond and variable['name'] not in ['debugpy', 'get_ipython', '_']
cond = cond and variable['name'][0:2] != '_i'
return cond

async def variables(self, message):
reply = await self._forward_message(message)
Expand Down
3 changes: 2 additions & 1 deletion ipykernel/ipkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def set_parent(self, ident, parent, channel='shell'):
about the parent message.
"""
super(IPythonKernel, self).set_parent(ident, parent, channel)
self.shell.set_parent(parent)
if channel == 'shell':
self.shell.set_parent(parent)

def init_metadata(self, parent):
"""Initialize metadata.
Expand Down

0 comments on commit e05426d

Please sign in to comment.