Skip to content

Commit

Permalink
Rename category to kind (#23744)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Jul 4, 2024
1 parent 2d66ae9 commit 01c3f16
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface NativeEnvInfo {
displayName?: string;
name?: string;
executable?: string;
category: string;
kind: string;
version?: string;
prefix?: string;
manager?: NativeEnvManagerInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,50 +443,49 @@ export class EnvsCollectionService extends PythonEnvsWatcher<PythonEnvCollection

const nativeEnvironmentsWithoutPython = nativeEnvs.filter((e) => e.executable === undefined).length;
const nativeCondaEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.Conda,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.Conda,
).length;
const nativeCustomEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.Custom,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.Custom,
).length;
const nativeMicrosoftStoreEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.MicrosoftStore,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.MicrosoftStore,
).length;
const nativeOtherGlobalEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.OtherGlobal,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.OtherGlobal,
).length;
const nativeOtherVirtualEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.OtherVirtual,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.OtherVirtual,
).length;
const nativePipEnvEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.Pipenv,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.Pipenv,
).length;
const nativePoetryEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.Poetry,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.Poetry,
).length;
const nativePyenvEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.Pyenv,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.Pyenv,
).length;
const nativeSystemEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.System,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.System,
).length;
const nativeUnknownEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.Unknown,
).length;
const nativeVenvEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.Venv,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.Unknown,
).length;
const nativeVenvEnvs = nativeEnvs.filter((e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.Venv)
.length;
const nativeVirtualEnvEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.VirtualEnv,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.VirtualEnv,
).length;
const nativeVirtualEnvWrapperEnvs = nativeEnvs.filter(
(e) => this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.VirtualEnvWrapper,
(e) => this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.VirtualEnvWrapper,
).length;
const nativeGlobal = nativeEnvs.filter(
(e) =>
this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.OtherGlobal ||
this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.System ||
this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.Custom ||
this.nativeFinder.categoryToKind(e.category) === PythonEnvKind.OtherVirtual,
this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.OtherGlobal ||
this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.System ||
this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.Custom ||
this.nativeFinder.categoryToKind(e.kind) === PythonEnvKind.OtherVirtual,
).length;

// Intent is to capture time taken for discovery of all envs to complete the first time.
Expand Down Expand Up @@ -582,7 +581,7 @@ export class EnvsCollectionService extends PythonEnvsWatcher<PythonEnvCollection
if (!resolvedEnv) {
return;
}
const kind = this.nativeFinder.categoryToKind(e.category);
const kind = this.nativeFinder.categoryToKind(e.kind);
const nativeVersion = e.version ? parseVersion(e.version) : undefined;
if (
nativeVersion &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class NativeLocator implements ILocator<BasicEnvInfo>, IDisposable {
if (data.executable) {
const arch = (data.arch || '').toLowerCase();
const env: BasicEnvInfo = {
kind: this.finder.categoryToKind(data.category),
kind: this.finder.categoryToKind(data.kind),
executablePath: data.executable ? data.executable : '',
envPath: data.prefix ? data.prefix : undefined,
version: data.version ? parseVersion(data.version) : undefined,
Expand Down

1 comment on commit 01c3f16

@zingbal
Copy link

@zingbal zingbal commented on 01c3f16 Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m

Please sign in to comment.