Skip to content

Created a requirements.txt to stop errors during python checking #18372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/assign-reviewers/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ certifi==2020.11.8
# via
# -r requirements.txt
# httpx
cffi==1.14.4
cffi==1.15.0
# via
# -r requirements.txt
# cryptography
Expand Down
2 changes: 1 addition & 1 deletion .github/assign-reviewers/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ certifi==2020.11.8 \
--hash=sha256:1f422849db327d534e3d0c5f02a263458c3955ec0aae4ff09b95f195c59f4edd \
--hash=sha256:f05def092c44fbf25834a51509ef6e631dc19765ab8a57b4e7ab85531f0a9cf4
# via httpx
cffi==1.14.4 \
cffi==1.15.0 \
--hash=sha256:00a1ba5e2e95684448de9b89888ccd02c98d512064b4cb987d48f4b40aa0421e \
--hash=sha256:00e28066507bfc3fe865a31f325c8391a1ac2916219340f87dfad602c3e48e5d \
--hash=sha256:045d792900a75e8b1e1b0ab6787dd733a8190ffcf80e8c8ceb2fb10a29ff238a \
Expand Down
50 changes: 0 additions & 50 deletions .github/workflows/pr-file-check.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ cucumber-report.json
**/.venv*/
port.txt
precommit.hook
pythonFiles/lib/**
pythonFiles/lib/python/bin
pythonFiles/lib/python/isort
pythonFiles/lib/python/isort-5.10.0.dist-info
debug_coverage*/**
languageServer/**
languageServer.*/**
Expand Down
1 change: 1 addition & 0 deletions news/2 Fixes/18372.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created requirements.txt to stop Python github Action Errors (Thanks [Harry-Hopkinson](https://github.com/Harry-Hopkinson))
1 change: 1 addition & 0 deletions news/3 Code Health/18345.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed typescript and namespace errors. (Thanks [Harry-Hopkinson](https://github.com/Harry-Hopkinson))
34 changes: 25 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,7 @@
"minimatch": "^3.0.4",
"named-js-regexp": "^1.3.3",
"node-stream-zip": "^1.6.0",
"react": "^17.0.2",
"reflect-metadata": "^0.1.12",
"request": "^2.87.0",
"request-progress": "^3.0.0",
Expand Down
10 changes: 10 additions & 0 deletions pythonFiles/lib/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
#
# pip-compile --generate-hashes requirements.in
#
isort==5.10.0 \
--hash=sha256:1a18ccace2ed8910bd9458b74a3ecbafd7b2f581301b0ab65cfdd4338272d76f \
--hash=sha256:e52ff6d38012b131628cf0f26c51e7bd3a7c81592eefe3ac71411e692f1b9345
# via -r requirements.in
3 changes: 2 additions & 1 deletion src/client/activation/activationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function logStartup(serverType: LanguageServerType): void {

@injectable()
export class LanguageServerExtensionActivationService
implements IExtensionActivationService, ILanguageServerCache, Disposable {
implements IExtensionActivationService, ILanguageServerCache, Disposable
{
private cache = new Map<string, Promise<RefCountedLanguageServer>>();

private activatedServer?: IActivatedServer;
Expand Down
4 changes: 3 additions & 1 deletion src/client/activation/jedi/languageClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export class JediLanguageClientFactory implements ILanguageClientFactory {
};

// eslint-disable-next-line global-require
const vscodeLanguageClient = require('vscode-languageclient/node') as typeof import('vscode-languageclient/node'); // NOSONAR
const vscodeLanguageClient =
// eslint-disable-next-line global-require
require('vscode-languageclient/node') as typeof import('vscode-languageclient/node'); // NOSONAR
return new vscodeLanguageClient.LanguageClient(
PYTHON_LANGUAGE,
languageClientName,
Expand Down
5 changes: 3 additions & 2 deletions src/client/activation/node/languageClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ export class NodeLanguageClientFactory implements ILanguageClientFactory {
clientOptions: LanguageClientOptions,
): Promise<LanguageClient> {
// this must exist for node language client
const commandArgs = (clientOptions.connectionOptions
?.cancellationStrategy as FileBasedCancellationStrategy).getCommandLineArguments();
const commandArgs = (
clientOptions.connectionOptions?.cancellationStrategy as FileBasedCancellationStrategy
).getCommandLineArguments();

const folderName = await this.languageServerFolderService.getLanguageServerFolderName(resource);
const languageServerFolder = path.isAbsolute(folderName)
Expand Down
4 changes: 1 addition & 3 deletions src/client/apiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ export interface IExtensionApi {
* * If no folder is present, it returns the global setting.
* @returns {({ execCommand: string[] | undefined })}
*/
getExecutionDetails(
resource?: Resource,
): {
getExecutionDetails(resource?: Resource): {
/**
* E.g of execution commands returned could be,
* * `['<path to the interpreter set in settings>']`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ class InvalidPythonPathInDebuggerDiagnostic extends BaseDiagnostic {
export const InvalidPythonPathInDebuggerServiceId = 'InvalidPythonPathInDebuggerServiceId';

@injectable()
export class InvalidPythonPathInDebuggerService extends BaseDiagnosticsService
implements IInvalidPythonPathInDebuggerService {
export class InvalidPythonPathInDebuggerService
extends BaseDiagnosticsService
implements IInvalidPythonPathInDebuggerService
{
constructor(
@inject(IServiceContainer) serviceContainer: IServiceContainer,
@inject(IWorkspaceService) private readonly workspace: IWorkspaceService,
Expand Down
37 changes: 22 additions & 15 deletions src/client/browser/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async function runPylance(

const languageClient = new LanguageClient('python', 'Python Language Server', clientOptions, worker);

languageClient.onDidChangeState((e) => {
languageClient.onDidChangeState((e): void => {
// The client's on* methods must be called after the client has started, but if called too
// late the server may have already sent a message (which leads to failures). Register
// these on the state change to running to ensure they are ready soon enough.
Expand All @@ -97,20 +97,27 @@ async function runPylance(
),
);

languageClient.onTelemetry((telemetryEvent) => {
const eventName = telemetryEvent.EventName || EventName.LANGUAGE_SERVER_TELEMETRY;
const formattedProperties = {
...telemetryEvent.Properties,
// Replace all slashes in the method name so it doesn't get scrubbed by vscode-extension-telemetry.
method: telemetryEvent.Properties.method?.replace(/\//g, '.'),
};
sendTelemetryEventBrowser(
eventName,
telemetryEvent.Measurements,
formattedProperties,
telemetryEvent.Exception,
);
});
languageClient.onTelemetry(
(telemetryEvent: {
EventName: EventName;
Properties: { method: string };
Measurements: number | Record<string, number> | undefined;
Exception: Error | undefined;
}) => {
const eventName = telemetryEvent.EventName || EventName.LANGUAGE_SERVER_TELEMETRY;
const formattedProperties = {
...telemetryEvent.Properties,
// Replace all slashes in the method name so it doesn't get scrubbed by vscode-extension-telemetry.
method: telemetryEvent.Properties.method?.replace(/\//g, '.'),
};
sendTelemetryEventBrowser(
eventName,
telemetryEvent.Measurements,
formattedProperties,
telemetryEvent.Exception,
);
},
);
});

const disposable = languageClient.start();
Expand Down
2 changes: 1 addition & 1 deletion src/client/browser/intellisenseStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ export function createStatusItem(): vscode.Disposable {
return statusItem;
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
return { dispose: () => {} };
return { dispose: () => undefined };
}
4 changes: 2 additions & 2 deletions src/client/common/application/commandManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class CommandManager implements ICommandManager {
// eslint-disable-next-line class-methods-use-this
public registerCommand<
E extends keyof ICommandNameArgumentTypeMapping,
U extends ICommandNameArgumentTypeMapping[E]
U extends ICommandNameArgumentTypeMapping[E],
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
>(command: E, callback: (...args: U) => any, thisArg?: any): Disposable {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -73,7 +73,7 @@ export class CommandManager implements ICommandManager {
public executeCommand<
T,
E extends keyof ICommandNameArgumentTypeMapping,
U extends ICommandNameArgumentTypeMapping[E]
U extends ICommandNameArgumentTypeMapping[E],
>(command: E, ...rest: U): Thenable<T | undefined> {
return commands.executeCommand<T>(command, ...rest);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ
if (argSetting) {
if (typeof argSetting === 'object') {
userSettings = userSettings.concat(os.EOL, property, os.EOL);
const argSettingsDict = (settings[property] as unknown) as Record<string, unknown>;
const argSettingsDict = settings[property] as unknown as Record<string, unknown>;
if (typeof argSettingsDict === 'object') {
Object.keys(argSetting).forEach((item) => {
const prop = argSetting[item];
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/net/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class HttpClient implements IHttpClient {
}

public async downloadFile(uri: string): Promise<requestTypes.Request> {
const request = ((await import('request')) as any) as typeof requestTypes;
const request = (await import('request')) as any as typeof requestTypes;
return request(uri, this.requestOptions);
}

Expand Down
2 changes: 1 addition & 1 deletion src/client/common/process/currentProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class CurrentProcess implements ICurrentProcess {
return process as any;
};
public get env(): EnvironmentVariables {
return (process.env as any) as EnvironmentVariables;
return process.env as any as EnvironmentVariables;
}
public get argv(): string[] {
return process.argv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ abstract class BaseActivationCommandProvider implements ITerminalActivationComma
resource: Uri | undefined,
targetShell: TerminalShellType,
): Promise<string[] | undefined> {
const pythonPath = this.serviceContainer.get<IConfigurationService>(IConfigurationService).getSettings(resource)
.pythonPath;
const pythonPath = this.serviceContainer
.get<IConfigurationService>(IConfigurationService)
.getSettings(resource).pythonPath;
return this.getActivationCommandsForInterpreter(pythonPath, targetShell);
}
public abstract getActivationCommandsForInterpreter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { TerminalShellType } from '../types';
import { ActivationScripts, VenvBaseActivationCommandProvider } from './baseActivationProvider';

// For a given shell the scripts are in order of precedence.
const SCRIPTS: ActivationScripts = ({
const SCRIPTS: ActivationScripts = {
// Group 1
[TerminalShellType.wsl]: ['activate.sh', 'activate'],
[TerminalShellType.ksh]: ['activate.sh', 'activate'],
Expand All @@ -19,7 +19,7 @@ const SCRIPTS: ActivationScripts = ({
[TerminalShellType.cshell]: ['activate.csh'],
// Group 3
[TerminalShellType.fish]: ['activate.fish'],
} as unknown) as ActivationScripts;
} as unknown as ActivationScripts;

export function getAllScripts(): string[] {
const scripts: string[] = [];
Expand Down
Loading