prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Inline, Minified Resources do not work in classic notebooks
  This is due to an interaction with the classic notebooks use of JQuery, when output is published as `text/html`. New notebook code published a div and a script together as `text/html`. Propose to solve by publishing a single script as `application/javascript` (which should work) that creates the necessary div itself 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `bokeh/util/notebook.py`
  Content:
  ```
  1 ''' Functions useful for loading Bokeh code and data in Jupyter/Zeppelin notebooks.
  2 
  3 '''
  4 from __future__ import absolute_import
  5 
  6 from IPython.display import publish_display_data
  7 
  8 from ..embed import _wrap_in_script_tag
  9 
  10 LOAD_MIME_TYPE = 'application/vnd.bokehjs_load.v0+json'
  11 EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json'
  12 
  13 _notebook_loaded = None
  14 
  15 # TODO (bev) notebook_type and zeppelin bits should be removed after external zeppelin hook available
  16 def load_notebook(resources=None, verbose=False, hide_banner=False, load_timeout=5000, notebook_type='jupyter'):
  17     ''' Prepare the IPython notebook for displaying Bokeh plots.
  18 
  19     Args:
  20         resources (Resource, optional) :
  21             how and where to load BokehJS from (default: CDN)
  22 
  23         verbose (bool, optional) :
  24             whether to report detailed settings (default: False)
  25 
  26         hide_banner (bool, optional):
  27             whether to hide the Bokeh banner (default: False)
  28 
  29         load_timeout (int, optional) :
  30             Timeout in milliseconds when plots assume load timed out (default: 5000)
  31 
  32         notebook_type (string):
  33             notebook_type (default: jupyter)
  34 
  35     .. warning::
  36         Clearing the output cell containing the published BokehJS
  37         resources HTML code may cause Bokeh CSS styling to be removed.
  38 
  39     Returns:
  40         None
  41 
  42     '''
  43     nb_html, nb_js = _load_notebook_html(resources, verbose, hide_banner, load_timeout)
  44     lab_html, lab_js = _load_notebook_html(resources, verbose, hide_banner, load_timeout, register_mimetype=False)
  45     if notebook_type=='jupyter':
  46         publish_display_data({'text/html': nb_html + _wrap_in_script_tag(nb_js),
  47                               LOAD_MIME_TYPE: {"script": lab_js, "div": lab_html}})
  48     else:
  49         _publish_zeppelin_data(lab_html, lab_js)
  50 
  51 
  52 FINALIZE_JS = """
  53 document.getElementById("%s").textContent = "BokehJS is loading...";
  54 """
  55 
  56 # TODO (bev) This will eventually go away
  57 def _publish_zeppelin_data(html, js):
  58     print('%html ' + html)
  59     print('%html ' + '<script type="text/javascript">' + js + "</script>")
  60 
  61 def _load_notebook_html(resources=None, verbose=False, hide_banner=False,
  62                         load_timeout=5000, register_mimetype=True):
  63     global _notebook_loaded
  64 
  65     from .. import __version__
  66     from ..core.templates import AUTOLOAD_NB_JS, NOTEBOOK_LOAD
  67     from ..util.serialization import make_id
  68     from ..util.compiler import bundle_all_models
  69     from ..resources import CDN
  70 
  71     if resources is None:
  72         resources = CDN
  73 
  74     if resources.mode == 'inline':
  75         js_info = 'inline'
  76         css_info = 'inline'
  77     else:
  78         js_info = resources.js_files[0] if len(resources.js_files) == 1 else resources.js_files
  79         css_info = resources.css_files[0] if len(resources.css_files) == 1 else resources.css_files
  80 
  81     warnings = ["Warning: " + msg['text'] for msg in resources.messages if msg['type'] == 'warn']
  82 
  83     if _notebook_loaded and verbose:
  84         warnings.append('Warning: BokehJS previously loaded')
  85 
  86     _notebook_loaded = resources
  87 
  88     element_id = make_id()
  89 
  90     html = NOTEBOOK_LOAD.render(
  91         element_id    = element_id,
  92         verbose       = verbose,
  93         js_info       = js_info,
  94         css_info      = css_info,
  95         bokeh_version = __version__,
  96         warnings      = warnings,
  97         hide_banner   = hide_banner,
  98     )
  99 
  100     custom_models_js = bundle_all_models()
  101 
  102     js = AUTOLOAD_NB_JS.render(
  103         elementid = '' if hide_banner else element_id,
  104         js_urls  = resources.js_files,
  105         css_urls = resources.css_files,
  106         js_raw   = resources.js_raw + [custom_models_js] + ([] if hide_banner else [FINALIZE_JS % element_id]),
  107         css_raw  = resources.css_raw_str,
  108         force    = True,
  109         timeout  = load_timeout,
  110         register_mimetype = register_mimetype
  111     )
  112 
  113     return html, js
  114 
  115 def get_comms(target_name):
  116     ''' Create a Jupyter comms object for a specific target, that can
  117     be used to update Bokeh documents in the Jupyter notebook.
  118 
  119     Args:
  120         target_name (str) : the target name the Comms object should connect to
  121 
  122     Returns
  123         Jupyter Comms
  124 
  125     '''
  126     from ipykernel.comm import Comm
  127     return Comm(target_name=target_name, data={})
  128
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/bokeh/util/notebook.py b/bokeh/util/notebook.py
  --- a/bokeh/util/notebook.py
  +++ b/bokeh/util/notebook.py
  @@ -5,8 +5,7 @@
   
   from IPython.display import publish_display_data
   
  -from ..embed import _wrap_in_script_tag
  -
  +JS_MIME_TYPE   = 'application/javascript'
   LOAD_MIME_TYPE = 'application/vnd.bokehjs_load.v0+json'
   EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json'
   
  @@ -40,33 +39,14 @@
           None
   
       '''
  -    nb_html, nb_js = _load_notebook_html(resources, verbose, hide_banner, load_timeout)
  -    lab_html, lab_js = _load_notebook_html(resources, verbose, hide_banner, load_timeout, register_mimetype=False)
  -    if notebook_type=='jupyter':
  -        publish_display_data({'text/html': nb_html + _wrap_in_script_tag(nb_js),
  -                              LOAD_MIME_TYPE: {"script": lab_js, "div": lab_html}})
  -    else:
  -        _publish_zeppelin_data(lab_html, lab_js)
   
  -
  -FINALIZE_JS = """
  -document.getElementById("%s").textContent = "BokehJS is loading...";
  -"""
  -
  -# TODO (bev) This will eventually go away
  -def _publish_zeppelin_data(html, js):
  -    print('%html ' + html)
  -    print('%html ' + '<script type="text/javascript">' + js + "</script>")
  -
  -def _load_notebook_html(resources=None, verbose=False, hide_banner=False,
  -                        load_timeout=5000, register_mimetype=True):
       global _notebook_loaded
   
       from .. import __version__
  -    from ..core.templates import AUTOLOAD_NB_JS, NOTEBOOK_LOAD
  +    from ..core.templates import NOTEBOOK_LOAD
       from ..util.serialization import make_id
  -    from ..util.compiler import bundle_all_models
       from ..resources import CDN
  +    from ..util.compiler import bundle_all_models
   
       if resources is None:
           resources = CDN
  @@ -99,18 +79,48 @@
   
       custom_models_js = bundle_all_models()
   
  +    nb_js = _loading_js(resources, element_id, custom_models_js, load_timeout, register_mime=True)
  +    jl_js = _loading_js(resources, element_id, custom_models_js, load_timeout, register_mime=False)
  +
  +    if notebook_type=='jupyter':
  +
  +        if not hide_banner:
  +            publish_display_data({'text/html': html})
  +
  +        publish_display_data({
  +            JS_MIME_TYPE   : nb_js,
  +            LOAD_MIME_TYPE : {"script": jl_js}
  +        })
  +
  +    else:
  +        _publish_zeppelin_data(html, jl_js)
  +
  +
  +FINALIZE_JS = """
  +document.getElementById("%s").textContent = "BokehJS is loading...";
  +"""
  +
  +# TODO (bev) This will eventually go away
  +def _publish_zeppelin_data(html, js):
  +    print('%html ' + html)
  +    print('%html ' + '<script type="text/javascript">' + js + "</script>")
  +
  +def _loading_js(resources, element_id, custom_models_js, load_timeout=5000, register_mime=True):
  +
  +    from ..core.templates import AUTOLOAD_NB_JS
  +
       js = AUTOLOAD_NB_JS.render(
  -        elementid = '' if hide_banner else element_id,
  -        js_urls  = resources.js_files,
  -        css_urls = resources.css_files,
  -        js_raw   = resources.js_raw + [custom_models_js] + ([] if hide_banner else [FINALIZE_JS % element_id]),
  -        css_raw  = resources.css_raw_str,
  -        force    = True,
  -        timeout  = load_timeout,
  -        register_mimetype = register_mimetype
  +        elementid = element_id,
  +        js_urls   = resources.js_files,
  +        css_urls  = resources.css_files,
  +        js_raw    = resources.js_raw + [custom_models_js] + [FINALIZE_JS % element_id],
  +        css_raw   = resources.css_raw_str,
  +        force     = True,
  +        timeout   = load_timeout,
  +        register_mime = register_mime
       )
   
  -    return html, js
  +    return js
   
   def get_comms(target_name):
       ''' Create a Jupyter comms object for a specific target, that can
  
verification_info: {"golden_diff": "diff --git a/bokeh/util/notebook.py b/bokeh/util/notebook.py\n--- a/bokeh/util/notebook.py\n+++ b/bokeh/util/notebook.py\n@@ -5,8 +5,7 @@\n \n from IPython.display import publish_display_data\n \n-from ..embed import _wrap_in_script_tag\n-\n+JS_MIME_TYPE   = 'application/javascript'\n LOAD_MIME_TYPE = 'application/vnd.bokehjs_load.v0+json'\n EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json'\n \n@@ -40,33 +39,14 @@\n         None\n \n     '''\n-    nb_html, nb_js = _load_notebook_html(resources, verbose, hide_banner, load_timeout)\n-    lab_html, lab_js = _load_notebook_html(resources, verbose, hide_banner, load_timeout, register_mimetype=False)\n-    if notebook_type=='jupyter':\n-        publish_display_data({'text/html': nb_html + _wrap_in_script_tag(nb_js),\n-                              LOAD_MIME_TYPE: {\"script\": lab_js, \"div\": lab_html}})\n-    else:\n-        _publish_zeppelin_data(lab_html, lab_js)\n \n-\n-FINALIZE_JS = \"\"\"\n-document.getElementById(\"%s\").textContent = \"BokehJS is loading...\";\n-\"\"\"\n-\n-# TODO (bev) This will eventually go away\n-def _publish_zeppelin_data(html, js):\n-    print('%html ' + html)\n-    print('%html ' + '<script type=\"text/javascript\">' + js + \"</script>\")\n-\n-def _load_notebook_html(resources=None, verbose=False, hide_banner=False,\n-                        load_timeout=5000, register_mimetype=True):\n     global _notebook_loaded\n \n     from .. import __version__\n-    from ..core.templates import AUTOLOAD_NB_JS, NOTEBOOK_LOAD\n+    from ..core.templates import NOTEBOOK_LOAD\n     from ..util.serialization import make_id\n-    from ..util.compiler import bundle_all_models\n     from ..resources import CDN\n+    from ..util.compiler import bundle_all_models\n \n     if resources is None:\n         resources = CDN\n@@ -99,18 +79,48 @@\n \n     custom_models_js = bundle_all_models()\n \n+    nb_js = _loading_js(resources, element_id, custom_models_js, load_timeout, register_mime=True)\n+    jl_js = _loading_js(resources, element_id, custom_models_js, load_timeout, register_mime=False)\n+\n+    if notebook_type=='jupyter':\n+\n+        if not hide_banner:\n+            publish_display_data({'text/html': html})\n+\n+        publish_display_data({\n+            JS_MIME_TYPE   : nb_js,\n+            LOAD_MIME_TYPE : {\"script\": jl_js}\n+        })\n+\n+    else:\n+        _publish_zeppelin_data(html, jl_js)\n+\n+\n+FINALIZE_JS = \"\"\"\n+document.getElementById(\"%s\").textContent = \"BokehJS is loading...\";\n+\"\"\"\n+\n+# TODO (bev) This will eventually go away\n+def _publish_zeppelin_data(html, js):\n+    print('%html ' + html)\n+    print('%html ' + '<script type=\"text/javascript\">' + js + \"</script>\")\n+\n+def _loading_js(resources, element_id, custom_models_js, load_timeout=5000, register_mime=True):\n+\n+    from ..core.templates import AUTOLOAD_NB_JS\n+\n     js = AUTOLOAD_NB_JS.render(\n-        elementid = '' if hide_banner else element_id,\n-        js_urls  = resources.js_files,\n-        css_urls = resources.css_files,\n-        js_raw   = resources.js_raw + [custom_models_js] + ([] if hide_banner else [FINALIZE_JS % element_id]),\n-        css_raw  = resources.css_raw_str,\n-        force    = True,\n-        timeout  = load_timeout,\n-        register_mimetype = register_mimetype\n+        elementid = element_id,\n+        js_urls   = resources.js_files,\n+        css_urls  = resources.css_files,\n+        js_raw    = resources.js_raw + [custom_models_js] + [FINALIZE_JS % element_id],\n+        css_raw   = resources.css_raw_str,\n+        force     = True,\n+        timeout   = load_timeout,\n+        register_mime = register_mime\n     )\n \n-    return html, js\n+    return js\n \n def get_comms(target_name):\n     ''' Create a Jupyter comms object for a specific target, that can\n", "issue": "Inline, Minified Resources do not work in classic notebooks\nThis is due to an interaction with the classic notebooks use of JQuery, when output is published as `text/html`. New notebook code published a div and a script together as `text/html`. Propose to solve by publishing a single script as `application/javascript` (which should work) that creates the necessary div itself \n", "before_files": [{"content": "''' Functions useful for loading Bokeh code and data in Jupyter/Zeppelin notebooks.\n\n'''\nfrom __future__ import absolute_import\n\nfrom IPython.display import publish_display_data\n\nfrom ..embed import _wrap_in_script_tag\n\nLOAD_MIME_TYPE = 'application/vnd.bokehjs_load.v0+json'\nEXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json'\n\n_notebook_loaded = None\n\n# TODO (bev) notebook_type and zeppelin bits should be removed after external zeppelin hook available\ndef load_notebook(resources=None, verbose=False, hide_banner=False, load_timeout=5000, notebook_type='jupyter'):\n    ''' Prepare the IPython notebook for displaying Bokeh plots.\n\n    Args:\n        resources (Resource, optional) :\n            how and where to load BokehJS from (default: CDN)\n\n        verbose (bool, optional) :\n            whether to report detailed settings (default: False)\n\n        hide_banner (bool, optional):\n            whether to hide the Bokeh banner (default: False)\n\n        load_timeout (int, optional) :\n            Timeout in milliseconds when plots assume load timed out (default: 5000)\n\n        notebook_type (string):\n            notebook_type (default: jupyter)\n\n    .. warning::\n        Clearing the output cell containing the published BokehJS\n        resources HTML code may cause Bokeh CSS styling to be removed.\n\n    Returns:\n        None\n\n    '''\n    nb_html, nb_js = _load_notebook_html(resources, verbose, hide_banner, load_timeout)\n    lab_html, lab_js = _load_notebook_html(resources, verbose, hide_banner, load_timeout, register_mimetype=False)\n    if notebook_type=='jupyter':\n        publish_display_data({'text/html': nb_html + _wrap_in_script_tag(nb_js),\n                              LOAD_MIME_TYPE: {\"script\": lab_js, \"div\": lab_html}})\n    else:\n        _publish_zeppelin_data(lab_html, lab_js)\n\n\nFINALIZE_JS = \"\"\"\ndocument.getElementById(\"%s\").textContent = \"BokehJS is loading...\";\n\"\"\"\n\n# TODO (bev) This will eventually go away\ndef _publish_zeppelin_data(html, js):\n    print('%html ' + html)\n    print('%html ' + '<script type=\"text/javascript\">' + js + \"</script>\")\n\ndef _load_notebook_html(resources=None, verbose=False, hide_banner=False,\n                        load_timeout=5000, register_mimetype=True):\n    global _notebook_loaded\n\n    from .. import __version__\n    from ..core.templates import AUTOLOAD_NB_JS, NOTEBOOK_LOAD\n    from ..util.serialization import make_id\n    from ..util.compiler import bundle_all_models\n    from ..resources import CDN\n\n    if resources is None:\n        resources = CDN\n\n    if resources.mode == 'inline':\n        js_info = 'inline'\n        css_info = 'inline'\n    else:\n        js_info = resources.js_files[0] if len(resources.js_files) == 1 else resources.js_files\n        css_info = resources.css_files[0] if len(resources.css_files) == 1 else resources.css_files\n\n    warnings = [\"Warning: \" + msg['text'] for msg in resources.messages if msg['type'] == 'warn']\n\n    if _notebook_loaded and verbose:\n        warnings.append('Warning: BokehJS previously loaded')\n\n    _notebook_loaded = resources\n\n    element_id = make_id()\n\n    html = NOTEBOOK_LOAD.render(\n        element_id    = element_id,\n        verbose       = verbose,\n        js_info       = js_info,\n        css_info      = css_info,\n        bokeh_version = __version__,\n        warnings      = warnings,\n        hide_banner   = hide_banner,\n    )\n\n    custom_models_js = bundle_all_models()\n\n    js = AUTOLOAD_NB_JS.render(\n        elementid = '' if hide_banner else element_id,\n        js_urls  = resources.js_files,\n        css_urls = resources.css_files,\n        js_raw   = resources.js_raw + [custom_models_js] + ([] if hide_banner else [FINALIZE_JS % element_id]),\n        css_raw  = resources.css_raw_str,\n        force    = True,\n        timeout  = load_timeout,\n        register_mimetype = register_mimetype\n    )\n\n    return html, js\n\ndef get_comms(target_name):\n    ''' Create a Jupyter comms object for a specific target, that can\n    be used to update Bokeh documents in the Jupyter notebook.\n\n    Args:\n        target_name (str) : the target name the Comms object should connect to\n\n    Returns\n        Jupyter Comms\n\n    '''\n    from ipykernel.comm import Comm\n    return Comm(target_name=target_name, data={})\n", "path": "bokeh/util/notebook.py"}], "after_files": [{"content": "''' Functions useful for loading Bokeh code and data in Jupyter/Zeppelin notebooks.\n\n'''\nfrom __future__ import absolute_import\n\nfrom IPython.display import publish_display_data\n\nJS_MIME_TYPE   = 'application/javascript'\nLOAD_MIME_TYPE = 'application/vnd.bokehjs_load.v0+json'\nEXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json'\n\n_notebook_loaded = None\n\n# TODO (bev) notebook_type and zeppelin bits should be removed after external zeppelin hook available\ndef load_notebook(resources=None, verbose=False, hide_banner=False, load_timeout=5000, notebook_type='jupyter'):\n    ''' Prepare the IPython notebook for displaying Bokeh plots.\n\n    Args:\n        resources (Resource, optional) :\n            how and where to load BokehJS from (default: CDN)\n\n        verbose (bool, optional) :\n            whether to report detailed settings (default: False)\n\n        hide_banner (bool, optional):\n            whether to hide the Bokeh banner (default: False)\n\n        load_timeout (int, optional) :\n            Timeout in milliseconds when plots assume load timed out (default: 5000)\n\n        notebook_type (string):\n            notebook_type (default: jupyter)\n\n    .. warning::\n        Clearing the output cell containing the published BokehJS\n        resources HTML code may cause Bokeh CSS styling to be removed.\n\n    Returns:\n        None\n\n    '''\n\n    global _notebook_loaded\n\n    from .. import __version__\n    from ..core.templates import NOTEBOOK_LOAD\n    from ..util.serialization import make_id\n    from ..resources import CDN\n    from ..util.compiler import bundle_all_models\n\n    if resources is None:\n        resources = CDN\n\n    if resources.mode == 'inline':\n        js_info = 'inline'\n        css_info = 'inline'\n    else:\n        js_info = resources.js_files[0] if len(resources.js_files) == 1 else resources.js_files\n        css_info = resources.css_files[0] if len(resources.css_files) == 1 else resources.css_files\n\n    warnings = [\"Warning: \" + msg['text'] for msg in resources.messages if msg['type'] == 'warn']\n\n    if _notebook_loaded and verbose:\n        warnings.append('Warning: BokehJS previously loaded')\n\n    _notebook_loaded = resources\n\n    element_id = make_id()\n\n    html = NOTEBOOK_LOAD.render(\n        element_id    = element_id,\n        verbose       = verbose,\n        js_info       = js_info,\n        css_info      = css_info,\n        bokeh_version = __version__,\n        warnings      = warnings,\n        hide_banner   = hide_banner,\n    )\n\n    custom_models_js = bundle_all_models()\n\n    nb_js = _loading_js(resources, element_id, custom_models_js, load_timeout, register_mime=True)\n    jl_js = _loading_js(resources, element_id, custom_models_js, load_timeout, register_mime=False)\n\n    if notebook_type=='jupyter':\n\n        if not hide_banner:\n            publish_display_data({'text/html': html})\n\n        publish_display_data({\n            JS_MIME_TYPE   : nb_js,\n            LOAD_MIME_TYPE : {\"script\": jl_js}\n        })\n\n    else:\n        _publish_zeppelin_data(html, jl_js)\n\n\nFINALIZE_JS = \"\"\"\ndocument.getElementById(\"%s\").textContent = \"BokehJS is loading...\";\n\"\"\"\n\n# TODO (bev) This will eventually go away\ndef _publish_zeppelin_data(html, js):\n    print('%html ' + html)\n    print('%html ' + '<script type=\"text/javascript\">' + js + \"</script>\")\n\ndef _loading_js(resources, element_id, custom_models_js, load_timeout=5000, register_mime=True):\n\n    from ..core.templates import AUTOLOAD_NB_JS\n\n    js = AUTOLOAD_NB_JS.render(\n        elementid = element_id,\n        js_urls   = resources.js_files,\n        css_urls  = resources.css_files,\n        js_raw    = resources.js_raw + [custom_models_js] + [FINALIZE_JS % element_id],\n        css_raw   = resources.css_raw_str,\n        force     = True,\n        timeout   = load_timeout,\n        register_mime = register_mime\n    )\n\n    return js\n\ndef get_comms(target_name):\n    ''' Create a Jupyter comms object for a specific target, that can\n    be used to update Bokeh documents in the Jupyter notebook.\n\n    Args:\n        target_name (str) : the target name the Comms object should connect to\n\n    Returns\n        Jupyter Comms\n\n    '''\n    from ipykernel.comm import Comm\n    return Comm(target_name=target_name, data={})\n", "path": "bokeh/util/notebook.py"}]}