mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-46968: PY-33216 Fix IDE freeze on "View as Array" action for an array with more than two dimensions
(cherry picked from commit 7b8180485e201cc20db3d2ab3296f55bed23b70f) GitOrigin-RevId: 312248a973714f7bd491b7d5d54f66bfaea76110
This commit is contained in:
committed by
intellij-monorepo-bot
parent
00905ee6a9
commit
7eaa94c7cf
+264
@@ -0,0 +1,264 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (0.11.0)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.jetbrains.python.console.protocol;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
/**
|
||||
* Indicates that the related array has more than two dimensions.
|
||||
*
|
||||
*/
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2019-05-07")
|
||||
public class ExceedingArrayDimensionsException extends org.apache.thrift.TException implements org.apache.thrift.TBase<ExceedingArrayDimensionsException, ExceedingArrayDimensionsException._Fields>, java.io.Serializable, Cloneable, Comparable<ExceedingArrayDimensionsException> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ExceedingArrayDimensionsException");
|
||||
|
||||
|
||||
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ExceedingArrayDimensionsExceptionStandardSchemeFactory();
|
||||
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ExceedingArrayDimensionsExceptionTupleSchemeFactory();
|
||||
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
;
|
||||
|
||||
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
switch(fieldId) {
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches fieldId, throwing an exception
|
||||
* if it is not found.
|
||||
*/
|
||||
public static _Fields findByThriftIdOrThrow(int fieldId) {
|
||||
_Fields fields = findByThriftId(fieldId);
|
||||
if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
|
||||
return fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches name, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByName(java.lang.String name) {
|
||||
return byName.get(name);
|
||||
}
|
||||
|
||||
private final short _thriftId;
|
||||
private final java.lang.String _fieldName;
|
||||
|
||||
_Fields(short thriftId, java.lang.String fieldName) {
|
||||
_thriftId = thriftId;
|
||||
_fieldName = fieldName;
|
||||
}
|
||||
|
||||
public short getThriftFieldId() {
|
||||
return _thriftId;
|
||||
}
|
||||
|
||||
public java.lang.String getFieldName() {
|
||||
return _fieldName;
|
||||
}
|
||||
}
|
||||
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
|
||||
static {
|
||||
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
|
||||
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ExceedingArrayDimensionsException.class, metaDataMap);
|
||||
}
|
||||
|
||||
public ExceedingArrayDimensionsException() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public ExceedingArrayDimensionsException(ExceedingArrayDimensionsException other) {
|
||||
}
|
||||
|
||||
public ExceedingArrayDimensionsException deepCopy() {
|
||||
return new ExceedingArrayDimensionsException(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, java.lang.Object value) {
|
||||
switch (field) {
|
||||
}
|
||||
}
|
||||
|
||||
public java.lang.Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof ExceedingArrayDimensionsException)
|
||||
return this.equals((ExceedingArrayDimensionsException)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(ExceedingArrayDimensionsException that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = 1;
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ExceedingArrayDimensionsException other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
|
||||
scheme(iprot).read(iprot, this);
|
||||
}
|
||||
|
||||
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
|
||||
scheme(oprot).write(oprot, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.lang.String toString() {
|
||||
java.lang.StringBuilder sb = new java.lang.StringBuilder("ExceedingArrayDimensionsException(");
|
||||
boolean first = true;
|
||||
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void validate() throws org.apache.thrift.TException {
|
||||
// check for required fields
|
||||
// check for sub-struct validity
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||
try {
|
||||
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
|
||||
} catch (org.apache.thrift.TException te) {
|
||||
throw new java.io.IOException(te);
|
||||
}
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
|
||||
try {
|
||||
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
|
||||
} catch (org.apache.thrift.TException te) {
|
||||
throw new java.io.IOException(te);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ExceedingArrayDimensionsExceptionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public ExceedingArrayDimensionsExceptionStandardScheme getScheme() {
|
||||
return new ExceedingArrayDimensionsExceptionStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class ExceedingArrayDimensionsExceptionStandardScheme extends org.apache.thrift.scheme.StandardScheme<ExceedingArrayDimensionsException> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, ExceedingArrayDimensionsException struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TField schemeField;
|
||||
iprot.readStructBegin();
|
||||
while (true)
|
||||
{
|
||||
schemeField = iprot.readFieldBegin();
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
|
||||
break;
|
||||
}
|
||||
switch (schemeField.id) {
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
// check for required fields of primitive type, which can't be checked in the validate method
|
||||
struct.validate();
|
||||
}
|
||||
|
||||
public void write(org.apache.thrift.protocol.TProtocol oprot, ExceedingArrayDimensionsException struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ExceedingArrayDimensionsExceptionTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public ExceedingArrayDimensionsExceptionTupleScheme getScheme() {
|
||||
return new ExceedingArrayDimensionsExceptionTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class ExceedingArrayDimensionsExceptionTupleScheme extends org.apache.thrift.scheme.TupleScheme<ExceedingArrayDimensionsException> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, ExceedingArrayDimensionsException struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, ExceedingArrayDimensionsException struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
|
||||
}
|
||||
}
|
||||
|
||||
private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
|
||||
return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package com.jetbrains.python.console.protocol;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2018-08-07")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2019-05-07")
|
||||
public class PythonConsoleBackendService {
|
||||
|
||||
public interface Iface {
|
||||
@@ -74,7 +74,7 @@ public class PythonConsoleBackendService {
|
||||
|
||||
public java.util.List<DebugValue> evaluate(java.lang.String expression) throws org.apache.thrift.TException;
|
||||
|
||||
public GetArrayResponse getArray(java.lang.String vars, int rowOffset, int colOffset, int rows, int cols, java.lang.String format) throws UnsupportedArrayTypeException, org.apache.thrift.TException;
|
||||
public GetArrayResponse getArray(java.lang.String vars, int rowOffset, int colOffset, int rows, int cols, java.lang.String format) throws UnsupportedArrayTypeException, ExceedingArrayDimensionsException, org.apache.thrift.TException;
|
||||
|
||||
/**
|
||||
* The result is returned asyncronously with `PythonConsoleFrontendService.returnFullValue`.
|
||||
@@ -394,7 +394,7 @@ public class PythonConsoleBackendService {
|
||||
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "evaluate failed: unknown result");
|
||||
}
|
||||
|
||||
public GetArrayResponse getArray(java.lang.String vars, int rowOffset, int colOffset, int rows, int cols, java.lang.String format) throws UnsupportedArrayTypeException, org.apache.thrift.TException
|
||||
public GetArrayResponse getArray(java.lang.String vars, int rowOffset, int colOffset, int rows, int cols, java.lang.String format) throws UnsupportedArrayTypeException, ExceedingArrayDimensionsException, org.apache.thrift.TException
|
||||
{
|
||||
send_getArray(vars, rowOffset, colOffset, rows, cols, format);
|
||||
return recv_getArray();
|
||||
@@ -412,7 +412,7 @@ public class PythonConsoleBackendService {
|
||||
sendBase("getArray", args);
|
||||
}
|
||||
|
||||
public GetArrayResponse recv_getArray() throws UnsupportedArrayTypeException, org.apache.thrift.TException
|
||||
public GetArrayResponse recv_getArray() throws UnsupportedArrayTypeException, ExceedingArrayDimensionsException, org.apache.thrift.TException
|
||||
{
|
||||
getArray_result result = new getArray_result();
|
||||
receiveBase(result, "getArray");
|
||||
@@ -422,6 +422,9 @@ public class PythonConsoleBackendService {
|
||||
if (result.unsupported != null) {
|
||||
throw result.unsupported;
|
||||
}
|
||||
if (result.exceedingDimensions != null) {
|
||||
throw result.exceedingDimensions;
|
||||
}
|
||||
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getArray failed: unknown result");
|
||||
}
|
||||
|
||||
@@ -885,7 +888,7 @@ public class PythonConsoleBackendService {
|
||||
prot.writeMessageEnd();
|
||||
}
|
||||
|
||||
public GetArrayResponse getResult() throws UnsupportedArrayTypeException, org.apache.thrift.TException {
|
||||
public GetArrayResponse getResult() throws UnsupportedArrayTypeException, ExceedingArrayDimensionsException, org.apache.thrift.TException {
|
||||
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
|
||||
throw new java.lang.IllegalStateException("Method call not finished!");
|
||||
}
|
||||
@@ -1285,6 +1288,8 @@ public class PythonConsoleBackendService {
|
||||
result.success = iface.getArray(args.vars, args.rowOffset, args.colOffset, args.rows, args.cols, args.format);
|
||||
} catch (UnsupportedArrayTypeException unsupported) {
|
||||
result.unsupported = unsupported;
|
||||
} catch (ExceedingArrayDimensionsException exceedingDimensions) {
|
||||
result.exceedingDimensions = exceedingDimensions;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -2082,6 +2087,10 @@ public class PythonConsoleBackendService {
|
||||
result.unsupported = (UnsupportedArrayTypeException) e;
|
||||
result.setUnsupportedIsSet(true);
|
||||
msg = result;
|
||||
} else if (e instanceof ExceedingArrayDimensionsException) {
|
||||
result.exceedingDimensions = (ExceedingArrayDimensionsException) e;
|
||||
result.setExceedingDimensionsIsSet(true);
|
||||
msg = result;
|
||||
} else if (e instanceof org.apache.thrift.transport.TTransportException) {
|
||||
_LOGGER.error("TTransportException inside handler", e);
|
||||
fb.close();
|
||||
@@ -11301,17 +11310,20 @@ public class PythonConsoleBackendService {
|
||||
|
||||
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
|
||||
private static final org.apache.thrift.protocol.TField UNSUPPORTED_FIELD_DESC = new org.apache.thrift.protocol.TField("unsupported", org.apache.thrift.protocol.TType.STRUCT, (short)1);
|
||||
private static final org.apache.thrift.protocol.TField EXCEEDING_DIMENSIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("exceedingDimensions", org.apache.thrift.protocol.TType.STRUCT, (short)2);
|
||||
|
||||
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getArray_resultStandardSchemeFactory();
|
||||
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getArray_resultTupleSchemeFactory();
|
||||
|
||||
public GetArrayResponse success; // required
|
||||
public UnsupportedArrayTypeException unsupported; // required
|
||||
public ExceedingArrayDimensionsException exceedingDimensions; // required
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
SUCCESS((short)0, "success"),
|
||||
UNSUPPORTED((short)1, "unsupported");
|
||||
UNSUPPORTED((short)1, "unsupported"),
|
||||
EXCEEDING_DIMENSIONS((short)2, "exceedingDimensions");
|
||||
|
||||
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
|
||||
|
||||
@@ -11330,6 +11342,8 @@ public class PythonConsoleBackendService {
|
||||
return SUCCESS;
|
||||
case 1: // UNSUPPORTED
|
||||
return UNSUPPORTED;
|
||||
case 2: // EXCEEDING_DIMENSIONS
|
||||
return EXCEEDING_DIMENSIONS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -11377,6 +11391,8 @@ public class PythonConsoleBackendService {
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GetArrayResponse.class)));
|
||||
tmpMap.put(_Fields.UNSUPPORTED, new org.apache.thrift.meta_data.FieldMetaData("unsupported", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UnsupportedArrayTypeException.class)));
|
||||
tmpMap.put(_Fields.EXCEEDING_DIMENSIONS, new org.apache.thrift.meta_data.FieldMetaData("exceedingDimensions", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ExceedingArrayDimensionsException.class)));
|
||||
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getArray_result.class, metaDataMap);
|
||||
}
|
||||
@@ -11386,11 +11402,13 @@ public class PythonConsoleBackendService {
|
||||
|
||||
public getArray_result(
|
||||
GetArrayResponse success,
|
||||
UnsupportedArrayTypeException unsupported)
|
||||
UnsupportedArrayTypeException unsupported,
|
||||
ExceedingArrayDimensionsException exceedingDimensions)
|
||||
{
|
||||
this();
|
||||
this.success = success;
|
||||
this.unsupported = unsupported;
|
||||
this.exceedingDimensions = exceedingDimensions;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11403,6 +11421,9 @@ public class PythonConsoleBackendService {
|
||||
if (other.isSetUnsupported()) {
|
||||
this.unsupported = new UnsupportedArrayTypeException(other.unsupported);
|
||||
}
|
||||
if (other.isSetExceedingDimensions()) {
|
||||
this.exceedingDimensions = new ExceedingArrayDimensionsException(other.exceedingDimensions);
|
||||
}
|
||||
}
|
||||
|
||||
public getArray_result deepCopy() {
|
||||
@@ -11413,6 +11434,7 @@ public class PythonConsoleBackendService {
|
||||
public void clear() {
|
||||
this.success = null;
|
||||
this.unsupported = null;
|
||||
this.exceedingDimensions = null;
|
||||
}
|
||||
|
||||
public GetArrayResponse getSuccess() {
|
||||
@@ -11463,6 +11485,30 @@ public class PythonConsoleBackendService {
|
||||
}
|
||||
}
|
||||
|
||||
public ExceedingArrayDimensionsException getExceedingDimensions() {
|
||||
return this.exceedingDimensions;
|
||||
}
|
||||
|
||||
public getArray_result setExceedingDimensions(ExceedingArrayDimensionsException exceedingDimensions) {
|
||||
this.exceedingDimensions = exceedingDimensions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetExceedingDimensions() {
|
||||
this.exceedingDimensions = null;
|
||||
}
|
||||
|
||||
/** Returns true if field exceedingDimensions is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetExceedingDimensions() {
|
||||
return this.exceedingDimensions != null;
|
||||
}
|
||||
|
||||
public void setExceedingDimensionsIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.exceedingDimensions = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, java.lang.Object value) {
|
||||
switch (field) {
|
||||
case SUCCESS:
|
||||
@@ -11481,6 +11527,14 @@ public class PythonConsoleBackendService {
|
||||
}
|
||||
break;
|
||||
|
||||
case EXCEEDING_DIMENSIONS:
|
||||
if (value == null) {
|
||||
unsetExceedingDimensions();
|
||||
} else {
|
||||
setExceedingDimensions((ExceedingArrayDimensionsException)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11492,6 +11546,9 @@ public class PythonConsoleBackendService {
|
||||
case UNSUPPORTED:
|
||||
return getUnsupported();
|
||||
|
||||
case EXCEEDING_DIMENSIONS:
|
||||
return getExceedingDimensions();
|
||||
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
@@ -11507,6 +11564,8 @@ public class PythonConsoleBackendService {
|
||||
return isSetSuccess();
|
||||
case UNSUPPORTED:
|
||||
return isSetUnsupported();
|
||||
case EXCEEDING_DIMENSIONS:
|
||||
return isSetExceedingDimensions();
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
@@ -11544,6 +11603,15 @@ public class PythonConsoleBackendService {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_exceedingDimensions = true && this.isSetExceedingDimensions();
|
||||
boolean that_present_exceedingDimensions = true && that.isSetExceedingDimensions();
|
||||
if (this_present_exceedingDimensions || that_present_exceedingDimensions) {
|
||||
if (!(this_present_exceedingDimensions && that_present_exceedingDimensions))
|
||||
return false;
|
||||
if (!this.exceedingDimensions.equals(that.exceedingDimensions))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11559,6 +11627,10 @@ public class PythonConsoleBackendService {
|
||||
if (isSetUnsupported())
|
||||
hashCode = hashCode * 8191 + unsupported.hashCode();
|
||||
|
||||
hashCode = hashCode * 8191 + ((isSetExceedingDimensions()) ? 131071 : 524287);
|
||||
if (isSetExceedingDimensions())
|
||||
hashCode = hashCode * 8191 + exceedingDimensions.hashCode();
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@@ -11590,6 +11662,16 @@ public class PythonConsoleBackendService {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetExceedingDimensions()).compareTo(other.isSetExceedingDimensions());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetExceedingDimensions()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.exceedingDimensions, other.exceedingDimensions);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -11625,6 +11707,14 @@ public class PythonConsoleBackendService {
|
||||
sb.append(this.unsupported);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("exceedingDimensions:");
|
||||
if (this.exceedingDimensions == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.exceedingDimensions);
|
||||
}
|
||||
first = false;
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -11689,6 +11779,15 @@ public class PythonConsoleBackendService {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 2: // EXCEEDING_DIMENSIONS
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
|
||||
struct.exceedingDimensions = new ExceedingArrayDimensionsException();
|
||||
struct.exceedingDimensions.read(iprot);
|
||||
struct.setExceedingDimensionsIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
@@ -11714,6 +11813,11 @@ public class PythonConsoleBackendService {
|
||||
struct.unsupported.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
if (struct.exceedingDimensions != null) {
|
||||
oprot.writeFieldBegin(EXCEEDING_DIMENSIONS_FIELD_DESC);
|
||||
struct.exceedingDimensions.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
@@ -11738,19 +11842,25 @@ public class PythonConsoleBackendService {
|
||||
if (struct.isSetUnsupported()) {
|
||||
optionals.set(1);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 2);
|
||||
if (struct.isSetExceedingDimensions()) {
|
||||
optionals.set(2);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 3);
|
||||
if (struct.isSetSuccess()) {
|
||||
struct.success.write(oprot);
|
||||
}
|
||||
if (struct.isSetUnsupported()) {
|
||||
struct.unsupported.write(oprot);
|
||||
}
|
||||
if (struct.isSetExceedingDimensions()) {
|
||||
struct.exceedingDimensions.write(oprot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, getArray_result struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
|
||||
java.util.BitSet incoming = iprot.readBitSet(2);
|
||||
java.util.BitSet incoming = iprot.readBitSet(3);
|
||||
if (incoming.get(0)) {
|
||||
struct.success = new GetArrayResponse();
|
||||
struct.success.read(iprot);
|
||||
@@ -11761,6 +11871,11 @@ public class PythonConsoleBackendService {
|
||||
struct.unsupported.read(iprot);
|
||||
struct.setUnsupportedIsSet(true);
|
||||
}
|
||||
if (incoming.get(2)) {
|
||||
struct.exceedingDimensions = new ExceedingArrayDimensionsException();
|
||||
struct.exceedingDimensions.read(iprot);
|
||||
struct.setExceedingDimensionsIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from _pydevd_bundle.pydevd_constants import dict_iter_items, dict_keys, IS_PY3K,
|
||||
from _pydevd_bundle.pydevd_extension_api import TypeResolveProvider, StrPresentationProvider
|
||||
from _pydevd_bundle.pydevd_vars import get_label, array_default_format, MAXIMUM_ARRAY_SIZE
|
||||
from pydev_console.protocol import DebugValue, GetArrayResponse, ArrayData, ArrayHeaders, ColHeader, RowHeader, \
|
||||
UnsupportedArrayTypeException
|
||||
UnsupportedArrayTypeException, ExceedingArrayDimensionsException
|
||||
from _pydevd_bundle.pydevd_utils import take_first_n_coll_elements
|
||||
|
||||
try:
|
||||
@@ -440,7 +440,7 @@ def array_to_meta_thrift_struct(array, name, format):
|
||||
l = len(array.shape)
|
||||
reslice = ""
|
||||
if l > 2:
|
||||
raise Exception("%s has more than 2 dimensions." % slice)
|
||||
raise ExceedingArrayDimensionsException
|
||||
elif l == 1:
|
||||
# special case with 1D arrays arr[i, :] - row, but arr[:, i] - column with equal shape and ndim
|
||||
# http://stackoverflow.com/questions/16837946/numpy-a-2-rows-1-column-file-loadtxt-returns-1row-2-columns
|
||||
|
||||
@@ -112,6 +112,12 @@ exception UnsupportedArrayTypeException {
|
||||
1: string type,
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that the related array has more than two dimensions.
|
||||
**/
|
||||
exception ExceedingArrayDimensionsException {
|
||||
}
|
||||
|
||||
service PythonConsoleBackendService {
|
||||
/**
|
||||
* Returns `true` if Python console script needs more code to evaluate it.
|
||||
@@ -164,7 +170,7 @@ service PythonConsoleBackendService {
|
||||
DebugValues evaluate(1: string expression),
|
||||
|
||||
GetArrayResponse getArray(1: string vars, 2: i32 rowOffset, 3: i32 colOffset, 4: i32 rows, 5: i32 cols, 6: string format)
|
||||
throws (1: UnsupportedArrayTypeException unsupported),
|
||||
throws (1: UnsupportedArrayTypeException unsupported, 2: ExceedingArrayDimensionsException exceedingDimensions),
|
||||
|
||||
/**
|
||||
* The result is returned asyncronously with `PythonConsoleFrontendService.returnFullValue`.
|
||||
|
||||
@@ -16,6 +16,7 @@ ColHeader = _console_thrift.ColHeader
|
||||
RowHeader = _console_thrift.RowHeader
|
||||
|
||||
UnsupportedArrayTypeException = _console_thrift.UnsupportedArrayTypeException
|
||||
ExceedingArrayDimensionsException = _console_thrift.ExceedingArrayDimensionsException
|
||||
KeyboardInterruptException = _console_thrift.KeyboardInterruptException
|
||||
|
||||
PythonConsoleFrontendService = _console_thrift.PythonConsoleFrontendService
|
||||
|
||||
@@ -27,6 +27,10 @@ public interface PyFrameAccessor {
|
||||
@Nullable
|
||||
PyReferrersLoader getReferrersLoader();
|
||||
|
||||
/**
|
||||
* @throws IllegalArgumentException if the type of the {@code var} is not supported
|
||||
* or the corresponding array has more than two dimensions
|
||||
*/
|
||||
ArrayChunk getArrayItems(PyDebugValue var, int rowOffset, int colOffset, int rows, int cols, String format) throws PyDebuggerException;
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -603,6 +603,12 @@ public abstract class PydevConsoleCommunication extends AbstractConsoleCommunica
|
||||
GetArrayResponse ret = getPythonConsoleBackendClient().getArray(var.getName(), rowOffset, colOffset, rows, cols, format);
|
||||
return createArrayChunk(ret, this);
|
||||
}
|
||||
catch (UnsupportedArrayTypeException e) {
|
||||
throw new IllegalArgumentException(var.getType() + " is not supported", e);
|
||||
}
|
||||
catch (ExceedingArrayDimensionsException e) {
|
||||
throw new IllegalArgumentException(var.getName() + " has more than two dimensions", e);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new PyDebuggerException("Evaluate in console failed", e);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,10 @@ public class PyDataViewerPanel extends JPanel {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() -> {
|
||||
try {
|
||||
ArrayChunk arrayChunk = debugValue.getFrameAccessor().getArrayItems(debugValue, 0, 0, -1, -1, getFormat());
|
||||
ApplicationManager.getApplication().invokeLater(() -> updateUI(arrayChunk, debugValue, strategy));
|
||||
ApplicationManager.getApplication().invokeLater(() -> updateUI(arrayChunk, strategy));
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
setError(e.getLocalizedMessage());
|
||||
}
|
||||
catch (PyDebuggerException e) {
|
||||
LOG.error(e);
|
||||
@@ -189,7 +192,8 @@ public class PyDataViewerPanel extends JPanel {
|
||||
apply(getSliceTextField().getText());
|
||||
}
|
||||
|
||||
private void updateUI(@NotNull ArrayChunk chunk, @NotNull PyDebugValue debugValue, @NotNull DataViewStrategy strategy) {
|
||||
private void updateUI(@NotNull ArrayChunk chunk, @NotNull DataViewStrategy strategy) {
|
||||
PyDebugValue debugValue = chunk.getValue();
|
||||
AsyncArrayTableModel model = strategy.createTableModel(chunk.getRows(), chunk.getColumns(), this, debugValue);
|
||||
model.addToCache(chunk);
|
||||
|
||||
|
||||
Regular → Executable
Reference in New Issue
Block a user