Notebook Code Cleanup + Utils Test (#11754)

* Cleanup + Utils Test

* Removing unnecessary util method
This commit is contained in:
Chris LaFreniere
2020-08-14 14:08:56 -07:00
committed by GitHub
parent ff2d2d0339
commit a34a72795b
8 changed files with 9 additions and 44 deletions

View File

@@ -13,7 +13,6 @@ const localize = nls.loadMessageBundle();
import * as constants from '../common/constants';
import * as localizedConstants from '../common/localizedConstants';
import { JupyterServerInstallation } from './jupyterServerInstallation';
import { IServerInstance } from './common';
import * as utils from '../common/utils';
import { IPrompter, IQuestion, confirm } from '../prompts/question';
@@ -33,9 +32,8 @@ import { IconPathHelper } from '../common/iconHelper';
let untitledCounter = 0;
export class JupyterController implements vscode.Disposable {
export class JupyterController {
private _jupyterInstallation: JupyterServerInstallation;
private _notebookInstances: IServerInstance[] = [];
private _serverInstanceFactory: ServerInstanceFactory = new ServerInstanceFactory();
private _packageManageProviders = new Map<string, IPackageManageProvider>();
@@ -54,10 +52,6 @@ export class JupyterController implements vscode.Disposable {
return this._notebookProvider;
}
public dispose(): void {
this.deactivate();
}
// PUBLIC METHODS //////////////////////////////////////////////////////
public async activate(): Promise<boolean> {
this._jupyterInstallation = new JupyterServerInstallation(
@@ -112,11 +106,6 @@ export class JupyterController implements vscode.Disposable {
return this.handleNewNotebookTask(oeContext, oeContext.connectionProfile);
}
public deactivate(): void {
// Shutdown any open notebooks
this._notebookInstances.forEach(async (instance) => { await instance.stop(); });
}
// EVENT HANDLERS //////////////////////////////////////////////////////
public async getDefaultConnection(): Promise<azdata.connection.ConnectionProfile> {
return await azdata.connection.getCurrentConnection();

View File

@@ -207,11 +207,11 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
let extension = process.platform === constants.winPlatform ? 'zip' : 'tar.gz';
packageName = `python-${pythonVersion}-${platformId}-${bundleVersion}.${extension}`;
switch (utils.getOSPlatform()) {
case utils.Platform.Windows:
switch (process.platform) {
case constants.winPlatform:
pythonDownloadUrl = constants.pythonWindowsInstallUrl;
break;
case utils.Platform.Mac:
case constants.macPlatform:
pythonDownloadUrl = constants.pythonMacInstallUrl;
break;
default:
@@ -274,7 +274,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
return reject(err);
}
}
if (utils.getOSPlatform() === utils.Platform.Windows) {
if (process.platform === constants.winPlatform) {
try {
let zippedFile = new zip(pythonPackagePathLocal);
zippedFile.extractAllTo(installPath);