MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / submitFromPythonFile

Function submitFromPythonFile

src/test/datascience/helpers.ts:120–146  ·  view source on GitHub ↗
(
    interactiveWindowProvider: IInteractiveWindowProvider,
    source: string,
    disposables: vscode.Disposable[],
    apiProvider?: IPythonApiProvider,
    activeInterpreterPath?: vscode.Uri
)

Source from the content-addressed store, hash-verified

118}
119
120export async function submitFromPythonFile(
121 interactiveWindowProvider: IInteractiveWindowProvider,
122 source: string,
123 disposables: vscode.Disposable[],
124 apiProvider?: IPythonApiProvider,
125 activeInterpreterPath?: vscode.Uri
126) {
127 const api = await initialize();
128 const tempFile = await createTemporaryFile({ contents: source, extension: '.py' });
129 disposables.push(tempFile);
130 const untitledPythonFile = await vscode.workspace.openTextDocument(tempFile.file);
131 await vscode.window.showTextDocument(untitledPythonFile);
132 if (apiProvider && activeInterpreterPath) {
133 const interpreterService = api.serviceContainer.get<IInterpreterService>(IInterpreterService);
134 await setActiveInterpreter(apiProvider, untitledPythonFile.uri, activeInterpreterPath);
135 await interpreterService.refreshInterpreters();
136 const interpreter = await interpreterService.getActiveInterpreter();
137 assert.ok(
138 isEqual(interpreter?.uri, activeInterpreterPath),
139 `Active interpreter not set, actual ${interpreter?.uri.fsPath}, expected ${activeInterpreterPath}`
140 );
141 }
142 const activeInteractiveWindow = await runCurrentFile(interactiveWindowProvider, untitledPythonFile);
143 const notebook = await waitForInteractiveWindow(activeInteractiveWindow);
144 await verifySelectedControllerIsRemoteForRemoteTests(notebook);
145 return { activeInteractiveWindow, untitledPythonFile };
146}
147
148export async function submitFromPythonFileUsingCodeWatcher(
149 source: string,

Calls 12

initializeFunction · 0.90
createTemporaryFileFunction · 0.90
setActiveInterpreterFunction · 0.85
runCurrentFileFunction · 0.85
waitForInteractiveWindowFunction · 0.85
openTextDocumentMethod · 0.80
showTextDocumentMethod · 0.80
pushMethod · 0.65
getMethod · 0.65
refreshInterpretersMethod · 0.65
getActiveInterpreterMethod · 0.65

Tested by 1