MCPcopy Create free account
hub / github.com/facebook/pyrefly / canImportModule

Function canImportModule

lsp/src/codeLens.ts:136–149  ·  view source on GitHub ↗
(
  interpreter: string,
  moduleName: string,
  cwd: string | undefined,
)

Source from the content-addressed store, hash-verified

134}
135
136async function canImportModule(
137 interpreter: string,
138 moduleName: string,
139 cwd: string | undefined,
140): Promise<boolean> {
141 return await new Promise(resolve => {
142 execFile(
143 interpreter,
144 ['-c', `import ${moduleName}`],
145 {cwd},
146 error => resolve(error == null),
147 );
148 });
149}
150
151function scopeForUri(uri: vscode.Uri): vscode.WorkspaceFolder | vscode.TaskScope {
152 return vscode.workspace.getWorkspaceFolder(uri) ?? vscode.TaskScope.Workspace;

Callers 1

runTestAtLocationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected