Extract modeling of specific set of candidates into its own function

This commit is contained in:
Charis Kyriakou
2023-08-08 15:56:04 +00:00
parent 75882710ad
commit 0cc8e68155

View File

@@ -1,8 +1,8 @@
import { ExternalApiUsage } from "./external-api-usage";
import { ExternalApiUsage, MethodSignature } from "./external-api-usage";
import { ModeledMethod } from "./modeled-method";
import { extLogger } from "../common/logging/vscode";
import { load as loadYaml } from "js-yaml";
import { withProgress } from "../common/vscode/progress";
import { ProgressCallback, withProgress } from "../common/vscode/progress";
import { createAutoModelV2Request, getCandidates } from "./auto-model-v2";
import { runAutoModelQueries } from "./auto-model-codeml-queries";
import { loadDataExtensionYaml } from "./yaml";
@@ -33,10 +33,10 @@ export class AutoModeler {
modeledMethods: Record<string, ModeledMethod>,
mode: Mode,
): Promise<void> {
await this.model(externalApiUsages, modeledMethods, mode);
await this.modelDependency(externalApiUsages, modeledMethods, mode);
}
private async model(
private async modelDependency(
externalApiUsages: ExternalApiUsage[],
modeledMethods: Record<string, ModeledMethod>,
mode: Mode,
@@ -63,6 +63,16 @@ export class AutoModeler {
return;
}
await this.modelCandidates(candidateMethods, mode, progress, maxStep);
});
}
private async modelCandidates(
candidateMethods: MethodSignature[],
mode: Mode,
progress: ProgressCallback,
maxStep: number,
): Promise<void> {
const usages = await runAutoModelQueries({
mode,
candidateMethods,
@@ -138,7 +148,6 @@ export class AutoModeler {
});
await this.addModeledMethods(loadedMethods);
});
}
private async callAutoModelApi(