def loadFullValue(self, seq, scope_attrs): """ Evaluate full value for async Console variables in a separate thread and send results to IDE side :param seq: id of command :param scope_attrs: a sequence of variables with their attributes separated by NEXT_VALUE_SEPARATOR (i.e.: obj\tattr1\tattr2NEXT_VALUE_SEPARATORobj2\attr1\tattr2) :return: """ frame_variables = self.get_namespace() var_objects = [] vars = scope_attrs.split(NEXT_VALUE_SEPARATOR) for var_attrs in vars: if '\t' in var_attrs: name, attrs = var_attrs.split('\t', 1) else: name = var_attrs attrs = None if name in frame_variables: var_object = pydevd_vars.resolve_var_object( frame_variables[name], attrs) var_objects.append((var_object, name)) else: var_object = pydevd_vars.eval_in_context( name, frame_variables, frame_variables) var_objects.append((var_object, name)) from _pydevd_bundle.pydevd_comm import GetValueAsyncThreadConsole t = GetValueAsyncThreadConsole(self.get_server(), seq, var_objects) t.start()
def loadFullValue(self, seq, scope_attrs): """ Evaluate full value for async Console variables in a separate thread and send results to IDE side :param seq: id of command :param scope_attrs: a sequence of variables with their attributes separated by NEXT_VALUE_SEPARATOR (i.e.: obj\tattr1\tattr2NEXT_VALUE_SEPARATORobj2\attr1\tattr2) :return: """ try: frame_variables = self.get_namespace() var_objects = [] # vars = scope_attrs.split(NEXT_VALUE_SEPARATOR) vars = scope_attrs for var_attrs in vars: if '\t' in var_attrs: name, attrs = var_attrs.split('\t', 1) else: name = var_attrs attrs = None if name in frame_variables.keys(): var_object = pydevd_vars.resolve_var_object(frame_variables[name], attrs) var_objects.append((var_object, name)) else: var_object = pydevd_vars.eval_in_context(name, frame_variables, frame_variables) var_objects.append((var_object, name)) from _pydev_bundle.pydev_console_commands import ThriftGetValueAsyncThreadConsole t = ThriftGetValueAsyncThreadConsole(self.get_server(), seq, var_objects) t.start() except: traceback.print_exc() raise PythonUnhandledException(traceback.format_exc())
def loadFullValue(self, seq, scope_attrs): """ Evaluate full value for async Console variables in a separate thread and send results to IDE side :param seq: id of command :param scope_attrs: a sequence of variables with their attributes separated by NEXT_VALUE_SEPARATOR (i.e.: obj\tattr1\tattr2NEXT_VALUE_SEPARATORobj2\attr1\tattr2) :return: """ frame_variables = self.get_namespace() var_objects = [] vars = scope_attrs.split(NEXT_VALUE_SEPARATOR) for var_attrs in vars: if '\t' in var_attrs: name, attrs = var_attrs.split('\t', 1) else: name = var_attrs attrs = None if name in frame_variables: var_object = pydevd_vars.resolve_var_object(frame_variables[name], attrs) var_objects.append((var_object, name)) else: var_object = pydevd_vars.eval_in_context(name, frame_variables, frame_variables) var_objects.append((var_object, name)) from _pydevd_bundle.pydevd_comm import GetValueAsyncThreadConsole t = GetValueAsyncThreadConsole(self.get_server(), seq, var_objects) t.start()
def load_full_value(scope_attrs): ipython_shell = get_ipython() namespace = ipython_shell.user_ns vars = scope_attrs.split(NEXT_VALUE_SEPARATOR) xml_list = ["<xml>"] for var_attrs in vars: var_attrs = var_attrs.strip() if len(var_attrs) == 0: continue if '\t' in var_attrs: name, attrs = var_attrs.split('\t', 1) else: name = var_attrs attrs = None if name in namespace.keys(): var_object = resolve_var_object(namespace[name], attrs) xml_list.append( var_to_xml(var_object, name, evaluate_full_value=True)) else: var_object = eval_in_context(name, namespace, namespace) xml_list.append( var_to_xml(var_object, name, evaluate_full_value=True)) xml_list.append("</xml>") print(''.join(xml_list))