|
13 | 13 | from notebook._version import __version__ as notebook_version
|
14 | 14 | except Exception as e:
|
15 | 15 | # No notebook python package found.
|
16 |
| - # Shimming notebook to jupyter_server for notebook extensions backwards compatiblity. |
| 16 | + # Shimming notebook to jupyter_server for notebook extensions backwards compatibility. |
17 | 17 | # We shim the complete notebook module.
|
18 | 18 | import jupyter_server
|
19 | 19 | sys.modules["notebook"] = jupyter_server
|
|
25 | 25 | if "notebook_version" in locals():
|
26 | 26 | # Notebook is available on the platform.
|
27 | 27 | # We shim based on the notebook version.
|
28 |
| - if notebook_version < "7": |
29 |
| - from .shim_notebook import shim_notebook_6 |
30 |
| - # Shimming existing notebook python package < 7 to jupyter_server. |
31 |
| - # For notebook extensions backwards compatiblity. |
32 |
| - shim_notebook_6() |
33 |
| - else: |
34 |
| - from .shim_notebook import shim_notebook_7_and_above |
35 |
| - # Shimming existing notebook python package >= 7 to jupyter_server. |
36 |
| - # For notebook extensions backwards compatiblity. |
37 |
| - shim_notebook_7_and_above() |
38 |
| - |
39 |
| - |
40 |
| -# Sanity check for the notebook shim. |
41 |
| - |
42 |
| -from jupyter_server.base.handlers import IPythonHandler as JupyterServerIPythonHandler |
43 |
| -assert JupyterServerIPythonHandler.__name__ == "JupyterHandler" |
44 |
| - |
45 |
| -from notebook.base.handlers import IPythonHandler as NotebookIPythonHandler |
46 |
| -assert NotebookIPythonHandler.__name__ == "JupyterHandler" or NotebookIPythonHandler.__name__ == "IPythonHandler" |
| 28 | + if not notebook_version < "7": |
| 29 | + from .shim_notebook import shim_notebook |
| 30 | + # Shimming existing notebook python package > 6 to jupyter_server. |
| 31 | + # For notebook extensions backwards compatibility. |
| 32 | + shim_notebook() |
| 33 | + # Sanity check for the notebook shim. |
| 34 | + from jupyter_server.base.handlers import IPythonHandler as JupyterServerIPythonHandler |
| 35 | + assert JupyterServerIPythonHandler.__name__ == "JupyterHandler" |
| 36 | + from notebook.base.handlers import IPythonHandler as NotebookIPythonHandler |
| 37 | + assert NotebookIPythonHandler.__name__ == "JupyterHandler" or NotebookIPythonHandler.__name__ == "IPythonHandler" |
47 | 38 |
|
48 | 39 |
|
49 | 40 | # Include both nbclassic/ and nbclassic/templates/. This makes it
|
|
0 commit comments