mirror of
https://github.com/pyscript/pyscript.git
synced 2022-05-01 19:47:48 +03:00
Suppress output warnings in bokeh example
This commit is contained in:
@@ -32,7 +32,7 @@ from js import Bokeh, console, JSON
|
|||||||
|
|
||||||
from bokeh import __version__
|
from bokeh import __version__
|
||||||
from bokeh.document import Document
|
from bokeh.document import Document
|
||||||
from bokeh.embed.util import OutputDocumentFor, standalone_docs_json
|
from bokeh.embed.util import OutputDocumentFor, standalone_docs_json_and_render_items
|
||||||
from bokeh.models import Slider, Div
|
from bokeh.models import Slider, Div
|
||||||
from bokeh.layouts import Row
|
from bokeh.layouts import Row
|
||||||
from bokeh.protocol.messages.patch_doc import process_document_events
|
from bokeh.protocol.messages.patch_doc import process_document_events
|
||||||
@@ -48,12 +48,12 @@ p.on_change('value', callback)
|
|||||||
|
|
||||||
row = Row(children=[p, div])
|
row = Row(children=[p, div])
|
||||||
|
|
||||||
print("about to embed")
|
|
||||||
|
|
||||||
def doc_json(model, target):
|
def doc_json(model, target):
|
||||||
with OutputDocumentFor([model]) as doc:
|
with OutputDocumentFor([model]) as doc:
|
||||||
doc.title = ""
|
doc.title = ""
|
||||||
docs_json = standalone_docs_json([model])
|
docs_json, _ = standalone_docs_json_and_render_items(
|
||||||
|
[model], suppress_callback_warning=True
|
||||||
|
)
|
||||||
|
|
||||||
doc_json = list(docs_json.values())[0]
|
doc_json = list(docs_json.values())[0]
|
||||||
root_id = doc_json['roots']['root_ids'][0]
|
root_id = doc_json['roots']['root_ids'][0]
|
||||||
@@ -87,7 +87,6 @@ def _link_docs(pydoc, jsdoc):
|
|||||||
async def show(plot, target):
|
async def show(plot, target):
|
||||||
pydoc, model_json = doc_json(plot, target)
|
pydoc, model_json = doc_json(plot, target)
|
||||||
views = await Bokeh.embed.embed_item(JSON.parse(model_json))
|
views = await Bokeh.embed.embed_item(JSON.parse(model_json))
|
||||||
print("Done embedding...")
|
|
||||||
jsdoc = views[0].model.document
|
jsdoc = views[0].model.document
|
||||||
_link_docs(pydoc, jsdoc)
|
_link_docs(pydoc, jsdoc)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user