Class: BaseKernel#
@jupyterlite/kernel.BaseKernel
A base kernel class handling basic kernel messaging.
Implements#
Constructors#
constructor#
new BaseKernel(options)
Construct a new BaseKernel.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
The instantiation options for a BaseKernel. |
Defined in#
Properties#
_disposed#
Private_disposed:Signal<BaseKernel,void>
Defined in#
_executionCount#
Private_executionCount:number=0
Defined in#
_history#
Private_history: [number,number,string][] =[]
Defined in#
_id#
Private_id:string
Defined in#
_isDisposed#
Private_isDisposed:boolean=false
Defined in#
_location#
Private_location:string
Defined in#
_name#
Private_name:string
Defined in#
_parent#
Private_parent:undefined|IMessage<MessageType> =undefined
Defined in#
_parentHeader#
Private_parentHeader:undefined|IHeader<MessageType> =undefined
Defined in#
_sendMessage#
Private_sendMessage:SendMessage
Defined in#
Accessors#
disposed#
getdisposed():ISignal<this,void>
A signal emitted when the kernel is disposed.
Returns#
ISignal<this, void>
Implementation of#
Defined in#
executionCount#
getexecutionCount():number
The current execution count
Returns#
number
Defined in#
id#
getid():string
Get the kernel id
Returns#
string
Implementation of#
Defined in#
isDisposed#
getisDisposed():boolean
Return whether the kernel is disposed.
Returns#
boolean
Implementation of#
Defined in#
location#
getlocation():string
The location in the virtual filesystem from which the kernel was started.
Returns#
string
Implementation of#
Defined in#
name#
getname():string
Get the name of the kernel
Returns#
string
Implementation of#
Defined in#
parent#
getparent():undefined|IMessage<MessageType>
Get the last parent message (mimic ipykernel’s get_parent)
Returns#
undefined | IMessage<MessageType>
Defined in#
parentHeader#
getparentHeader():undefined|IHeader<MessageType>
Get the last parent header
Returns#
undefined | IHeader<MessageType>
Defined in#
ready#
getready():Promise<void>
A promise that is fulfilled when the kernel is ready.
Returns#
Promise<void>
Implementation of#
Defined in#
Methods#
_busy#
Private_busy(parent):void
Send a ‘busy’ status message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The parent message. |
Returns#
void
Defined in#
_complete#
Private_complete(msg):Promise<void>
Handle an complete_request message
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The parent message. |
Returns#
Promise<void>
Defined in#
_execute#
Private_execute(msg):Promise<void>
Handle an execute_request message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The parent message. |
Returns#
Promise<void>
Defined in#
_executeInput#
Private_executeInput(msg):void
Send an execute_input message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The parent message. |
Returns#
void
Defined in#
_historyRequest#
Private_historyRequest(msg):Promise<void>
Handle a history_request message
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The parent message. |
Returns#
Promise<void>
Defined in#
_idle#
Private_idle(parent):void
Send an ‘idle’ status message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The parent message |
Returns#
void
Defined in#
_inspect#
Private_inspect(msg):Promise<void>
Handle an inspect_request message
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The parent message. |
Returns#
Promise<void>
Defined in#
_isCompleteRequest#
Private_isCompleteRequest(msg):Promise<void>
Handle an is_complete_request message
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The parent message. |
Returns#
Promise<void>
Defined in#
_kernelInfo#
Private_kernelInfo(parent):Promise<void>
Handle a kernel_info_request message
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The parent message. |
Returns#
Promise<void>
Defined in#
clearOutput#
ProtectedclearOutput(content,parentHeader?):void
Send a clear_output message to the client.
Parameters#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
|
|
The clear_output content. |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
commClose#
AbstractcommClose(msg):Promise<void>
Send an comm_close message.
Parameters#
Name |
Type |
|---|---|
|
|
Returns#
Promise<void>
Defined in#
commInfoRequest#
AbstractcommInfoRequest(content):Promise<ReplyContent<ICommInfoReply>>
Handle a comm_info_request message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The content of the request. |
|
|
The comm target name to filter returned comms |
Returns#
Promise<ReplyContent<ICommInfoReply>>
A promise that resolves with the response message.
Defined in#
commMsg#
AbstractcommMsg(msg):Promise<void>
Send an comm_msg message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The comm_msg message. |
Returns#
Promise<void>
Defined in#
commOpen#
AbstractcommOpen(msg):Promise<void>
Send an comm_open message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The comm_open message. |
Returns#
Promise<void>
Defined in#
completeRequest#
AbstractcompleteRequest(content):Promise<ReplyContent<ICompleteReply>>
Handle a complete_request message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The content of the request. |
|
|
- |
|
|
- |
Returns#
Promise<ReplyContent<ICompleteReply>>
Defined in#
displayData#
ProtecteddisplayData(content,parentHeader?):void
Send a display_data message to the client.
Parameters#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
|
|
The display_data content. |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
dispose#
dispose():void
Dispose the kernel.
Returns#
void
Implementation of#
Defined in#
executeRequest#
AbstractexecuteRequest(content):Promise<Object>
Handle an execute_request message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The content of the execute_request kernel message |
|
|
Whether to allow stdin requests. The default is |
|
|
The code to execute. |
|
|
Whether to execute the code as quietly as possible. The default is |
|
|
Whether to the abort execution queue on an error. The default is |
|
|
Whether to store history of the execution. The default |
|
|
A mapping of names to expressions to be evaluated in the kernel’s interactive namespace. |
Returns#
Promise<Object>
Defined in#
handleComm#
ProtectedhandleComm(type,content,metadata,buffers,parentHeader?):void
Send a comm message to the client.
Parameters#
Name |
Type |
Default value |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns#
void
Defined in#
handleMessage#
handleMessage(msg):Promise<void>
Handle an incoming message from the client.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The message to handle |
Returns#
Promise<void>
Implementation of#
Defined in#
inputReply#
AbstractinputReply(content):void
Send an input_reply message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The content of the reply. |
Returns#
void
Defined in#
inputRequest#
ProtectedinputRequest(content,parentHeader?):void
Send a input_request message to the client.
Parameters#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
|
|
The input_request content. |
|
|
|
Whether the request is for a password. If so, the frontend shouldn’t echo input. |
|
|
|
The text to show at the prompt. |
|
|
|
The parent header. |
Returns#
void
Defined in#
inspectRequest#
AbstractinspectRequest(content):Promise<ReplyContent<IInspectReply>>
Handle an inspect_request message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The content of the request. |
|
|
- |
|
|
- |
|
|
- |
Returns#
Promise<ReplyContent<IInspectReply>>
A promise that resolves with the response message.
Defined in#
isCompleteRequest#
AbstractisCompleteRequest(content):Promise<ReplyContent<IIsCompleteReplyIncomplete|IIsCompleteReplyOther>>
Handle an is_complete_request message.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The content of the request. |
|
|
- |
Returns#
Promise<ReplyContent<IIsCompleteReplyIncomplete | IIsCompleteReplyOther>>
A promise that resolves with the response message.
Defined in#
kernelInfoRequest#
AbstractkernelInfoRequest():Promise<ReplyContent<IInfoReply>>
Handle a kernel_info_request message.
Returns#
Promise<ReplyContent<IInfoReply>>
A promise that resolves with the kernel info.
Defined in#
publishExecuteError#
ProtectedpublishExecuteError(content,parentHeader?):void
Send an error message to the client.
Parameters#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
|
|
The error content. |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
publishExecuteResult#
ProtectedpublishExecuteResult(content,parentHeader?):void
Send an execute_result message.
Parameters#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
|
|
The execute result content. |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
stream#
Protectedstream(content,parentHeader?):void
Stream an event from the kernel
Parameters#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
|
|
The stream content. |
|
|
|
- |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
updateDisplayData#
ProtectedupdateDisplayData(content,parentHeader?):void
Send a update_display_data message to the client.
Parameters#
Name |
Type |
Default value |
Description |
|---|---|---|---|
|
{ |
|
The update_display_data content. |
|
|
|
The parent header. |
Returns#
void