mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
DS-1417 DS-2096 Support inline matplotlib plots and DataFrames in Python Console
GitOrigin-RevId: 85a82da3f35387473b21ee09c3082378a75a0848
This commit is contained in:
committed by
intellij-monorepo-bot
parent
804d0d6c69
commit
b91198e65c
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class ArrayData implements org.apache.thrift.TBase<ArrayData, ArrayData._Fields>, java.io.Serializable, Cloneable, Comparable<ArrayData> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ArrayData");
|
||||
|
||||
|
||||
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class ArrayHeaders implements org.apache.thrift.TBase<ArrayHeaders, ArrayHeaders._Fields>, java.io.Serializable, Cloneable, Comparable<ArrayHeaders> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ArrayHeaders");
|
||||
|
||||
|
||||
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class ColHeader implements org.apache.thrift.TBase<ColHeader, ColHeader._Fields>, java.io.Serializable, Cloneable, Comparable<ColHeader> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColHeader");
|
||||
|
||||
|
||||
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class CompletionOption implements org.apache.thrift.TBase<CompletionOption, CompletionOption._Fields>, java.io.Serializable, Cloneable, Comparable<CompletionOption> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CompletionOption");
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ package com.jetbrains.python.console.protocol;
|
||||
/**
|
||||
* Corresponds to completion types declared in "_pydev_bundle/_pydev_imports_tipper.py".
|
||||
*/
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public enum CompletionOptionType implements org.apache.thrift.TEnum {
|
||||
IMPORT(0),
|
||||
CLASS(1),
|
||||
|
||||
@@ -10,7 +10,7 @@ package com.jetbrains.python.console.protocol;
|
||||
/**
|
||||
* Corresponds to `PyDebugValue`.
|
||||
*/
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class DebugValue implements org.apache.thrift.TBase<DebugValue, DebugValue._Fields>, java.io.Serializable, Cloneable, Comparable<DebugValue> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DebugValue");
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ package com.jetbrains.python.console.protocol;
|
||||
* Indicates that the related array has more than two dimensions.
|
||||
*
|
||||
*/
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
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");
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ package com.jetbrains.python.console.protocol;
|
||||
* Corresponds to `ArrayChunk`.
|
||||
*
|
||||
*/
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class GetArrayResponse implements org.apache.thrift.TBase<GetArrayResponse, GetArrayResponse._Fields>, java.io.Serializable, Cloneable, Comparable<GetArrayResponse> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetArrayResponse");
|
||||
|
||||
|
||||
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class KeyboardInterruptException extends org.apache.thrift.TException implements org.apache.thrift.TBase<KeyboardInterruptException, KeyboardInterruptException._Fields>, java.io.Serializable, Cloneable, Comparable<KeyboardInterruptException> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("KeyboardInterruptException");
|
||||
|
||||
|
||||
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class PythonConsoleBackendService {
|
||||
|
||||
public interface Iface {
|
||||
|
||||
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class PythonConsoleFrontendService {
|
||||
|
||||
public interface Iface {
|
||||
@@ -30,6 +30,8 @@ public class PythonConsoleFrontendService {
|
||||
|
||||
public boolean IPythonEditor(java.lang.String path, java.lang.String line) throws org.apache.thrift.TException;
|
||||
|
||||
public void sendRichOutput(java.util.Map<java.lang.String,java.lang.String> data) throws org.apache.thrift.TException;
|
||||
|
||||
}
|
||||
|
||||
public interface AsyncIface {
|
||||
@@ -46,6 +48,8 @@ public class PythonConsoleFrontendService {
|
||||
|
||||
public void IPythonEditor(java.lang.String path, java.lang.String line, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException;
|
||||
|
||||
public void sendRichOutput(java.util.Map<java.lang.String,java.lang.String> data, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException;
|
||||
|
||||
}
|
||||
|
||||
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
|
||||
@@ -199,6 +203,26 @@ public class PythonConsoleFrontendService {
|
||||
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "IPythonEditor failed: unknown result");
|
||||
}
|
||||
|
||||
public void sendRichOutput(java.util.Map<java.lang.String,java.lang.String> data) throws org.apache.thrift.TException
|
||||
{
|
||||
send_sendRichOutput(data);
|
||||
recv_sendRichOutput();
|
||||
}
|
||||
|
||||
public void send_sendRichOutput(java.util.Map<java.lang.String,java.lang.String> data) throws org.apache.thrift.TException
|
||||
{
|
||||
sendRichOutput_args args = new sendRichOutput_args();
|
||||
args.setData(data);
|
||||
sendBase("sendRichOutput", args);
|
||||
}
|
||||
|
||||
public void recv_sendRichOutput() throws org.apache.thrift.TException
|
||||
{
|
||||
sendRichOutput_result result = new sendRichOutput_result();
|
||||
receiveBase(result, "sendRichOutput");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
|
||||
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
|
||||
@@ -415,6 +439,38 @@ public class PythonConsoleFrontendService {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendRichOutput(java.util.Map<java.lang.String,java.lang.String> data, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException {
|
||||
checkReady();
|
||||
sendRichOutput_call method_call = new sendRichOutput_call(data, resultHandler, this, ___protocolFactory, ___transport);
|
||||
this.___currentMethod = method_call;
|
||||
___manager.call(method_call);
|
||||
}
|
||||
|
||||
public static class sendRichOutput_call extends org.apache.thrift.async.TAsyncMethodCall<Void> {
|
||||
private java.util.Map<java.lang.String,java.lang.String> data;
|
||||
public sendRichOutput_call(java.util.Map<java.lang.String,java.lang.String> data, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
|
||||
super(client, protocolFactory, transport, resultHandler, false);
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
|
||||
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("sendRichOutput", org.apache.thrift.protocol.TMessageType.CALL, 0));
|
||||
sendRichOutput_args args = new sendRichOutput_args();
|
||||
args.setData(data);
|
||||
args.write(prot);
|
||||
prot.writeMessageEnd();
|
||||
}
|
||||
|
||||
public Void getResult() throws org.apache.thrift.TException {
|
||||
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
|
||||
throw new java.lang.IllegalStateException("Method call not finished!");
|
||||
}
|
||||
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
|
||||
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
|
||||
@@ -434,6 +490,7 @@ public class PythonConsoleFrontendService {
|
||||
processMap.put("showConsole", new showConsole());
|
||||
processMap.put("returnFullValue", new returnFullValue());
|
||||
processMap.put("IPythonEditor", new IPythonEditor());
|
||||
processMap.put("sendRichOutput", new sendRichOutput());
|
||||
return processMap;
|
||||
}
|
||||
|
||||
@@ -592,6 +649,31 @@ public class PythonConsoleFrontendService {
|
||||
}
|
||||
}
|
||||
|
||||
public static class sendRichOutput<I extends Iface> extends org.apache.thrift.ProcessFunction<I, sendRichOutput_args> {
|
||||
public sendRichOutput() {
|
||||
super("sendRichOutput");
|
||||
}
|
||||
|
||||
public sendRichOutput_args getEmptyArgsInstance() {
|
||||
return new sendRichOutput_args();
|
||||
}
|
||||
|
||||
protected boolean isOneway() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean rethrowUnhandledExceptions() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public sendRichOutput_result getResult(I iface, sendRichOutput_args args) throws org.apache.thrift.TException {
|
||||
sendRichOutput_result result = new sendRichOutput_result();
|
||||
iface.sendRichOutput(args.data);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
|
||||
@@ -611,6 +693,7 @@ public class PythonConsoleFrontendService {
|
||||
processMap.put("showConsole", new showConsole());
|
||||
processMap.put("returnFullValue", new returnFullValue());
|
||||
processMap.put("IPythonEditor", new IPythonEditor());
|
||||
processMap.put("sendRichOutput", new sendRichOutput());
|
||||
return processMap;
|
||||
}
|
||||
|
||||
@@ -981,6 +1064,66 @@ public class PythonConsoleFrontendService {
|
||||
}
|
||||
}
|
||||
|
||||
public static class sendRichOutput<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, sendRichOutput_args, Void> {
|
||||
public sendRichOutput() {
|
||||
super("sendRichOutput");
|
||||
}
|
||||
|
||||
public sendRichOutput_args getEmptyArgsInstance() {
|
||||
return new sendRichOutput_args();
|
||||
}
|
||||
|
||||
public org.apache.thrift.async.AsyncMethodCallback<Void> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
|
||||
final org.apache.thrift.AsyncProcessFunction fcall = this;
|
||||
return new org.apache.thrift.async.AsyncMethodCallback<Void>() {
|
||||
public void onComplete(Void o) {
|
||||
sendRichOutput_result result = new sendRichOutput_result();
|
||||
try {
|
||||
fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
|
||||
} catch (org.apache.thrift.transport.TTransportException e) {
|
||||
_LOGGER.error("TTransportException writing to internal frame buffer", e);
|
||||
fb.close();
|
||||
} catch (java.lang.Exception e) {
|
||||
_LOGGER.error("Exception writing to internal frame buffer", e);
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
public void onError(java.lang.Exception e) {
|
||||
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
|
||||
org.apache.thrift.TSerializable msg;
|
||||
sendRichOutput_result result = new sendRichOutput_result();
|
||||
if (e instanceof org.apache.thrift.transport.TTransportException) {
|
||||
_LOGGER.error("TTransportException inside handler", e);
|
||||
fb.close();
|
||||
return;
|
||||
} else if (e instanceof org.apache.thrift.TApplicationException) {
|
||||
_LOGGER.error("TApplicationException inside handler", e);
|
||||
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
|
||||
msg = (org.apache.thrift.TApplicationException)e;
|
||||
} else {
|
||||
_LOGGER.error("Exception inside handler", e);
|
||||
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
|
||||
msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
try {
|
||||
fcall.sendResponse(fb,msg,msgType,seqid);
|
||||
} catch (java.lang.Exception ex) {
|
||||
_LOGGER.error("Exception writing to internal frame buffer", ex);
|
||||
fb.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected boolean isOneway() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void start(I iface, sendRichOutput_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException {
|
||||
iface.sendRichOutput(args.data,resultHandler);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class notifyFinished_args implements org.apache.thrift.TBase<notifyFinished_args, notifyFinished_args._Fields>, java.io.Serializable, Cloneable, Comparable<notifyFinished_args> {
|
||||
@@ -5331,4 +5474,677 @@ public class PythonConsoleFrontendService {
|
||||
}
|
||||
}
|
||||
|
||||
public static class sendRichOutput_args implements org.apache.thrift.TBase<sendRichOutput_args, sendRichOutput_args._Fields>, java.io.Serializable, Cloneable, Comparable<sendRichOutput_args> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendRichOutput_args");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.MAP, (short)1);
|
||||
|
||||
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new sendRichOutput_argsStandardSchemeFactory();
|
||||
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new sendRichOutput_argsTupleSchemeFactory();
|
||||
|
||||
public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> data; // 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 {
|
||||
DATA((short)1, "data");
|
||||
|
||||
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.
|
||||
*/
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
switch(fieldId) {
|
||||
case 1: // DATA
|
||||
return DATA;
|
||||
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.
|
||||
*/
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// isset id assignments
|
||||
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);
|
||||
tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
|
||||
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sendRichOutput_args.class, metaDataMap);
|
||||
}
|
||||
|
||||
public sendRichOutput_args() {
|
||||
}
|
||||
|
||||
public sendRichOutput_args(
|
||||
java.util.Map<java.lang.String,java.lang.String> data)
|
||||
{
|
||||
this();
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public sendRichOutput_args(sendRichOutput_args other) {
|
||||
if (other.isSetData()) {
|
||||
java.util.Map<java.lang.String,java.lang.String> __this__data = new java.util.HashMap<java.lang.String,java.lang.String>(other.data);
|
||||
this.data = __this__data;
|
||||
}
|
||||
}
|
||||
|
||||
public sendRichOutput_args deepCopy() {
|
||||
return new sendRichOutput_args(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.data = null;
|
||||
}
|
||||
|
||||
public int getDataSize() {
|
||||
return (this.data == null) ? 0 : this.data.size();
|
||||
}
|
||||
|
||||
public void putToData(java.lang.String key, java.lang.String val) {
|
||||
if (this.data == null) {
|
||||
this.data = new java.util.HashMap<java.lang.String,java.lang.String>();
|
||||
}
|
||||
this.data.put(key, val);
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.util.Map<java.lang.String,java.lang.String> getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public sendRichOutput_args setData(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetData() {
|
||||
this.data = null;
|
||||
}
|
||||
|
||||
/** Returns true if field data is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetData() {
|
||||
return this.data != null;
|
||||
}
|
||||
|
||||
public void setDataIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.data = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
|
||||
switch (field) {
|
||||
case DATA:
|
||||
if (value == null) {
|
||||
unsetData();
|
||||
} else {
|
||||
setData((java.util.Map<java.lang.String,java.lang.String>)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.lang.Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case DATA:
|
||||
return getData();
|
||||
|
||||
}
|
||||
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) {
|
||||
case DATA:
|
||||
return isSetData();
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof sendRichOutput_args)
|
||||
return this.equals((sendRichOutput_args)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(sendRichOutput_args that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
boolean this_present_data = true && this.isSetData();
|
||||
boolean that_present_data = true && that.isSetData();
|
||||
if (this_present_data || that_present_data) {
|
||||
if (!(this_present_data && that_present_data))
|
||||
return false;
|
||||
if (!this.data.equals(that.data))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = 1;
|
||||
|
||||
hashCode = hashCode * 8191 + ((isSetData()) ? 131071 : 524287);
|
||||
if (isSetData())
|
||||
hashCode = hashCode * 8191 + data.hashCode();
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(sendRichOutput_args other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetData()).compareTo(other.isSetData());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetData()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, other.data);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
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("sendRichOutput_args(");
|
||||
boolean first = true;
|
||||
|
||||
sb.append("data:");
|
||||
if (this.data == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.data);
|
||||
}
|
||||
first = false;
|
||||
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 sendRichOutput_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public sendRichOutput_argsStandardScheme getScheme() {
|
||||
return new sendRichOutput_argsStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class sendRichOutput_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<sendRichOutput_args> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, sendRichOutput_args 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) {
|
||||
case 1: // DATA
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map116 = iprot.readMapBegin();
|
||||
struct.data = new java.util.HashMap<java.lang.String,java.lang.String>(2*_map116.size);
|
||||
@org.apache.thrift.annotation.Nullable java.lang.String _key117;
|
||||
@org.apache.thrift.annotation.Nullable java.lang.String _val118;
|
||||
for (int _i119 = 0; _i119 < _map116.size; ++_i119)
|
||||
{
|
||||
_key117 = iprot.readString();
|
||||
_val118 = iprot.readString();
|
||||
struct.data.put(_key117, _val118);
|
||||
}
|
||||
iprot.readMapEnd();
|
||||
}
|
||||
struct.setDataIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
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, sendRichOutput_args struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
if (struct.data != null) {
|
||||
oprot.writeFieldBegin(DATA_FIELD_DESC);
|
||||
{
|
||||
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.data.size()));
|
||||
for (java.util.Map.Entry<java.lang.String, java.lang.String> _iter120 : struct.data.entrySet())
|
||||
{
|
||||
oprot.writeString(_iter120.getKey());
|
||||
oprot.writeString(_iter120.getValue());
|
||||
}
|
||||
oprot.writeMapEnd();
|
||||
}
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class sendRichOutput_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public sendRichOutput_argsTupleScheme getScheme() {
|
||||
return new sendRichOutput_argsTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class sendRichOutput_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<sendRichOutput_args> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, sendRichOutput_args struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
|
||||
java.util.BitSet optionals = new java.util.BitSet();
|
||||
if (struct.isSetData()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 1);
|
||||
if (struct.isSetData()) {
|
||||
{
|
||||
oprot.writeI32(struct.data.size());
|
||||
for (java.util.Map.Entry<java.lang.String, java.lang.String> _iter121 : struct.data.entrySet())
|
||||
{
|
||||
oprot.writeString(_iter121.getKey());
|
||||
oprot.writeString(_iter121.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, sendRichOutput_args struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
|
||||
java.util.BitSet incoming = iprot.readBitSet(1);
|
||||
if (incoming.get(0)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map122 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.data = new java.util.HashMap<java.lang.String,java.lang.String>(2*_map122.size);
|
||||
@org.apache.thrift.annotation.Nullable java.lang.String _key123;
|
||||
@org.apache.thrift.annotation.Nullable java.lang.String _val124;
|
||||
for (int _i125 = 0; _i125 < _map122.size; ++_i125)
|
||||
{
|
||||
_key123 = iprot.readString();
|
||||
_val124 = iprot.readString();
|
||||
struct.data.put(_key123, _val124);
|
||||
}
|
||||
}
|
||||
struct.setDataIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
public static class sendRichOutput_result implements org.apache.thrift.TBase<sendRichOutput_result, sendRichOutput_result._Fields>, java.io.Serializable, Cloneable, Comparable<sendRichOutput_result> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendRichOutput_result");
|
||||
|
||||
|
||||
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new sendRichOutput_resultStandardSchemeFactory();
|
||||
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new sendRichOutput_resultTupleSchemeFactory();
|
||||
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
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.
|
||||
*/
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
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(sendRichOutput_result.class, metaDataMap);
|
||||
}
|
||||
|
||||
public sendRichOutput_result() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public sendRichOutput_result(sendRichOutput_result other) {
|
||||
}
|
||||
|
||||
public sendRichOutput_result deepCopy() {
|
||||
return new sendRichOutput_result(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
|
||||
switch (field) {
|
||||
}
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
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 sendRichOutput_result)
|
||||
return this.equals((sendRichOutput_result)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(sendRichOutput_result 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(sendRichOutput_result other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
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("sendRichOutput_result(");
|
||||
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 sendRichOutput_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public sendRichOutput_resultStandardScheme getScheme() {
|
||||
return new sendRichOutput_resultStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class sendRichOutput_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<sendRichOutput_result> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, sendRichOutput_result 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, sendRichOutput_result struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class sendRichOutput_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public sendRichOutput_resultTupleScheme getScheme() {
|
||||
return new sendRichOutput_resultTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class sendRichOutput_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<sendRichOutput_result> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, sendRichOutput_result 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, sendRichOutput_result 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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class PythonTableException extends org.apache.thrift.TException implements org.apache.thrift.TBase<PythonTableException, PythonTableException._Fields>, java.io.Serializable, Cloneable, Comparable<PythonTableException> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PythonTableException");
|
||||
|
||||
|
||||
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class PythonUnhandledException extends org.apache.thrift.TException implements org.apache.thrift.TBase<PythonUnhandledException, PythonUnhandledException._Fields>, java.io.Serializable, Cloneable, Comparable<PythonUnhandledException> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PythonUnhandledException");
|
||||
|
||||
|
||||
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class RowHeader implements org.apache.thrift.TBase<RowHeader, RowHeader._Fields>, java.io.Serializable, Cloneable, Comparable<RowHeader> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RowHeader");
|
||||
|
||||
|
||||
@@ -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.13.0)", date = "2021-04-15")
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-07-27")
|
||||
public class UnsupportedArrayTypeException extends org.apache.thrift.TException implements org.apache.thrift.TBase<UnsupportedArrayTypeException, UnsupportedArrayTypeException._Fields>, java.io.Serializable, Cloneable, Comparable<UnsupportedArrayTypeException> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UnsupportedArrayTypeException");
|
||||
|
||||
|
||||
151
python/helpers/pydev/_pydev_bundle/pydev_ipython_completer.py
Normal file
151
python/helpers/pydev/_pydev_bundle/pydev_ipython_completer.py
Normal file
@@ -0,0 +1,151 @@
|
||||
# Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
import IPython.core.release as IPythonRelease
|
||||
from IPython.core.completer import IPCompleter
|
||||
from IPython.utils.strdispatch import StrDispatch
|
||||
|
||||
|
||||
class PyDevIPCompleter(IPCompleter):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
""" Create a Completer that reuses the advanced completion support of PyDev
|
||||
in addition to the completion support provided by IPython """
|
||||
IPCompleter.__init__(self, *args, **kwargs)
|
||||
# Use PyDev for python matches, see getCompletions below
|
||||
if self.python_matches in self.matchers:
|
||||
# `self.python_matches` matches attributes or global python names
|
||||
self.matchers.remove(self.python_matches)
|
||||
|
||||
|
||||
class PyDevIPCompleter6(IPCompleter):
|
||||
_pydev_matchers = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
""" Create a Completer that reuses the advanced completion support of PyDev
|
||||
in addition to the completion support provided by IPython """
|
||||
IPCompleter.__init__(self, *args, **kwargs)
|
||||
|
||||
@property
|
||||
def matchers(self):
|
||||
# To remove python_matches we now have to override it as it's now a property in the superclass.
|
||||
if self._pydev_matchers is None:
|
||||
self._pydev_matchers = self._remove_python_matches(
|
||||
IPCompleter.matchers.fget(self))
|
||||
return self._pydev_matchers
|
||||
|
||||
@matchers.setter
|
||||
def matchers(self, value):
|
||||
# Provide a setter for an overridden property
|
||||
self._pydev_matchers = self._remove_python_matches(value)
|
||||
|
||||
def _remove_python_matches(self, original_matchers):
|
||||
# `self.python_matches` matches attributes or global python names
|
||||
if self.python_matches in original_matchers:
|
||||
original_matchers.remove(self.python_matches)
|
||||
return original_matchers
|
||||
|
||||
|
||||
def init_shell_completer(shell):
|
||||
"""Initialize the completion machinery.
|
||||
|
||||
This creates a completer that provides the completions that are
|
||||
IPython specific. We use this to supplement PyDev's core code
|
||||
completions.
|
||||
"""
|
||||
# PyDev uses its own completer and custom hooks so that it uses
|
||||
# most completions from PyDev's core completer which provides
|
||||
# extra information.
|
||||
# See getCompletions for where the two sets of results are merged
|
||||
|
||||
if IPythonRelease._version_major >= 6:
|
||||
shell.Completer = _new_completer_600(shell)
|
||||
elif IPythonRelease._version_major >= 5:
|
||||
shell.Completer = _new_completer_500(shell)
|
||||
elif IPythonRelease._version_major >= 2:
|
||||
shell.Completer = _new_completer_234(shell)
|
||||
elif IPythonRelease._version_major >= 1:
|
||||
shell.Completer = _new_completer_100(shell)
|
||||
|
||||
if hasattr(shell.Completer, 'use_jedi'):
|
||||
shell.Completer.use_jedi = False
|
||||
|
||||
add_completer_hooks(shell)
|
||||
|
||||
if IPythonRelease._version_major <= 3:
|
||||
# Only configure readline if we truly are using readline. IPython can
|
||||
# do tab-completion over the network, in GUIs, etc, where readline
|
||||
# itshell may be absent
|
||||
if shell.has_readline:
|
||||
shell.set_readline_completer()
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Things related to text completion
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# The way to construct an IPCompleter changed in most versions,
|
||||
# so we have a custom, per version implementation of the construction
|
||||
|
||||
def _new_completer_100(shell):
|
||||
completer = PyDevIPCompleter(shell=shell,
|
||||
namespace=shell.user_ns,
|
||||
global_namespace=shell.user_global_ns,
|
||||
alias_table=shell.alias_manager.alias_table,
|
||||
use_readline=shell.has_readline,
|
||||
parent=shell,
|
||||
)
|
||||
return completer
|
||||
|
||||
|
||||
def _new_completer_234(shell):
|
||||
# correct for IPython versions 2.x, 3.x, 4.x
|
||||
completer = PyDevIPCompleter(shell=shell,
|
||||
namespace=shell.user_ns,
|
||||
global_namespace=shell.user_global_ns,
|
||||
use_readline=shell.has_readline,
|
||||
parent=shell,
|
||||
)
|
||||
return completer
|
||||
|
||||
|
||||
def _new_completer_500(shell):
|
||||
completer = PyDevIPCompleter(shell=shell,
|
||||
namespace=shell.user_ns,
|
||||
global_namespace=shell.user_global_ns,
|
||||
use_readline=False,
|
||||
parent=shell
|
||||
)
|
||||
return completer
|
||||
|
||||
|
||||
def _new_completer_600(shell):
|
||||
completer = PyDevIPCompleter6(shell=shell,
|
||||
namespace=shell.user_ns,
|
||||
global_namespace=shell.user_global_ns,
|
||||
use_readline=False,
|
||||
parent=shell
|
||||
)
|
||||
return completer
|
||||
|
||||
|
||||
def add_completer_hooks(shell):
|
||||
from IPython.core.completerlib import module_completer, magic_run_completer, \
|
||||
cd_completer
|
||||
try:
|
||||
from IPython.core.completerlib import reset_completer
|
||||
except ImportError:
|
||||
# reset_completer was added for rel-0.13
|
||||
reset_completer = None
|
||||
shell.configurables.append(shell.Completer)
|
||||
|
||||
# Add custom completers to the basic ones built into IPCompleter
|
||||
sdisp = shell.strdispatchers.get('complete_command', StrDispatch())
|
||||
shell.strdispatchers['complete_command'] = sdisp
|
||||
shell.Completer.custom_completers = sdisp
|
||||
|
||||
shell.set_hook('complete_command', module_completer, str_key='import')
|
||||
shell.set_hook('complete_command', module_completer, str_key='from')
|
||||
shell.set_hook('complete_command', magic_run_completer, str_key='%run')
|
||||
shell.set_hook('complete_command', cd_completer, str_key='%cd')
|
||||
if reset_completer:
|
||||
shell.set_hook('complete_command', reset_completer, str_key='%reset')
|
||||
@@ -21,26 +21,30 @@ import codeop
|
||||
import traceback
|
||||
|
||||
from IPython.core.error import UsageError
|
||||
from IPython.core.completer import IPCompleter
|
||||
from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
|
||||
from IPython.core.usage import default_banner_parts
|
||||
from IPython.utils.strdispatch import StrDispatch
|
||||
import IPython.core.release as IPythonRelease
|
||||
from IPython.terminal.interactiveshell import TerminalInteractiveShell
|
||||
from IPython.terminal.ipapp import load_default_config
|
||||
try:
|
||||
from traitlets import CBool, Unicode
|
||||
except ImportError:
|
||||
from IPython.utils.traitlets import CBool, Unicode
|
||||
from IPython.core.formatters import DisplayFormatter
|
||||
from IPython.core import release
|
||||
|
||||
from _pydev_bundle.pydev_imports import xmlrpclib
|
||||
from IPython.terminal.interactiveshell import TerminalInteractiveShell
|
||||
from IPython.terminal.ipapp import load_default_config
|
||||
from IPython import InteractiveShell
|
||||
|
||||
from traitlets import Type
|
||||
from traitlets import CBool, Unicode
|
||||
|
||||
|
||||
from _pydevd_bundle.pydevd_constants import dict_keys, dict_iter_items
|
||||
from _pydev_bundle.pydev_ipython_rich_output import PyDevDisplayHook, PyDevDisplayPub, \
|
||||
patch_stdout
|
||||
from _pydev_bundle.pydev_ipython_completer import init_shell_completer
|
||||
|
||||
default_pydev_banner_parts = default_banner_parts
|
||||
|
||||
default_pydev_banner = ''.join(default_pydev_banner_parts)
|
||||
|
||||
INLINE_OUTPUT_SUPPORTED = os.getenv('INLINE_OUTPUT_SUPPORTED', False)
|
||||
|
||||
|
||||
def show_in_pager(self, strng, *args, **kwargs):
|
||||
""" Run a string through pager """
|
||||
# On PyDev we just output the string, there are scroll bars in the console
|
||||
@@ -51,8 +55,8 @@ def show_in_pager(self, strng, *args, **kwargs):
|
||||
strng = strng['text/plain']
|
||||
print(strng)
|
||||
|
||||
def create_editor_hook(rpc_client):
|
||||
|
||||
def create_editor_hook(rpc_client):
|
||||
def call_editor(filename, line=0, wait=True):
|
||||
""" Open an editor in PyDev """
|
||||
if line is None:
|
||||
@@ -76,44 +80,6 @@ def create_editor_hook(rpc_client):
|
||||
return call_editor
|
||||
|
||||
|
||||
class PyDevIPCompleter(IPCompleter):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
""" Create a Completer that reuses the advanced completion support of PyDev
|
||||
in addition to the completion support provided by IPython """
|
||||
IPCompleter.__init__(self, *args, **kwargs)
|
||||
# Use PyDev for python matches, see getCompletions below
|
||||
if self.python_matches in self.matchers:
|
||||
# `self.python_matches` matches attributes or global python names
|
||||
self.matchers.remove(self.python_matches)
|
||||
|
||||
class PyDevIPCompleter6(IPCompleter):
|
||||
_pydev_matchers = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
""" Create a Completer that reuses the advanced completion support of PyDev
|
||||
in addition to the completion support provided by IPython """
|
||||
IPCompleter.__init__(self, *args, **kwargs)
|
||||
|
||||
@property
|
||||
def matchers(self):
|
||||
# To remove python_matches we now have to override it as it's now a property in the superclass.
|
||||
if self._pydev_matchers is None:
|
||||
self._pydev_matchers = self._remove_python_matches(IPCompleter.matchers.fget(self))
|
||||
return self._pydev_matchers
|
||||
|
||||
@matchers.setter
|
||||
def matchers(self, value):
|
||||
# Provide a setter for an overridden property
|
||||
self._pydev_matchers = self._remove_python_matches(value)
|
||||
|
||||
def _remove_python_matches(self, original_matchers):
|
||||
# `self.python_matches` matches attributes or global python names
|
||||
if self.python_matches in original_matchers:
|
||||
original_matchers.remove(self.python_matches)
|
||||
return original_matchers
|
||||
|
||||
|
||||
class PyDevTerminalInteractiveShell(TerminalInteractiveShell):
|
||||
banner1 = Unicode(default_pydev_banner, config=True,
|
||||
help="""The part of the banner to be printed before the profile"""
|
||||
@@ -144,6 +110,20 @@ class PyDevTerminalInteractiveShell(TerminalInteractiveShell):
|
||||
# Since IPython 5 the terminal interface is not compatible with Emacs `inferior-shell` and
|
||||
# the `simple_prompt` flag is needed
|
||||
simple_prompt = CBool(True)
|
||||
|
||||
if INLINE_OUTPUT_SUPPORTED:
|
||||
displayhook_class = Type(PyDevDisplayHook)
|
||||
display_pub_class = Type(PyDevDisplayPub)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(PyDevTerminalInteractiveShell, self).__init__(*args, **kwargs)
|
||||
if INLINE_OUTPUT_SUPPORTED:
|
||||
try:
|
||||
self.enable_matplotlib('inline')
|
||||
except:
|
||||
sys.stderr.write("Failed to enable inline matplotlib plots\n")
|
||||
sys.stderr.flush()
|
||||
patch_stdout()
|
||||
|
||||
# In the PyDev Console, GUI control is done via hookable XML-RPC server
|
||||
@staticmethod
|
||||
@@ -151,11 +131,20 @@ class PyDevTerminalInteractiveShell(TerminalInteractiveShell):
|
||||
"""Switch amongst GUI input hooks by name.
|
||||
"""
|
||||
# Deferred import
|
||||
from pydev_ipython.inputhook import enable_gui as real_enable_gui
|
||||
try:
|
||||
return real_enable_gui(gui, app)
|
||||
except ValueError as e:
|
||||
raise UsageError("%s" % e)
|
||||
if not INLINE_OUTPUT_SUPPORTED:
|
||||
from pydev_ipython.inputhook import enable_gui as real_enable_gui
|
||||
try:
|
||||
return real_enable_gui(gui, app)
|
||||
except ValueError as e:
|
||||
raise UsageError("%s" % e)
|
||||
|
||||
def init_display_formatter(self):
|
||||
if INLINE_OUTPUT_SUPPORTED:
|
||||
self.display_formatter = DisplayFormatter(parent=self)
|
||||
self.configurables.append(self.display_formatter)
|
||||
self.display_formatter.ipython_display_formatter.enabled = True
|
||||
else:
|
||||
super(PyDevTerminalInteractiveShell, self).init_display_formatter()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Things related to hooks
|
||||
@@ -188,104 +177,8 @@ class PyDevTerminalInteractiveShell(TerminalInteractiveShell):
|
||||
traceback.print_exception(etype, value, tb)
|
||||
sys.last_type, sys.last_value, sys.last_traceback = etype, value, tb
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Things related to text completion
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# The way to construct an IPCompleter changed in most versions,
|
||||
# so we have a custom, per version implementation of the construction
|
||||
|
||||
def _new_completer_100(self):
|
||||
completer = PyDevIPCompleter(shell=self,
|
||||
namespace=self.user_ns,
|
||||
global_namespace=self.user_global_ns,
|
||||
alias_table=self.alias_manager.alias_table,
|
||||
use_readline=self.has_readline,
|
||||
parent=self,
|
||||
)
|
||||
return completer
|
||||
|
||||
def _new_completer_234(self):
|
||||
# correct for IPython versions 2.x, 3.x, 4.x
|
||||
completer = PyDevIPCompleter(shell=self,
|
||||
namespace=self.user_ns,
|
||||
global_namespace=self.user_global_ns,
|
||||
use_readline=self.has_readline,
|
||||
parent=self,
|
||||
)
|
||||
return completer
|
||||
|
||||
def _new_completer_500(self):
|
||||
completer = PyDevIPCompleter(shell=self,
|
||||
namespace=self.user_ns,
|
||||
global_namespace=self.user_global_ns,
|
||||
use_readline=False,
|
||||
parent=self
|
||||
)
|
||||
return completer
|
||||
|
||||
def _new_completer_600(self):
|
||||
completer = PyDevIPCompleter6(shell=self,
|
||||
namespace=self.user_ns,
|
||||
global_namespace=self.user_global_ns,
|
||||
use_readline=False,
|
||||
parent=self
|
||||
)
|
||||
return completer
|
||||
|
||||
def add_completer_hooks(self):
|
||||
from IPython.core.completerlib import module_completer, magic_run_completer, cd_completer
|
||||
try:
|
||||
from IPython.core.completerlib import reset_completer
|
||||
except ImportError:
|
||||
# reset_completer was added for rel-0.13
|
||||
reset_completer = None
|
||||
self.configurables.append(self.Completer)
|
||||
|
||||
# Add custom completers to the basic ones built into IPCompleter
|
||||
sdisp = self.strdispatchers.get('complete_command', StrDispatch())
|
||||
self.strdispatchers['complete_command'] = sdisp
|
||||
self.Completer.custom_completers = sdisp
|
||||
|
||||
self.set_hook('complete_command', module_completer, str_key = 'import')
|
||||
self.set_hook('complete_command', module_completer, str_key = 'from')
|
||||
self.set_hook('complete_command', magic_run_completer, str_key = '%run')
|
||||
self.set_hook('complete_command', cd_completer, str_key = '%cd')
|
||||
if reset_completer:
|
||||
self.set_hook('complete_command', reset_completer, str_key = '%reset')
|
||||
|
||||
def init_completer(self):
|
||||
"""Initialize the completion machinery.
|
||||
|
||||
This creates a completer that provides the completions that are
|
||||
IPython specific. We use this to supplement PyDev's core code
|
||||
completions.
|
||||
"""
|
||||
# PyDev uses its own completer and custom hooks so that it uses
|
||||
# most completions from PyDev's core completer which provides
|
||||
# extra information.
|
||||
# See getCompletions for where the two sets of results are merged
|
||||
|
||||
if IPythonRelease._version_major >= 6:
|
||||
self.Completer = self._new_completer_600()
|
||||
elif IPythonRelease._version_major >= 5:
|
||||
self.Completer = self._new_completer_500()
|
||||
elif IPythonRelease._version_major >= 2:
|
||||
self.Completer = self._new_completer_234()
|
||||
elif IPythonRelease._version_major >= 1:
|
||||
self.Completer = self._new_completer_100()
|
||||
|
||||
if hasattr(self.Completer, 'use_jedi'):
|
||||
self.Completer.use_jedi = False
|
||||
|
||||
self.add_completer_hooks()
|
||||
|
||||
if IPythonRelease._version_major <= 3:
|
||||
# Only configure readline if we truly are using readline. IPython can
|
||||
# do tab-completion over the network, in GUIs, etc, where readline
|
||||
# itself may be absent
|
||||
if self.has_readline:
|
||||
self.set_readline_completer()
|
||||
init_shell_completer(self)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Things related to aliases
|
||||
@@ -411,7 +304,6 @@ class _PyDevIPythonFrontEnd:
|
||||
is_complete = True
|
||||
return is_complete
|
||||
|
||||
|
||||
def getCompletions(self, text, act_tok):
|
||||
# Get completions from IPython and from PyDev and merge the results
|
||||
# IPython only gives context free list of completions, while PyDev
|
||||
@@ -451,7 +343,6 @@ class _PyDevIPythonFrontEnd:
|
||||
import traceback;traceback.print_exc()
|
||||
return []
|
||||
|
||||
|
||||
def get_namespace(self):
|
||||
return self.ipython.user_ns
|
||||
|
||||
@@ -498,6 +389,10 @@ class _PyDevFrontEndContainer:
|
||||
_last_rpc_client = None
|
||||
|
||||
|
||||
def get_client():
|
||||
return _PyDevFrontEndContainer._last_rpc_client
|
||||
|
||||
|
||||
def get_pydev_ipython_frontend(rpc_client):
|
||||
if _PyDevFrontEndContainer._instance is None:
|
||||
_PyDevFrontEndContainer._instance = _PyDevIPythonFrontEnd()
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
# Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
from IPython.core.displayhook import DisplayHook
|
||||
from IPython.core.displaypub import DisplayPublisher
|
||||
|
||||
|
||||
class PyDevDisplayHook(DisplayHook):
|
||||
def write_format_data(self, format_dict, *args, **kwargs):
|
||||
if not is_supported(format_dict):
|
||||
super(PyDevDisplayHook, self).write_format_data(format_dict, *args,
|
||||
**kwargs)
|
||||
return
|
||||
if "text/plain" in format_dict:
|
||||
text = format_dict["text/plain"]
|
||||
if len(text) > 0 and not text.endswith("\n"):
|
||||
format_dict["text/plain"] = text + "\n"
|
||||
send_rich_output(format_dict)
|
||||
|
||||
|
||||
class PyDevDisplayPub(DisplayPublisher):
|
||||
def publish(self, data, *args, **kwargs):
|
||||
if not is_supported(data):
|
||||
super(PyDevDisplayPub, self).publish(data, *args, **kwargs)
|
||||
return
|
||||
send_rich_output(data)
|
||||
|
||||
|
||||
def is_supported(data):
|
||||
for type in data.keys():
|
||||
if type not in ("text/plain", "image/png", "text/html"):
|
||||
return False
|
||||
if type == "text/html":
|
||||
html = data["text/html"]
|
||||
if not is_data_frame(html):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def is_data_frame(html):
|
||||
return ("javascript" not in html) and ("dataframe" in html) and ("<table" in html)
|
||||
|
||||
|
||||
def send_rich_output(data):
|
||||
if 'image/png' in data:
|
||||
import base64
|
||||
png = data['image/png']
|
||||
res = base64.b64encode(png)
|
||||
data['image/png'] = res
|
||||
from _pydev_bundle.pydev_ipython_console_011 import get_client
|
||||
client = get_client()
|
||||
if client:
|
||||
client.sendRichOutput(data)
|
||||
else:
|
||||
print("Client is None!")
|
||||
|
||||
|
||||
def patch_stdout():
|
||||
sys.stdout = PydevStdOut(sys.stdout)
|
||||
|
||||
|
||||
class PydevStdOut:
|
||||
def __init__(self, original_stdout=sys.stdout, *args, **kwargs):
|
||||
self.encoding = sys.stdout.encoding
|
||||
self.original_stdout = original_stdout
|
||||
|
||||
def write(self, s):
|
||||
data = {'text/plain': s}
|
||||
send_rich_output(data)
|
||||
|
||||
def __getattr__(self, item):
|
||||
# it's called if the attribute wasn't found
|
||||
if hasattr(self.original_stdout, item):
|
||||
return getattr(self.original_stdout, item)
|
||||
raise AttributeError("%s has no attribute %s" % (self.original_stdout, item))
|
||||
|
||||
@@ -216,4 +216,6 @@ service PythonConsoleFrontendService {
|
||||
void returnFullValue(1: LoadFullValueRequestSeq requestSeq, 2: list<DebugValue> response),
|
||||
|
||||
bool IPythonEditor(1: string path, 2: string line),
|
||||
|
||||
void sendRichOutput(1: map<string, string> data),
|
||||
}
|
||||
@@ -475,6 +475,9 @@
|
||||
<extensionPoint qualifiedName="com.jetbrains.python.debugger.numericContainerPopupCustomizer"
|
||||
interface="com.jetbrains.python.debugger.pydev.tables.PyNumericContainerPopupCustomizer"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="com.jetbrains.python.console.pyConsoleOutputCustomizer"
|
||||
interface="com.jetbrains.python.console.PyConsoleOutputCustomizer"
|
||||
dynamic="true"/>
|
||||
|
||||
<!-- Experimental sdk EP, avoid using it -->
|
||||
<extensionPoint qualifiedName="Pythonid.pySdkProvider"
|
||||
@@ -677,6 +680,7 @@
|
||||
|
||||
<extensions defaultExtensionNs="com.jetbrains.python.console">
|
||||
<executeCustomizer implementation="com.jetbrains.python.console.PyExecuteConsoleCustomizerDefault"/>
|
||||
<pyConsoleOutputCustomizer implementation="com.jetbrains.python.console.PyConsoleOutputCustomizerDefault"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.jetbrains.python.debugger">
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.console
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Experimental
|
||||
interface PyConsoleOutputCustomizer {
|
||||
companion object {
|
||||
private val EP_NAME: ExtensionPointName<PyConsoleOutputCustomizer> =
|
||||
ExtensionPointName.create("com.jetbrains.python.console.pyConsoleOutputCustomizer")
|
||||
|
||||
val instance: PyConsoleOutputCustomizer
|
||||
get() = EP_NAME.extensionList.first()
|
||||
}
|
||||
|
||||
fun showRichOutput(consoleView: PythonConsoleView, data: Map<String, String>) {}
|
||||
|
||||
fun isInlineOutputSupported(): Boolean = false
|
||||
}
|
||||
|
||||
class PyConsoleOutputCustomizerDefault : PyConsoleOutputCustomizer
|
||||
@@ -835,6 +835,13 @@ public abstract class PydevConsoleCommunication extends AbstractConsoleCommunica
|
||||
public boolean IPythonEditor(String path, String line) {
|
||||
return execIPythonEditor(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRichOutput(Map<String, String> data) throws TException {
|
||||
if (myConsoleView == null) return;
|
||||
if (data.isEmpty()) return;
|
||||
PyConsoleOutputCustomizer.Companion.getInstance().showRichOutput(myConsoleView, data);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class CommunicationClosedException extends RuntimeException {
|
||||
|
||||
@@ -116,6 +116,7 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner {
|
||||
public static final @NonNls String CONSOLE_START_COMMAND = "import sys; print('Python %s on %s' % (sys.version, sys.platform))\n" +
|
||||
"sys.path.extend([" + WORKING_DIR_AND_PYTHON_PATHS + "])\n";
|
||||
public static final @NonNls String STARTED_BY_RUNNER = "startedByRunner";
|
||||
public static final @NonNls String INLINE_OUTPUT_SUPPORTED = "INLINE_OUTPUT_SUPPORTED";
|
||||
private static final Long WAIT_BEFORE_FORCED_CLOSE_MILLIS = 2000L;
|
||||
private static final Logger LOG = Logger.getInstance(PydevConsoleRunnerImpl.class);
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
@@ -1220,6 +1221,9 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner {
|
||||
if (debuggerSettings.getValuesPolicy() != PyDebugValue.ValuesPolicy.SYNC) {
|
||||
myEnvironmentVariables.put(PyDebugValue.POLICY_ENV_VARS.get(debuggerSettings.getValuesPolicy()), "True");
|
||||
}
|
||||
if (PyConsoleOutputCustomizer.Companion.getInstance().isInlineOutputSupported()) {
|
||||
myEnvironmentVariables.put(INLINE_OUTPUT_SUPPORTED, "True");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user