Skip to content

Commit

Permalink
pull-pylance-with-pyright-1.1.393-20250129-175917
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 29, 2025
1 parent 3763156 commit a5dd931
Show file tree
Hide file tree
Showing 18 changed files with 136 additions and 52 deletions.
14 changes: 14 additions & 0 deletions packages/pyright-internal/src/analyzer/parseTreeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2309,6 +2309,20 @@ export function isWriteAccess(node: NameNode) {
return false;
}

export function getMatchingDescendants(node: ParseNode, match: (n: ParseNode) => boolean): ParseNode[] {
const matches: ParseNode[] = [];
const children = getChildNodes(node);
for (const child of children) {
if (child && match(child)) {
matches.push(child);
}
if (child) {
matches.push(...getMatchingDescendants(child, match));
}
}
return matches;
}

export function getModuleNode(node: ParseNode) {
let current: ParseNode | undefined = node;
while (current && current.nodeType !== ParseNodeType.Module) {
Expand Down
5 changes: 5 additions & 0 deletions packages/pyright-internal/src/common/envVarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export function resolvePathWithEnvVariables(
return Uri.parse(normalizeSlashes(expanded, '/'), caseDetector);
}

// Expansion may have failed.
if (expanded.includes('${')) {
return undefined;
}

if (rootUri) {
// normal case, resolve the path against workspace root.
return rootUri.resolvePaths(normalizeSlashes(expanded, '/'));
Expand Down
12 changes: 8 additions & 4 deletions packages/pyright-internal/src/localization/package.nls.cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
"noneNotIterable": "Objekt typu None není možné použít jako iterovatelnou hodnotu",
"noneNotSubscriptable": "Objekt typu “None“ nelze zadat jako dolní index",
"noneNotUsableWith": "Object of type \"None\" cannot be used with \"with\"",
"noneNotUsableWithAsync": "Object of type \"None\" cannot be used with \"async with\"",
"noneNotUsableWithAsync": "Objekt typu None není možné použít s typem async with.",
"noneOperator": "Operátor {operator} se pro None nepodporuje",
"noneUnknownMember": "{name} není známý atribut None.",
"notRequiredArgCount": "Za NotRequired byl očekáván jeden argument typu",
Expand All @@ -365,7 +365,11 @@
"overloadAbstractImplMismatch": "Přetížení musí odpovídat abstraktnímu stavu implementace.",
"overloadAbstractMismatch": "Buď musí být všechna přetížení abstraktní, nebo naopak nesmí být žádné z nich abstraktní.",
"overloadClassMethodInconsistent": "Přetížení pro {name} používají @classmethod nekonzistentně.",
"overloadFinalImpl": "@final decorator should be applied only to the implementation",
"overloadFinalNoImpl": "Only the first overload should be marked @final",
"overloadImplementationMismatch": "Přetížená implementace není konzistentní se signaturou přetížení {index}",
"overloadOverrideImpl": "@override decorator should be applied only to the implementation",
"overloadOverrideNoImpl": "Only the first overload should be marked @override",
"overloadReturnTypeMismatch": "Přetížení {prevIndex} pro {name} se překrývá s přetížením {newIndex} a vrací nekompatibilní typ",
"overloadStaticMethodInconsistent": "Přetížení pro {name} používají @staticmethod nekonzistentně.",
"overloadWithoutImplementation": "„{name}“ je označené jako přetížení (overload), ale není zadaná žádná implementace.",
Expand Down Expand Up @@ -395,7 +399,7 @@
"parenthesizedContextManagerIllegal": "Parentheses within \"with\" statement requires Python 3.9 or newer",
"patternNeverMatches": "Vzor se nikdy nebude shodovat s typem předmětu {type}",
"positionArgAfterNamedArg": "Poziční argument se nemůže objevit za argumenty klíčového slova",
"positionArgAfterUnpackedDictArg": "Positional argument cannot appear after keyword argument unpacking",
"positionArgAfterUnpackedDictArg": "Poziční argument se nemůže objevit po rozbalení argumentu klíčového slova.",
"positionOnlyAfterArgs": "Oddělovač parametrů jen pro pozici není povolený za parametrem *.",
"positionOnlyAfterKeywordOnly": "Parametr / se musí zobrazit před parametrem *",
"positionOnlyAfterNon": "Parametr jen pro pozici není povolený za parametrem, který není jen pro pozici.",
Expand Down Expand Up @@ -519,8 +523,8 @@
"typeNotSupportBinaryOperatorBidirectional": "Operátor {operator} není podporován pro typy „{leftType}“ a „{rightType}“, pokud se očekává typ „{expectedType}“",
"typeNotSupportUnaryOperator": "Operátor {operator} se pro typ {type} nepodporuje",
"typeNotSupportUnaryOperatorBidirectional": "Operátor {operator} není podporován pro typ {type}, když očekávaný typ je {expectedType}",
"typeNotUsableWith": "Object of type \"{type}\" cannot be used with \"with\" because it does not correctly implement {method}",
"typeNotUsableWithAsync": "Object of type \"{type}\" cannot be used with \"async with\" because it does not correctly implement {method}",
"typeNotUsableWith": "Objekt typu {type} není možné použít s typem with, protože neimplementuje správně metodu {method}.",
"typeNotUsableWithAsync": "Objekt typu {type} není možné použít s typem async with, protože neimplementuje správně metodu {method}.",
"typeParameterBoundNotAllowed": "Vazbu nebo omezení nelze použít s parametrem variadického typu ani s parametrem ParamSpec",
"typeParameterConstraintTuple": "Omezení parametru typu musí být řazená kolekce členů dvou nebo více typů",
"typeParameterExistingTypeParameter": "Parametr typu {name} se už používá",
Expand Down
12 changes: 8 additions & 4 deletions packages/pyright-internal/src/localization/package.nls.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
"noneNotIterable": "Ein Objekt vom Typ \"None\" kann nicht als iterierbarer Wert verwendet werden.",
"noneNotSubscriptable": "Das Objekt vom Typ \"None\" kann nicht tiefgestellt werden.",
"noneNotUsableWith": "Object of type \"None\" cannot be used with \"with\"",
"noneNotUsableWithAsync": "Object of type \"None\" cannot be used with \"async with\"",
"noneNotUsableWithAsync": "Das Objekt vom Typ „None“ kann nicht mit „async with“ verwendet werden.",
"noneOperator": "Der Operator \"{operator}\" wird für den \"{None}\" nicht unterstützt.",
"noneUnknownMember": "„{name}“ ist kein bekanntes Attribut von „None“",
"notRequiredArgCount": "Nach \"NotRequired\" wurde ein einzelnes Typargument erwartet.",
Expand All @@ -365,7 +365,11 @@
"overloadAbstractImplMismatch": "Überladungen müssen dem abstrakten Status der Implementierung entsprechen.",
"overloadAbstractMismatch": "Überladungen müssen alle abstrakt sein oder nicht.",
"overloadClassMethodInconsistent": "Überladungen für \"{name}\" verwenden @classmethod inkonsistent",
"overloadFinalImpl": "@final decorator should be applied only to the implementation",
"overloadFinalNoImpl": "Only the first overload should be marked @final",
"overloadImplementationMismatch": "Die überladene Implementierung ist nicht konsistent mit der Signatur der Überladung {index}",
"overloadOverrideImpl": "@override decorator should be applied only to the implementation",
"overloadOverrideNoImpl": "Only the first overload should be marked @override",
"overloadReturnTypeMismatch": "Überladung {prevIndex} für \"{name}\" überlappt {newIndex} und gibt einen inkompatiblen Typ zurück.",
"overloadStaticMethodInconsistent": "Überladungen für \"{name}\" verwenden @staticmethod inkonsistent",
"overloadWithoutImplementation": "\"{name}\" ist als overload markiert, es wurde jedoch keine Implementierung bereitgestellt.",
Expand Down Expand Up @@ -395,7 +399,7 @@
"parenthesizedContextManagerIllegal": "Parentheses within \"with\" statement requires Python 3.9 or newer",
"patternNeverMatches": "Das Muster wird für den Antragstellertyp \"{type}\" nie abgeglichen",
"positionArgAfterNamedArg": "Ein Positionsargument darf nicht nach Schlüsselwortargumenten stehen.",
"positionArgAfterUnpackedDictArg": "Positional argument cannot appear after keyword argument unpacking",
"positionArgAfterUnpackedDictArg": "Das positionelle Argument kann nach dem Entpacken des Schlüsselwortarguments nicht mehr angezeigt werden.",
"positionOnlyAfterArgs": "Das Parametertrennzeichen \"Nur Position\" ist nach dem Parameter \"*\" nicht zulässig.",
"positionOnlyAfterKeywordOnly": "Der Parameter \"/\" muss vor dem Parameter \"*\" stehen.",
"positionOnlyAfterNon": "Der Parameter \"Nur Position\" ist nach einem Parameter, der nicht vom Typ \"Nur Position\" ist, nicht zulässig.",
Expand Down Expand Up @@ -519,8 +523,8 @@
"typeNotSupportBinaryOperatorBidirectional": "Der Operator \"{operator}\" wird für die Typen \"{leftType}\" und \"{rightType}\" nicht unterstützt, wenn der erwartete Typ \"{expectedType}\" ist.",
"typeNotSupportUnaryOperator": "Der Operator \"{operator}\" wird für den Typ \"{type}\" nicht unterstützt.",
"typeNotSupportUnaryOperatorBidirectional": "Der Operator \"{operator}\" wird für den Typ \"{type}\" nicht unterstützt, wenn der erwartete Typ \"{expectedType}\" ist.",
"typeNotUsableWith": "Object of type \"{type}\" cannot be used with \"with\" because it does not correctly implement {method}",
"typeNotUsableWithAsync": "Object of type \"{type}\" cannot be used with \"async with\" because it does not correctly implement {method}",
"typeNotUsableWith": "Das Objekt vom Typ „{type}“ kann nicht mit „with“ verwendet werden, da es {method} nicht ordnungsgemäß implementiert.",
"typeNotUsableWithAsync": "Das Objekt vom Typ „{type}“ kann nicht mit „asynch with“ verwendet werden, da es {method} nicht ordnungsgemäß implementiert.",
"typeParameterBoundNotAllowed": "\"Bound\" oder \"constraint\" kann nicht mit einem variadic-Typparameter oder ParamSpec verwendet werden.",
"typeParameterConstraintTuple": "Die Typparametereinschränkung muss ein Tupel mit mindestens zwei Typen sein.",
"typeParameterExistingTypeParameter": "Der Typparameter \"{name}\" wird bereits verwendet.",
Expand Down
12 changes: 8 additions & 4 deletions packages/pyright-internal/src/localization/package.nls.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
"noneNotIterable": "No se puede utilizar un objeto de tipo \"None\" como valor iterable",
"noneNotSubscriptable": "El objeto de tipo \"None\" no se puede suscribir",
"noneNotUsableWith": "Object of type \"None\" cannot be used with \"with\"",
"noneNotUsableWithAsync": "Object of type \"None\" cannot be used with \"async with\"",
"noneNotUsableWithAsync": "El objeto de tipo \"None\" no se puede usar con \"async with\"",
"noneOperator": "El operador \"{operator}\" no es compatible con \"None\".",
"noneUnknownMember": "\"{name}\" no es un atributo conocido de \"None\"",
"notRequiredArgCount": "Se esperaba un único argumento de tipo después de \"NotRequired\".",
Expand All @@ -365,7 +365,11 @@
"overloadAbstractImplMismatch": "Las sobrecargas deben coincidir con el estado abstracto de la implementación",
"overloadAbstractMismatch": "Todos los métodos sobrecargados deben ser abstractos o no",
"overloadClassMethodInconsistent": "Las sobrecargas de \"{name}\" usan @classmethod de forma incoherente",
"overloadFinalImpl": "@final decorator should be applied only to the implementation",
"overloadFinalNoImpl": "Only the first overload should be marked @final",
"overloadImplementationMismatch": "La implementación de la sobrecarga no es consistente con la firma de la sobrecarga {index}",
"overloadOverrideImpl": "@override decorator should be applied only to the implementation",
"overloadOverrideNoImpl": "Only the first overload should be marked @override",
"overloadReturnTypeMismatch": "La sobrecarga {prevIndex} para \" {name}\" se superpone con la sobrecarga {newIndex} y devuelve un tipo incompatible",
"overloadStaticMethodInconsistent": "Las sobrecargas de \"{name}\" usan @staticmethod de forma incoherente",
"overloadWithoutImplementation": "\"{name}\" está marcado como overload, pero no se proporciona ninguna implementación.",
Expand Down Expand Up @@ -395,7 +399,7 @@
"parenthesizedContextManagerIllegal": "Parentheses within \"with\" statement requires Python 3.9 or newer",
"patternNeverMatches": "El patrón nunca coincidirá para el tipo de asunto \"{type}\"",
"positionArgAfterNamedArg": "El argumento posicional no puede aparecer después de los argumentos de palabra clave",
"positionArgAfterUnpackedDictArg": "Positional argument cannot appear after keyword argument unpacking",
"positionArgAfterUnpackedDictArg": "El argumento posicional no puede aparecer después de desempaquetar el argumento de palabra clave",
"positionOnlyAfterArgs": "No se permite el separador de parámetros de un solo puesto después del parámetro \"*\".",
"positionOnlyAfterKeywordOnly": "El parámetro \"/\" debe aparecer antes del parámetro \"*\".",
"positionOnlyAfterNon": "Parámetro de un solo puesto no permitido después del parámetro que no es de solo posición",
Expand Down Expand Up @@ -519,8 +523,8 @@
"typeNotSupportBinaryOperatorBidirectional": "No se admite el operador \"{operator}\" para los tipos \"{leftType}\" y \"{rightType}\" cuando el tipo esperado es \"{expectedType}\"",
"typeNotSupportUnaryOperator": "El operador \"{operator}\" no se admite para el tipo \"{type}\"",
"typeNotSupportUnaryOperatorBidirectional": "Operador \"{operator}\" no admitido para el tipo \"{type}\" cuando el tipo esperado es \"{expectedType}\"",
"typeNotUsableWith": "Object of type \"{type}\" cannot be used with \"with\" because it does not correctly implement {method}",
"typeNotUsableWithAsync": "Object of type \"{type}\" cannot be used with \"async with\" because it does not correctly implement {method}",
"typeNotUsableWith": "El objeto de tipo \"{type}\" no se puede usar con \"with\" porque no implementa correctamente {method}",
"typeNotUsableWithAsync": "El objeto de tipo \"{type}\" no se puede usar con \"async with\" porque no implementa correctamente {method}",
"typeParameterBoundNotAllowed": "No se pueden usar límites o restricciones con un parámetro de tipo variádico o ParamSpec",
"typeParameterConstraintTuple": "La restricción del parámetro de tipo debe ser una tupla de dos o más tipos",
"typeParameterExistingTypeParameter": "El parámetro de tipo \"{name}\" ya está en uso",
Expand Down
12 changes: 8 additions & 4 deletions packages/pyright-internal/src/localization/package.nls.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
"noneNotIterable": "L’objet de type « None » ne peut pas être utilisé en tant que valeur itérable",
"noneNotSubscriptable": "L’objet de type « None » n’est pas inscriptible",
"noneNotUsableWith": "Object of type \"None\" cannot be used with \"with\"",
"noneNotUsableWithAsync": "Object of type \"None\" cannot be used with \"async with\"",
"noneNotUsableWithAsync": "L’objet de type « None » ne peut pas être utilisé avec « async with »",
"noneOperator": "L’opérateur « {operator} » n’est pas pris en charge pour « None »",
"noneUnknownMember": "« {name} » n’est pas un attribut connu de « None »",
"notRequiredArgCount": "Argument de type unique attendu après « NotRequired »",
Expand All @@ -365,7 +365,11 @@
"overloadAbstractImplMismatch": "Les surcharges doivent correspondre à l’état abstrait de l’implémentation",
"overloadAbstractMismatch": "Les surcharges doivent toutes être abstraites ou non",
"overloadClassMethodInconsistent": "Les surcharges pour « {name} » utilisent @classmethod de manière incohérente",
"overloadFinalImpl": "@final decorator should be applied only to the implementation",
"overloadFinalNoImpl": "Only the first overload should be marked @final",
"overloadImplementationMismatch": "L’implémentation surchargée n’est pas cohérente avec la signature de la surcharge {index}",
"overloadOverrideImpl": "@override decorator should be applied only to the implementation",
"overloadOverrideNoImpl": "Only the first overload should be marked @override",
"overloadReturnTypeMismatch": "La surcharge {prevIndex} pour « {name} » chevauche la surcharge {newIndex} et retourne un type incompatible",
"overloadStaticMethodInconsistent": "Les surcharges pour « {name} » utilisent @staticmethod de manière incohérente",
"overloadWithoutImplementation": "« {name} » est marqué comme overload, mais aucune implémentation n’est fournie",
Expand Down Expand Up @@ -395,7 +399,7 @@
"parenthesizedContextManagerIllegal": "Parentheses within \"with\" statement requires Python 3.9 or newer",
"patternNeverMatches": "Le modèle ne sera jamais mis en correspondance pour le type d’objet « {type} »",
"positionArgAfterNamedArg": "L’argument positionnel ne peut pas apparaître après les arguments de mot clé",
"positionArgAfterUnpackedDictArg": "Positional argument cannot appear after keyword argument unpacking",
"positionArgAfterUnpackedDictArg": "L’argument positionnel ne peut pas apparaître après la décompression d’argument de mot clé",
"positionOnlyAfterArgs": "Séparateur de paramètres de position seule non autorisé après le paramètre « * »",
"positionOnlyAfterKeywordOnly": "Le paramètre « / » doit apparaître avant le paramètre « * »",
"positionOnlyAfterNon": "Paramètre de position seule non autorisé après un paramètre qui n’est pas en position seule",
Expand Down Expand Up @@ -519,8 +523,8 @@
"typeNotSupportBinaryOperatorBidirectional": "L'opérateur \"{operator}\" n'est pas pris en charge pour les types \"{leftType}\" et \"{rightType}\" lorsque le type attendu est \"{expectedType}\"",
"typeNotSupportUnaryOperator": "L'opérateur \"{operator}\" n'est pas pris en charge pour le type \"{type}\"",
"typeNotSupportUnaryOperatorBidirectional": "L’opérateur « {operator} » n’est pas pris en charge pour le type « {type} » quand le type attendu est « {expectedType} »",
"typeNotUsableWith": "Object of type \"{type}\" cannot be used with \"with\" because it does not correctly implement {method}",
"typeNotUsableWithAsync": "Object of type \"{type}\" cannot be used with \"async with\" because it does not correctly implement {method}",
"typeNotUsableWith": "L’objet de type « {type} » ne peut pas être utilisé avec « with », car il n’implémente pas correctement {method}",
"typeNotUsableWithAsync": "L’objet de type « {type} » ne peut pas être utilisé avec « async with », car il n’implémente pas correctement {method}",
"typeParameterBoundNotAllowed": "La limite ou la contrainte ne peut pas être utilisée avec un paramètre de type variadique ou ParamSpec",
"typeParameterConstraintTuple": "La contrainte de paramètre de type doit être un tuple de plusieurs types",
"typeParameterExistingTypeParameter": "Le paramètre de type « {name} » est déjà utilisé",
Expand Down
Loading

0 comments on commit a5dd931

Please sign in to comment.