Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of Columns<> events #206

Merged
merged 1 commit into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions jupyter_bokeh/widgets.py
Original file line number Diff line number Diff line change
@@ -151,15 +151,15 @@ def _sync_model(self, _model: BokehModel, content: dict[str, Any], _buffers: lis
for cb in model._callbacks.get(attr, []):
cb(attr, old, new)
elif kind == "ColumnsStreamed":
model = content["model"]
data = content["data"]
rollover = content["rollover"]
model = event["model"]
data = event["data"]
rollover = event["rollover"]

assert isinstance(model, ColumnDataSource)
model._stream(data, rollover, setter=setter)
elif kind == "ColumnsPatched":
model = content["model"]
patches = content["data"]
model = event["model"]
patches = event["patches"]

assert isinstance(model, ColumnDataSource)
model.patch(patches, setter=setter)

Unchanged files with check annotations Beta

}
get context(): Context {
if (this._context != null) {

Check warning on line 19 in src/manager.ts

GitHub Actions / build

Expected '!==' and instead saw '!='
return this._context
} else {
throw new Error('context was already disposed')
}
get isDisposed(): boolean {
return this._context == null

Check warning on line 27 in src/manager.ts

GitHub Actions / build

Expected '===' and instead saw '=='
}
dispose(): void {
import { Widget } from '@lumino/widgets'
import { ContextManager } from './manager'
export declare interface KernelProxy {

Check warning on line 7 in src/renderer.ts

GitHub Actions / build

Interface name `KernelProxy` must match the RegExp: /^I[A-Z]/u
// copied from https://github.com/jupyterlab/jupyterlab/blob/master/packages/services/src/kernel/default.ts#L605
registerCommTarget(
targetName: string,
callback: (comm: Kernel.IComm, msg: KernelMessage.ICommOpenMsg) => void
) {
const kernel = _manager!.context.sessionContext.session?.kernel
if (kernel != null) {

Check warning on line 102 in src/renderer.ts

GitHub Actions / build

Expected '!==' and instead saw '!='
kernel.registerCommTarget(targetName, callback)
}
}
Bokeh.embed.kernels[this._document_id] = kernel_proxy
_manager!.context.sessionContext.statusChanged.connect(
(_session, status) => {
if (status == 'restarting' || status === 'dead') {

Check warning on line 110 in src/renderer.ts

GitHub Actions / build

Expected '===' and instead saw '=='
delete Bokeh.embed.kernels[this._document_id!]
}
},
code: `import bokeh.io.notebook as ion; ion.destroy_server("${this._server_id}")`
}
const kernel = this._manager!.context.sessionContext.session?.kernel
if (kernel != null) {

Check warning on line 147 in src/renderer.ts

GitHub Actions / build

Expected '!==' and instead saw '!='
kernel.requestExecute(content, true)
}
this._server_id = null
div: string
}
export interface Ref {

Check warning on line 31 in src/widgets.ts

GitHub Actions / build

Interface name `Ref` must match the RegExp: /^I[A-Z]/u
id: string
}
export interface DocumentChanged {

Check warning on line 35 in src/widgets.ts

GitHub Actions / build

Interface name `DocumentChanged` must match the RegExp: /^I[A-Z]/u
event: 'jsevent'
kind: string
}
export interface ModelChanged extends DocumentChanged {

Check warning on line 40 in src/widgets.ts

GitHub Actions / build

Interface name `ModelChanged` must match the RegExp: /^I[A-Z]/u
event: 'jsevent'
kind: 'ModelChanged'
model: Ref
attr: string
}
export interface MessageSent extends DocumentChanged {

Check warning on line 48 in src/widgets.ts

GitHub Actions / build

Interface name `MessageSent` must match the RegExp: /^I[A-Z]/u
event: 'jsevent'
kind: 'MessageSent'
msg_data: {