def runsource(self, source, filename="<input>", symbol="single"): try: source = core.transpile(source) if source.endswith('\n'): source = source[:-1] code = self.compile(source, filename, symbol) except (OverflowError, SyntaxError, ValueError): # Case 1 print(source) self.showsyntaxerror(filename) return False if code is None: # Case 2 return True # Case 3 self.runcode(code) return False
def runcode(self, code): if isinstance(code, str): code = core.transpile(code) super(PyTugaConsole, self).runcode(code)
def pytg(src): return [repr(x) for x in fromstring(transpile(src))]
def test_transpile(): py = transpile('enquanto verdadeiro ou falso: prosseguir') assert py == 'while True or False: pass'
def pytg(src): return [repr(x) for x in tokenize(transpile(src))]