def is_incomplete_source(self, src, filename="<input>", symbol="single"):
"""
Test if a given source code is incomplete.
Incomplete code may appear in users interactions when user is typing a
multi line command:
for x in range(10):
... should continue here, but user already pressed enter!
"""
try:
pytuga_src = self.transpile(src)
except SyntaxError:
return True
return codeop.compile_command(pytuga_src, filename, symbol) is None
评论列表
文章目录