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