##// END OF EJS Templates
Update displayhook.py...
thethomask -
Show More
@@ -84,18 +84,22 b' class DisplayHook(Configurable):'
84 def quiet(self):
84 def quiet(self):
85 """Should we silence the display hook because of ';'?"""
85 """Should we silence the display hook because of ';'?"""
86 # do not print output if input ends in ';'
86 # do not print output if input ends in ';'
87
87
88 cell = self.shell.history_manager.input_hist_parsed[self.prompt_count]
88 cell = self.shell.history_manager.input_hist_parsed[self.prompt_count]
89 sio = io.StringIO(cell)
89 sio = io.StringIO(cell)
90 tokens = list(tokenize.generate_tokens(sio.readline))
90 tokens = list(tokenize.generate_tokens(sio.readline))
91
91
92 for token in reversed(tokens):
92 try:
93 if token.type in (tokenize.ENDMARKER, tokenize.COMMENT):
93 for token in reversed(tokens):
94 continue
94 if token.type in (tokenize.ENDMARKER, tokenize.COMMENT):
95 if (token.type == tokenize.OP) and (token.string == ';'):
95 continue
96 return True
96 if (token.type == tokenize.OP) and (token.string == ';'):
97 else:
97 return True
98 return False
98 else:
99 return False
100 except IndexError:
101 # some uses of ipshellembed may fail here
102 return False
99
103
100 def start_displayhook(self):
104 def start_displayhook(self):
101 """Start the displayhook, initializing resources."""
105 """Start the displayhook, initializing resources."""
General Comments 0
You need to be logged in to leave comments. Login now