예제 #1
0
def _annotate(line, annotations, scroll):
    by_priority = sorted(annotations, reverse=True)

    style = by_priority[0].style.value
    text = ',\n'.join([a.text for a in by_priority])

    editor.annotate_line(line, text, style, True, scroll=scroll)
예제 #2
0
    def wrapper(*args, **kwargs):
        #ln = inspect.currentframe().f_back.f_lineno
        #ln = inspect.currentframe().f_lineno
        '''
		i tried to get the right line number...it didnt work it out. i am sure its possible,
		i hard coded in just for the sake of showing the raw idea
		'''
        editor.annotate_line(22, str(inspect.currentframe().f_locals))
        return func(*args, **kwargs)
예제 #3
0
파일: vdb.py 프로젝트: jsbain/vdb
    def setup_ui(self):
        self.curframe = self.stack[self.curindex][0]
        # The f_locals dictionary is updated from the actual frame
        # locals whenever the .f_locals accessor is called, so we
        # cache it here to ensure that modifications are not overwritten.
        editor.clear_annotations()
        self.curframe_locals = self.curframe.f_locals
        frame = self.curframe

        editor.open_file(frame.f_code.co_filename)
        editor.annotate_line(frame.f_lineno,
                             filename=frame.f_code.co_filename,
                             scroll=True)
        self.show_menu()
        self.debugmenu['down'].enabled = self.curindex < len(self.stack) - 1
        self.debugmenu['up'].enabled = self.curindex > 0
        console.hide_output()
예제 #4
0
파일: vdb.py 프로젝트: jsbain/vdb
	def setup_ui(self):
		self.curframe = self.stack[self.curindex][0]
		# The f_locals dictionary is updated from the actual frame
		# locals whenever the .f_locals accessor is called, so we
		# cache it here to ensure that modifications are not overwritten.
		editor.clear_annotations()
		self.curframe_locals = self.curframe.f_locals
		frame=self.curframe
		
		editor.open_file(frame.f_code.co_filename)
		editor.annotate_line(frame.f_lineno,
									filename = frame.f_code.co_filename,
									scroll = True)
		self.show_menu()
		self.debugmenu['down'].enabled=self.curindex<len(self.stack)-1
		self.debugmenu['up'].enabled=self.curindex>0
		console.hide_output()
예제 #5
0
def _run_unit_tests(path):
    editor.clear_annotations()

    _remove_log_file()
    pytest.main([
        '-q', '-p', 'no:cacheprovider', '--junitxml={}'.format(_LOG_FILE_PATH),
        path
    ])
    attrib, annotations = _parse_log_file()

    _show_results(attrib, not annotations)

    scroll = True
    for a in annotations:
        editor.annotate_line(a.line,
                             a.text,
                             a.style.value,
                             True,
                             filename=a.filename,
                             scroll=scroll)
        scroll = False

    if _hide_console():
        console.hide_output()
def mark_lines(lns, s_text):
    for i, ln in enumerate(lns):
        editor.annotate_line(ln,
                             text=str(i + 1),
                             style='success',
                             expanded=False)
예제 #7
0
    ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]')
    return ansi_escape.sub('', line)


def get_error_line(errors):
    evalueline = re.search('line (\d*)', errors['evalue'])
    if evalueline:
        return int(evalueline.group()[5:])
    tracebackline = int(
        re.search(r'---> (\d*)', ''.join(errors['traceback'])).group()[5:])
    return tracebackline


if __name__ == "__main__":
    import editor, sys, console
    url = 'https://sagecell.sagemath.org'
    a = SageCell(url)
    import pprint
    data = a.execute_request(editor.get_text())
    txt, errors, variables = process_data(data)
    if errors['evalue']:
        sys.stdout.write(
            '\n'.join([errors['ename'], errors['evalue']] +
                      [escape_ansi(l) for l in errors['traceback']]))
        editor.annotate_line(get_error_line(errors),
                             errors['evalue'],
                             style='error')
        console.hide_output()
    else:
        print(txt)