mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
PY-18029 Fix-up for initial pydev console changes
This commit is contained in:
@@ -8,7 +8,7 @@ from _pydev_bundle.pydev_imports import _queue, Exec
|
|||||||
from _pydev_imps._pydev_saved_modules import thread
|
from _pydev_imps._pydev_saved_modules import thread
|
||||||
from _pydevd_bundle import pydevd_thrift
|
from _pydevd_bundle import pydevd_thrift
|
||||||
from _pydevd_bundle import pydevd_vars
|
from _pydevd_bundle import pydevd_vars
|
||||||
from _pydevd_bundle.pydevd_constants import IS_JYTHON, dict_iter_items, NEXT_VALUE_SEPARATOR
|
from _pydevd_bundle.pydevd_constants import IS_JYTHON, dict_iter_items
|
||||||
from pydev_console.thrift_communication import console_thrift
|
from pydev_console.thrift_communication import console_thrift
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -536,7 +536,7 @@ class BaseInterpreterInterface:
|
|||||||
# xml.write(pydevd_vars.var_to_xml(result, expression))
|
# xml.write(pydevd_vars.var_to_xml(result, expression))
|
||||||
# xml.write("</xml>")
|
# xml.write("</xml>")
|
||||||
# return xml.getvalue()
|
# return xml.getvalue()
|
||||||
return pydevd_thrift.var_to_struct(result, expression)
|
return [pydevd_thrift.var_to_struct(result, expression)]
|
||||||
|
|
||||||
def do_get_completions(self, text, act_tok):
|
def do_get_completions(self, text, act_tok):
|
||||||
"""Retrieves completion options.
|
"""Retrieves completion options.
|
||||||
@@ -582,7 +582,8 @@ class BaseInterpreterInterface:
|
|||||||
"""
|
"""
|
||||||
frame_variables = self.get_namespace()
|
frame_variables = self.get_namespace()
|
||||||
var_objects = []
|
var_objects = []
|
||||||
vars = scope_attrs.split(NEXT_VALUE_SEPARATOR)
|
# vars = scope_attrs.split(NEXT_VALUE_SEPARATOR)
|
||||||
|
vars = scope_attrs
|
||||||
for var_attrs in vars:
|
for var_attrs in vars:
|
||||||
if '\t' in var_attrs:
|
if '\t' in var_attrs:
|
||||||
name, attrs = var_attrs.split('\t', 1)
|
name, attrs = var_attrs.split('\t', 1)
|
||||||
|
|||||||
@@ -389,3 +389,7 @@ def var_to_struct(val, name, doTrim=True, additional_in_xml='', evaluate_full_va
|
|||||||
return debug_value
|
return debug_value
|
||||||
# return ''.join((xml, xml_qualifier, xml_value, xml_container, additional_in_xml, ' />\n'))
|
# return ''.join((xml, xml_qualifier, xml_value, xml_container, additional_in_xml, ' />\n'))
|
||||||
|
|
||||||
|
|
||||||
|
def var_to_str(val, doTrim=True, evaluate_full_value=True):
|
||||||
|
struct = var_to_struct(val, '', doTrim, '', evaluate_full_value)
|
||||||
|
return struct.value
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import pickle
|
|||||||
from _pydev_imps._pydev_saved_modules import thread
|
from _pydev_imps._pydev_saved_modules import thread
|
||||||
from _pydevd_bundle.pydevd_constants import get_frame, get_thread_id, xrange
|
from _pydevd_bundle.pydevd_constants import get_frame, get_thread_id, xrange
|
||||||
from _pydevd_bundle.pydevd_custom_frames import get_custom_frame
|
from _pydevd_bundle.pydevd_custom_frames import get_custom_frame
|
||||||
|
from _pydevd_bundle.pydevd_thrift import var_to_str
|
||||||
from _pydevd_bundle.pydevd_xml import ExceptionOnEvaluate, get_type, var_to_xml
|
from _pydevd_bundle.pydevd_xml import ExceptionOnEvaluate, get_type, var_to_xml
|
||||||
|
from pydev_console.thrift_communication import console_thrift
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
@@ -749,7 +751,7 @@ def array_to_meta_thrift_struct(array, name, format):
|
|||||||
if type in "biufc":
|
if type in "biufc":
|
||||||
bounds = (array.min(), array.max())
|
bounds = (array.min(), array.max())
|
||||||
# return array, slice_to_xml(slice, rows, cols, format, type, bounds), rows, cols, format
|
# return array, slice_to_xml(slice, rows, cols, format, type, bounds), rows, cols, format
|
||||||
array_chunk = python_console_thrift.GetArrayResponse()
|
array_chunk = console_thrift.GetArrayResponse()
|
||||||
array_chunk.slice = slice
|
array_chunk.slice = slice
|
||||||
array_chunk.rows = rows
|
array_chunk.rows = rows
|
||||||
array_chunk.cols = cols
|
array_chunk.cols = cols
|
||||||
@@ -776,7 +778,7 @@ def dataframe_to_thrift_struct(df, name, roffset, coffset, rows, cols, format):
|
|||||||
num_rows = df.shape[0]
|
num_rows = df.shape[0]
|
||||||
num_cols = df.shape[1] if dim > 1 else 1
|
num_cols = df.shape[1] if dim > 1 else 1
|
||||||
# xml = slice_to_xml(name, num_rows, num_cols, "", "", (0, 0))
|
# xml = slice_to_xml(name, num_rows, num_cols, "", "", (0, 0))
|
||||||
array_chunk = python_console_thrift.GetArrayResponse()
|
array_chunk = console_thrift.GetArrayResponse()
|
||||||
array_chunk.slice = name
|
array_chunk.slice = name
|
||||||
array_chunk.rows = num_rows
|
array_chunk.rows = num_rows
|
||||||
array_chunk.cols = num_cols
|
array_chunk.cols = num_cols
|
||||||
@@ -826,7 +828,7 @@ def dataframe_to_thrift_struct(df, name, roffset, coffset, rows, cols, format):
|
|||||||
|
|
||||||
|
|
||||||
def array_data_to_thrift_struct(rows, cols, get_row):
|
def array_data_to_thrift_struct(rows, cols, get_row):
|
||||||
array_data = python_console_thrift.ArrayData()
|
array_data = console_thrift.ArrayData()
|
||||||
# xml = "<arraydata rows=\"%s\" cols=\"%s\"/>\n" % (rows, cols)
|
# xml = "<arraydata rows=\"%s\" cols=\"%s\"/>\n" % (rows, cols)
|
||||||
array_data.rows = rows
|
array_data.rows = rows
|
||||||
array_data.cols = cols
|
array_data.cols = cols
|
||||||
@@ -834,9 +836,10 @@ def array_data_to_thrift_struct(rows, cols, get_row):
|
|||||||
data = []
|
data = []
|
||||||
for row in range(rows):
|
for row in range(rows):
|
||||||
# xml += "<row index=\"%s\"/>\n" % to_string(row)
|
# xml += "<row index=\"%s\"/>\n" % to_string(row)
|
||||||
for value in get_row(row):
|
# for value in get_row(row):
|
||||||
# xml += var_to_xml(value, '')
|
# xml += var_to_xml(value, '')
|
||||||
data.append(value)
|
data.append([var_to_str(value) for value in get_row(row)])
|
||||||
|
|
||||||
array_data.data = data
|
array_data.data = data
|
||||||
# return xml
|
# return xml
|
||||||
return array_data
|
return array_data
|
||||||
@@ -844,13 +847,13 @@ def array_data_to_thrift_struct(rows, cols, get_row):
|
|||||||
|
|
||||||
def header_data_to_thrift_struct(rows, cols, dtypes, col_bounds, col_to_format, df, dim):
|
def header_data_to_thrift_struct(rows, cols, dtypes, col_bounds, col_to_format, df, dim):
|
||||||
# xml = "<headerdata rows=\"%s\" cols=\"%s\">\n" % (rows, cols)
|
# xml = "<headerdata rows=\"%s\" cols=\"%s\">\n" % (rows, cols)
|
||||||
array_headers = python_console_thrift.ArrayHeaders()
|
array_headers = console_thrift.ArrayHeaders()
|
||||||
col_headers = []
|
col_headers = []
|
||||||
for col in range(cols):
|
for col in range(cols):
|
||||||
col_label = get_label(df.axes[1].values[col]) if dim > 1 else str(col)
|
col_label = get_label(df.axes[1].values[col]) if dim > 1 else str(col)
|
||||||
bounds = col_bounds[col]
|
bounds = col_bounds[col]
|
||||||
col_format = "%" + col_to_format(col)
|
col_format = "%" + col_to_format(col)
|
||||||
col_header = python_console_thrift.ColHeader()
|
col_header = console_thrift.ColHeader()
|
||||||
# col_header.index = col
|
# col_header.index = col
|
||||||
col_header.label = col_label
|
col_header.label = col_label
|
||||||
col_header.type = dtypes[col]
|
col_header.type = dtypes[col]
|
||||||
@@ -860,7 +863,7 @@ def header_data_to_thrift_struct(rows, cols, dtypes, col_bounds, col_to_format,
|
|||||||
col_headers.append(col_header)
|
col_headers.append(col_header)
|
||||||
row_headers = []
|
row_headers = []
|
||||||
for row in range(rows):
|
for row in range(rows):
|
||||||
row_header = python_console_thrift.RowHeader()
|
row_header = console_thrift.RowHeader()
|
||||||
row_header.index = row
|
row_header.index = row
|
||||||
row_header.label = get_label(df.axes[0].values[row])
|
row_header.label = get_label(df.axes[0].values[row])
|
||||||
row_headers.append(row_header)
|
row_headers.append(row_header)
|
||||||
|
|||||||
Reference in New Issue
Block a user