Skip to content

Commit

Permalink
pull-pylance-with-pyright-1.1.388-20241106-070225
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 6, 2024
1 parent 0ce78f8 commit e1bb702
Show file tree
Hide file tree
Showing 23 changed files with 66 additions and 36 deletions.
6 changes: 3 additions & 3 deletions packages/pyright-internal/package-lock.json

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

12 changes: 6 additions & 6 deletions packages/pyright-internal/src/analyzer/importResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,12 @@ export class ImportResolver {
return excludes;
}

// Intended to be overridden by subclasses to provide additional stub
// path capabilities. Return undefined if no extra stub path were found.
getTypeshedPathEx(execEnv: ExecutionEnvironment, importFailureInfo: string[]): Uri | undefined {
return undefined;
}

protected readdirEntriesCached(uri: Uri): Dirent[] {
const cachedValue = this._cachedEntriesForPath.get(uri.key);
if (cachedValue) {
Expand Down Expand Up @@ -744,12 +750,6 @@ export class ImportResolver {
);
}

// Intended to be overridden by subclasses to provide additional stub
// path capabilities. Return undefined if no extra stub path were found.
protected getTypeshedPathEx(execEnv: ExecutionEnvironment, importFailureInfo: string[]): Uri | undefined {
return undefined;
}

// Intended to be overridden by subclasses to provide additional stub
// resolving capabilities. Return undefined if no stubs were found for
// this import.
Expand Down
3 changes: 1 addition & 2 deletions packages/pyright-internal/src/analyzer/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { EditableProgram, ProgramView } from '../common/extensibility';
import { FileSystem } from '../common/fileSystem';
import { FileWatcher, FileWatcherEventType, ignoredWatchEventFunction } from '../common/fileWatcher';
import { Host, HostFactory, NoAccessHost } from '../common/host';
import { defaultStubsDirectory } from '../common/pathConsts';
import { configFileName, defaultStubsDirectory } from '../common/pathConsts';
import { getFileName, isRootedDiskPath, normalizeSlashes } from '../common/pathUtils';
import { PythonVersion } from '../common/pythonVersion';
import { ServiceKeys } from '../common/serviceKeys';
Expand Down Expand Up @@ -59,7 +59,6 @@ import { ImportResolver, ImportResolverFactory, createImportedModuleDescriptor }
import { MaxAnalysisTime, Program } from './program';
import { findPythonSearchPaths } from './pythonPathUtils';
import {
configFileName,
findConfigFile,
findConfigFileHereOrUp,
findPyprojectTomlFile,
Expand Down
4 changes: 1 addition & 3 deletions packages/pyright-internal/src/analyzer/serviceUtils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { ReadOnlyFileSystem } from '../common/fileSystem';
import { configFileName, pyprojectTomlName } from '../common/pathConsts';
import { Uri } from '../common/uri/uri';
import { forEachAncestorDirectory } from '../common/uri/uriUtils';

export const configFileName = 'pyrightconfig.json';
export const pyprojectTomlName = 'pyproject.toml';

export function findPyprojectTomlFileHereOrUp(fs: ReadOnlyFileSystem, searchPath: Uri): Uri | undefined {
return forEachAncestorDirectory(searchPath, (ancestor) => findPyprojectTomlFile(fs, ancestor));
}
Expand Down
3 changes: 3 additions & 0 deletions packages/pyright-internal/src/common/pathConsts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ export const distPackages = 'dist-packages';
export const src = 'src';
export const stubsSuffix = '-stubs';
export const defaultStubsDirectory = 'typings';
export const requirementsFileName = 'requirements.txt';
export const pyprojectTomlName = 'pyproject.toml';
export const configFileName = 'pyrightconfig.json';
32 changes: 16 additions & 16 deletions packages/pyright-internal/src/languageService/autoImporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export interface AutoImportSymbol {
}

export interface ModuleSymbolTable {
uri: Uri;
forEach(callbackfn: (symbol: AutoImportSymbol, name: string, library: boolean) => void): void;
readonly uri: Uri;
getSymbols(): Generator<{ symbol: AutoImportSymbol; name: string; library: boolean }>;
}

export type ModuleSymbolMap = Map<string, ModuleSymbolTable>;
Expand Down Expand Up @@ -138,34 +138,34 @@ export function buildModuleSymbolsMap(files: readonly SourceFileInfo[]): ModuleS

moduleSymbolMap.set(uri.key, {
uri,
forEach(callbackfn: (value: AutoImportSymbol, key: string, library: boolean) => void): void {
symbolTable.forEach((symbol, name) => {
*getSymbols() {
for (const [name, symbol] of symbolTable) {
if (!isVisibleExternally(symbol)) {
return;
continue;
}

const declarations = symbol.getDeclarations();
if (!declarations || declarations.length === 0) {
return;
continue;
}

const declaration = declarations[0];
if (!declaration) {
return;
continue;
}

if (declaration.type === DeclarationType.Alias && isUserCode(file)) {
// We don't include import alias in auto import
// for workspace files.
return;
continue;
}

const variableKind =
declaration.type === DeclarationType.Variable && !declaration.isConstant && !declaration.isFinal
? SymbolKind.Variable
: undefined;
callbackfn({ symbol, kind: variableKind }, name, /* library */ !isUserCode(file));
});
yield { symbol: { symbol, kind: variableKind }, name, library: !isUserCode(file) };
}
},
});
return;
Expand Down Expand Up @@ -351,22 +351,22 @@ export class AutoImporter {
}

const dotCount = StringUtils.getCharacterCount(importSource, '.');
topLevelSymbols.forEach((autoImportSymbol, name) => {
for (const { symbol: autoImportSymbol, name } of topLevelSymbols.getSymbols()) {
if (!this.shouldIncludeVariable(autoImportSymbol, name, fileProperties.isStub)) {
return;
continue;
}

// For very short matching strings, we will require an exact match. Otherwise
// we will tend to return a list that's too long. Once we get beyond two
// characters, we can do a fuzzy match.
const isSimilar = this._isSimilar(word, name, similarityLimit);
if (!isSimilar) {
return;
continue;
}

const alreadyIncluded = this._containsName(name, importSource, results);
if (alreadyIncluded) {
return;
continue;
}

// We will collect all aliases and then process it later
Expand All @@ -392,7 +392,7 @@ export class AutoImporter {
},
importAliasMap
);
return;
continue;
}

const nameForImportFrom = this.getNameForImportFrom(/* library */ !fileProperties.isUserCode, moduleUri);
Expand All @@ -416,7 +416,7 @@ export class AutoImporter {
originalName: name,
originalDeclUri: moduleUri,
});
});
}

// If the current file is in a directory that also contains an "__init__.py[i]"
// file, we can use that directory name as an implicit import target.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import {
import { FileSystem } from '../common/fileSystem';
import { deduplicateFolders, isFile } from '../common/uri/uriUtils';
import { DynamicFeature } from './dynamicFeature';
import { configFileName } from '../analyzer/serviceUtils';
import { Workspace } from '../workspaceFactory';
import { isDefined } from '../common/core';
import { configFileName } from '../common/pathConsts';

export class FileWatcherDynamicFeature extends DynamicFeature {
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "Chybí poznámka typu pro parametr „{name}“",
"paramAssignmentMismatch": "Výraz typu „{sourceType}“ nelze přiřadit k parametru typu „{paramType}“",
"paramNameMissing": "Žádný parametr s názvem {name}",
"paramSpecArgsKwargsDuplicate": "Argumenty pro ParamSpec {type} již byly zadány.",
"paramSpecArgsKwargsUsage": "Atributy args a kwargs ParamSpec se musí vyskytovat v signatuře funkce.",
"paramSpecArgsMissing": "Chybí argumenty pro parametr ParamSpec {type}",
"paramSpecArgsUsage": "Atribut args ParamSpec je platný jenom v případě, že se používá s parametrem *args.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "Typanmerkung fehlt für Parameter \"{name}\"",
"paramAssignmentMismatch": "Ein Ausdruck vom Typ \"{sourceType}\" kann keinem Parameter vom Typ \"{paramType}\" zugewiesen werden.",
"paramNameMissing": "Kein Parameter mit dem Namen \"{name}\"",
"paramSpecArgsKwargsDuplicate": "Es wurden bereits Argumente für ParamSpec \"{type}\" bereitgestellt",
"paramSpecArgsKwargsUsage": "Die Attribute „args“ und „kwargs“ von ParamSpec müssen beide innerhalb einer Funktionssignatur auftreten",
"paramSpecArgsMissing": "Argumente für ParamSpec \"{type}\" fehlen.",
"paramSpecArgsUsage": "Das Attribut „args“ von ParamSpec ist nur gültig, wenn es mit dem Parameter „*args“ verwendet wird",
Expand Down Expand Up @@ -562,7 +563,7 @@
"typedDictEntryName": "Für den Wörterbucheintragsnamen wurde ein Zeichenfolgenliteral erwartet.",
"typedDictEntryUnique": "Namen innerhalb eines Wörterbuchs müssen eindeutig sein.",
"typedDictExtraArgs": "Zusätzliche TypedDict-Argumente werden nicht unterstützt.",
"typedDictExtraItemsClosed": "A TypedDict cannot be closed if it supports extra items",
"typedDictExtraItemsClosed": "Ein TypedDict kann nicht auf closed (geschlossen) gesetzt werden, wenn es zusätzliche Elemente unterstützt.",
"typedDictFieldNotRequiredRedefinition": "Das TypedDict-Element „{name}“ kann nicht als „NotRequired“ neu definiert werden.",
"typedDictFieldReadOnlyRedefinition": "Das TypedDict-Element „{name}“ kann nicht als „ReadOnly“ neu definiert werden.",
"typedDictFieldRequiredRedefinition": "Das TypedDict-Element „{name}“ kann nicht als „Required“ neu definiert werden.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "Falta la anotación de tipo para el parámetro \"{name}\"",
"paramAssignmentMismatch": "La expresión de tipo \"{sourceType}\" no se puede asignar al parámetro de tipo \"{paramType}\"",
"paramNameMissing": "Ningún parámetro llamado \"{name}\"",
"paramSpecArgsKwargsDuplicate": "Ya se han proporcionado los argumentos para ParamSpec \"{type}\".",
"paramSpecArgsKwargsUsage": "Los atributos \"args\" y \"kwargs\" de ParamSpec deben aparecer ambos dentro de una firma de función",
"paramSpecArgsMissing": "Faltan argumentos para ParamSpec \"{type}\".",
"paramSpecArgsUsage": "El atributo \"args\" de ParamSpec solo es válido cuando se usa con el parámetro *args.",
Expand Down Expand Up @@ -562,7 +563,7 @@
"typedDictEntryName": "Cadena literal esperada para el nombre de la entrada del diccionario",
"typedDictEntryUnique": "Los nombres dentro de un diccionario deben ser únicos",
"typedDictExtraArgs": "No se admiten argumentos TypedDict adicionales",
"typedDictExtraItemsClosed": "A TypedDict cannot be closed if it supports extra items",
"typedDictExtraItemsClosed": "Un TypedDict no puede tener el estado closed si admite elementos adicionales",
"typedDictFieldNotRequiredRedefinition": "El elemento TypedDict \"{name}\" no se puede redefinir como NotRequired",
"typedDictFieldReadOnlyRedefinition": "El elemento TypedDict \"{name}\" no se puede redefinir como ReadOnly",
"typedDictFieldRequiredRedefinition": "El elemento TypedDict \"{name}\" no se puede redefinir como Required",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "L'annotation de type est manquante pour le paramètre \"{name}\"",
"paramAssignmentMismatch": "L'expression de type \"{sourceType}\" ne peut pas être affectée au paramètre de type \"{paramType}\"",
"paramNameMissing": "Aucun paramètre nommé « {name} »",
"paramSpecArgsKwargsDuplicate": "Des arguments pour ParamSpec « {type} » ont déjà été fournis",
"paramSpecArgsKwargsUsage": "Les attributs « args » et « kwargs » de ParamSpec doivent apparaître tous les deux dans une signature de fonction",
"paramSpecArgsMissing": "Les arguments pour ParamSpec « {type} » sont manquants",
"paramSpecArgsUsage": "L’attribut « args » de ParamSpec n’est valide que lorsqu’il est utilisé avec le paramètre *args",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "Annotazione di tipo mancante per il parametro \"{name}\"",
"paramAssignmentMismatch": "Non è possibile assegnare l'espressione di tipo \"{sourceType}\" al parametro di tipo \"{paramType}\"",
"paramNameMissing": "Nessun parametro denominato \"{name}\"",
"paramSpecArgsKwargsDuplicate": "Gli argomenti per ParamSpec \"{type}\" sono già stati specificati",
"paramSpecArgsKwargsUsage": "Gli attributi \"args\" e \"kwargs\" di ParamSpec devono essere entrambi visualizzati all'interno di una firma di funzione",
"paramSpecArgsMissing": "Gli argomenti per ParamSpec \"{type}\" sono mancanti",
"paramSpecArgsUsage": "L'attributo \"args\" di ParamSpec è valido solo se usato con il parametro *args",
Expand Down Expand Up @@ -562,7 +563,7 @@
"typedDictEntryName": "Valore letterale stringa previsto per il nome della voce del dizionario",
"typedDictEntryUnique": "I nomi all'interno di un dizionario devono essere univoci",
"typedDictExtraArgs": "Argomenti TypedDict aggiuntivi non supportati",
"typedDictExtraItemsClosed": "A TypedDict cannot be closed if it supports extra items",
"typedDictExtraItemsClosed": "TypedDict non può avere il valore “closed” se supporta elementi aggiuntivi",
"typedDictFieldNotRequiredRedefinition": "Non è possibile ridefinire il campo TypedDict \"{name}\" come NotRequired",
"typedDictFieldReadOnlyRedefinition": "Non è possibile ridefinire l’elemento TypedDict \"{name}\" come ReadOnly",
"typedDictFieldRequiredRedefinition": "Non è possibile ridefinire il campo TypedDict \"{name}\" come Required",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "パラメーター \"{name}\" に型注釈がありません",
"paramAssignmentMismatch": "型 \"{sourceType}\" の式を型 \"{paramType}\" のパラメーターに割り当てることはできません",
"paramNameMissing": "\"{name}\" という名前のパラメーターがありません",
"paramSpecArgsKwargsDuplicate": "ParamSpec \"{type}\" の引数は既に指定されています",
"paramSpecArgsKwargsUsage": "ParamSpec の \"args\" 属性と \"kwargs\" 属性の両方が関数シグネチャ内に含まれている必要があります",
"paramSpecArgsMissing": "ParamSpec \"{type}\" の引数がありません",
"paramSpecArgsUsage": "ParamSpec の \"args\" 属性は、*args パラメーターと共に使用する場合にのみ有効です",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "‘{name}’ 매개 변수에 대한 형식 주석이 없습니다.",
"paramAssignmentMismatch": "‘{sourceType}’ 형식의 식을 ‘{paramType}’ 형식의 매개 변수에 할당할 수 없습니다.",
"paramNameMissing": "이름이 \"{name}\"인 매개 변수가 없습니다.",
"paramSpecArgsKwargsDuplicate": "ParamSpec \"{type}\" 인수가 이미 제공되었습니다.",
"paramSpecArgsKwargsUsage": "ParamSpec의 \"args\" 및 \"kwargs\" 특성은 모두 함수 서명 내에 나타나야 함",
"paramSpecArgsMissing": "ParamSpec \"{type}\"에 대한 인수가 없습니다.",
"paramSpecArgsUsage": "ParamSpec의 \"args\" 특성은 *args 매개 변수와 함께 사용할 경우에만 유효함",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "Brak adnotacji typu dla parametru „{name}”",
"paramAssignmentMismatch": "Wyrażenia typu „{sourceType}” nie można przypisać do parametru typu „{paramType}”",
"paramNameMissing": "Brak parametru o nazwie „{name}”",
"paramSpecArgsKwargsDuplicate": "Argumenty parametru ParamSpec „{type}” zostały już podane",
"paramSpecArgsKwargsUsage": "Atrybuty „args” i „kwargs” specyfikacji ParamSpec muszą znajdować się w sygnaturze funkcji",
"paramSpecArgsMissing": "Brak argumentów dla parametru ParamSpec „{type}”.",
"paramSpecArgsUsage": "Atrybut „args” parametru ParamSpec jest ważna tylko wtedy, gdy jest używana z parametrem *args",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "A anotação de tipo está ausente para o parâmetro \"{name}\"",
"paramAssignmentMismatch": "A expressão do tipo \"{sourceType}\" não pode ser atribuída ao parâmetro do tipo \"{paramType}\"",
"paramNameMissing": "Nenhum parâmetro chamado \"{name}\"",
"paramSpecArgsKwargsDuplicate": "Os argumentos para ParamSpec \"{type}\" já foram fornecidos",
"paramSpecArgsKwargsUsage": "Os atributos \"args\" e \"kwargs\" de ParamSpec devem aparecer dentro de uma assinatura de função",
"paramSpecArgsMissing": "Argumentos para ParamSpec \"{type}\" estão ausentes",
"paramSpecArgsUsage": "O atributo \"args\" de ParamSpec é válido somente quando usado com o parâmetro *args",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"paramAnnotationMissing": "[1OYGc][นั้Tÿpë æññøtætïøñ ïs mïssïñg før pæræmëtër \"{ñæmë}\"Ấğ倪İЂҰक्र्तिृまẤğ倪İЂҰนั้ढूँ]",
"paramAssignmentMismatch": "[Q8zha][นั้Ëxprëssïøñ øf tÿpë \"{søµrçëTÿpë}\" çæññøt þë æssïgñëð tø pæræmëtër øf tÿpë \"{pæræmTÿpë}\"Ấğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्นั้ढूँ]",
"paramNameMissing": "[ivXu4][นั้Ñø pæræmëtër ñæmëð \"{ñæmë}\"Ấğ倪İЂҰक्र्तिृนั้ढूँ]",
"paramSpecArgsKwargsDuplicate": "[4Ie64][นั้Ærgµmëñts før ParamSpec \"{tÿpë}\" hævë ælrëæðÿ þëëñ prøvïðëðẤğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्र्นั้ढूँ]",
"paramSpecArgsKwargsUsage": "[oVRV0][นั้\"args\" æñð \"kwargs\" ættrïþµtës øf ParamSpec mµst þøth æppëær wïthïñ æ fµñçtïøñ sïgñætµrëẤğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्นั้ढूँ]",
"paramSpecArgsMissing": "[rd6zO][นั้Ærgµmëñts før ParamSpec \"{tÿpë}\" ærë mïssïñgẤğ倪İЂҰक्र्तिृまẤğ倪İนั้ढूँ]",
"paramSpecArgsUsage": "[2U9SN][นั้\"args\" ættrïþµtë øf ParamSpec ïs vælïð øñlÿ whëñ µsëð wïth *args pæræmëtërẤğ倪İЂҰक्र्तिृまẤğ倪İЂҰक्र्तिृまẤğนั้ढूँ]",
Expand Down
Loading

0 comments on commit e1bb702

Please sign in to comment.