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 version check for nbclassic #1643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,26 @@
});
}

/**
* Returns whether the version of Jupyter Notebook that needs to be patched,
* see also the description of patch_Tooltip.
*
* @returns {boolean}
*/
function no_patches_required() {
var major = Number(((sys_info && sys_info.notebook_version) ?
sys_info.notebook_version : Jupyter.version).split(".")[0]);
if (major >= 5) {
return true;
}
// Compatibility with nbclassic: nbclassic returns 1.x.0 as Jupyter.version,
// no patches required.
if (major === 1) {
return true;
}
return false;
}

/**
* Return a promise which resolves when the Tooltip class methods have
* been appropriately patched.
Expand All @@ -595,7 +615,7 @@
* @return {Promise}
*/
function patch_Tooltip () {
if (Number(((sys_info) ? sys_info.notebook_version : Jupyter.version).split(".")[0]) >= 5) {
if (no_patches_required()) {
return Promise.resolve();
}
return new Promise(function (resolve, reject) {
Expand Down