basedpyright 1.34.0__py3-none-any.whl → 1.35.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93695,6 +93695,95 @@ class TypeInlayHintsWalker extends parseTreeWalker_1.ParseTreeWalker {
93695
93695
  exports.TypeInlayHintsWalker = TypeInlayHintsWalker;
93696
93696
 
93697
93697
 
93698
+ /***/ }),
93699
+
93700
+ /***/ "../pyright-internal/src/analyzer/typeNameUtils.ts":
93701
+ /*!*********************************************************!*\
93702
+ !*** ../pyright-internal/src/analyzer/typeNameUtils.ts ***!
93703
+ \*********************************************************/
93704
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
93705
+
93706
+ "use strict";
93707
+
93708
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
93709
+ exports.getLocalTypeNames = getLocalTypeNames;
93710
+ exports.getNestedClassNameParts = getNestedClassNameParts;
93711
+ const types_1 = __webpack_require__(/*! ./types */ "../pyright-internal/src/analyzer/types.ts");
93712
+ function handleSymbolTable(evaluator, type, symbolTable) {
93713
+ const getFullName = (t) => ((0, types_1.isClass)(t) ? t.shared.fullName : t.priv.moduleName);
93714
+ const fullName = getFullName(type);
93715
+ // The symbols in symbolTable whose type is a non-instance class or a module
93716
+ const symbols = [];
93717
+ symbolTable.forEach((symbol, symbolName) => {
93718
+ const symbolType = evaluator.getEffectiveTypeOfSymbol(symbol);
93719
+ if (((0, types_1.isClass)(symbolType) && !types_1.TypeBase.isInstance(symbolType)) || (0, types_1.isModule)(symbolType)) {
93720
+ symbols.push({ type: symbolType, localName: symbolName, fullName: getFullName(symbolType) });
93721
+ }
93722
+ });
93723
+ // If there are symbols whose type has the same full name as `type`, return these
93724
+ const exactMatches = symbols.filter((symbolInfo) => symbolInfo.fullName === fullName);
93725
+ if (exactMatches.length > 0)
93726
+ return exactMatches.map((symbolInfo) => symbolInfo.localName);
93727
+ // If there are no full matches, try to find types whose name is a prefix to `type`’s full name
93728
+ // and then recursively try to find a symbol with `type`’s full type.
93729
+ return symbols
93730
+ .filter((symbolInfo) => fullName.startsWith(symbolInfo.fullName))
93731
+ .flatMap((symbolInfo) => handleSymbolTable(evaluator, type, (0, types_1.isClass)(symbolInfo.type) ? types_1.ClassType.getSymbolTable(symbolInfo.type) : symbolInfo.type.priv.fields).map((name) => `${symbolInfo.localName}.${name}`));
93732
+ }
93733
+ /**
93734
+ * Determine the names (potentially including `.`) which can be used to reference `type` within `scope`.
93735
+ *
93736
+ * This function goes through the symbols defined within `scope` and its parent to find classes/modules
93737
+ * whose full name is a prefix of `type`’s full name. For each of these, it recursively searches the symbols
93738
+ * defined in that class/module for other classes/modules whose full name is a prefix of `type`’s full name
93739
+ * until a type with `type`’s full name is found.
93740
+ *
93741
+ * For example, consider the following definition:
93742
+ * ```python
93743
+ * class A:
93744
+ * class B: pass
93745
+ * ```
93746
+ * After this, the type representing `A.B` has the local names `['A.B']`. However, if that definition is
93747
+ * in a different module called `lib`, we have a few different cases for the local names of `A.B`
93748
+ * depending on how `lib`/its members have been imported:
93749
+ * - `import lib`: The local names are `['lib.A.B']`.
93750
+ * - `import lib as mod`: The local names are `['mod.A.B']`.
93751
+ * - `import lib as mod; from lib import A`: The local names are `['mod.A.B', 'A.B']`.
93752
+ * - `import lib as mod; from lib import A as C`: The local names are `['mod.A.B', 'C.B']`.
93753
+ */
93754
+ function getLocalTypeNames(evaluator, type, scope) {
93755
+ const out = [];
93756
+ let currentScope = scope;
93757
+ while (currentScope) {
93758
+ out.push(...handleSymbolTable(evaluator, type, currentScope.symbolTable));
93759
+ currentScope = currentScope.parent;
93760
+ }
93761
+ return out;
93762
+ }
93763
+ /**
93764
+ * Determine the parts names of `type` and its enclosing classes from least to most nested class.
93765
+ *
93766
+ * For example, if class `C` is defined in class `B`, which in turn is defined in class `A`,
93767
+ * this function returns `['A', 'B', 'C']`.
93768
+ *
93769
+ * If there is anything but classes between `type` and the module it is defined in, e.g. if `type`
93770
+ * is defined within a function, this function returns `undefined`.
93771
+ */
93772
+ function getNestedClassNameParts(type) {
93773
+ const parts = [];
93774
+ let enclosingNode = type.shared.declaration ? type.shared.declaration?.node : undefined;
93775
+ while (enclosingNode?.nodeType === 10 /* ParseNodeType.Class */ || enclosingNode?.nodeType === 50 /* ParseNodeType.Suite */) {
93776
+ if (enclosingNode.nodeType === 10 /* ParseNodeType.Class */)
93777
+ parts.push(enclosingNode.d.name.d.value);
93778
+ enclosingNode = enclosingNode.parent;
93779
+ }
93780
+ if (enclosingNode?.nodeType !== 36 /* ParseNodeType.Module */) {
93781
+ return undefined;
93782
+ }
93783
+ return parts.reverse();
93784
+ }
93785
+
93786
+
93698
93787
  /***/ }),
93699
93788
 
93700
93789
  /***/ "../pyright-internal/src/analyzer/typePrinter.ts":
@@ -118274,6 +118363,7 @@ const SymbolNameUtils = __importStar(__webpack_require__(/*! ../analyzer/symbolN
118274
118363
  const symbolUtils_1 = __webpack_require__(/*! ../analyzer/symbolUtils */ "../pyright-internal/src/analyzer/symbolUtils.ts");
118275
118364
  const typedDicts_1 = __webpack_require__(/*! ../analyzer/typedDicts */ "../pyright-internal/src/analyzer/typedDicts.ts");
118276
118365
  const typeDocStringUtils_1 = __webpack_require__(/*! ../analyzer/typeDocStringUtils */ "../pyright-internal/src/analyzer/typeDocStringUtils.ts");
118366
+ const typeNameUtils_1 = __webpack_require__(/*! ../analyzer/typeNameUtils */ "../pyright-internal/src/analyzer/typeNameUtils.ts");
118277
118367
  const typePrinter_1 = __webpack_require__(/*! ../analyzer/typePrinter */ "../pyright-internal/src/analyzer/typePrinter.ts");
118278
118368
  const types_1 = __webpack_require__(/*! ../analyzer/types */ "../pyright-internal/src/analyzer/types.ts");
118279
118369
  const typeUtils_1 = __webpack_require__(/*! ../analyzer/typeUtils */ "../pyright-internal/src/analyzer/typeUtils.ts");
@@ -118359,18 +118449,18 @@ var SortCategory;
118359
118449
  SortCategory[SortCategory["RecentImportModuleName"] = 1] = "RecentImportModuleName";
118360
118450
  // A module name used in an import statement.
118361
118451
  SortCategory[SortCategory["ImportModuleName"] = 2] = "ImportModuleName";
118362
- // A literal string.
118452
+ // A literal value.
118363
118453
  SortCategory[SortCategory["LiteralValue"] = 3] = "LiteralValue";
118454
+ // An enum member.
118455
+ SortCategory[SortCategory["EnumMember"] = 4] = "EnumMember";
118364
118456
  // A named parameter in a call expression.
118365
- SortCategory[SortCategory["NamedParameter"] = 4] = "NamedParameter";
118457
+ SortCategory[SortCategory["NamedParameter"] = 5] = "NamedParameter";
118366
118458
  // A keyword or symbol that was recently used for completion.
118367
- SortCategory[SortCategory["RecentKeywordOrSymbol"] = 5] = "RecentKeywordOrSymbol";
118459
+ SortCategory[SortCategory["RecentKeywordOrSymbol"] = 6] = "RecentKeywordOrSymbol";
118368
118460
  // An auto-import symbol that was recently used for completion.
118369
- SortCategory[SortCategory["RecentAutoImport"] = 6] = "RecentAutoImport";
118461
+ SortCategory[SortCategory["RecentAutoImport"] = 7] = "RecentAutoImport";
118370
118462
  // A keyword in the python syntax.
118371
- SortCategory[SortCategory["Keyword"] = 7] = "Keyword";
118372
- // An enum member.
118373
- SortCategory[SortCategory["EnumMember"] = 8] = "EnumMember";
118463
+ SortCategory[SortCategory["Keyword"] = 8] = "Keyword";
118374
118464
  // A normal symbol.
118375
118465
  SortCategory[SortCategory["NormalSymbol"] = 9] = "NormalSymbol";
118376
118466
  // A symbol that starts with _ or __ (used only when there is
@@ -118711,7 +118801,7 @@ class CompletionProvider {
118711
118801
  ? this.evaluator.resolveAliasDeclaration(primaryDecl, /* resolveLocalNames */ true) ?? primaryDecl
118712
118802
  : undefined;
118713
118803
  const autoImportText = detail.autoImportSource && (this.program.configOptions.autoImportCompletions || this._codeActions)
118714
- ? this.getAutoImportText(name, detail.autoImportSource, detail.autoImportAlias)
118804
+ ? this.getAutoImportText(detail.autoImportName ?? name, detail.autoImportSource, detail.autoImportAlias)
118715
118805
  : undefined;
118716
118806
  let isDeprecated;
118717
118807
  // Are we resolving a completion item? If so, see if this symbol
@@ -118773,10 +118863,12 @@ class CompletionProvider {
118773
118863
  // Handle enum members specially. Enum members normally look like
118774
118864
  // variables, but the are declared using assignment expressions
118775
118865
  // within an enum class.
118776
- if (this._isEnumMember(detail.boundObjectOrClass, name)) {
118866
+ const maybeEnumMember = detail.actualName ?? name;
118867
+ if (this._isEnumMember(detail.boundObjectOrClass, maybeEnumMember)) {
118777
118868
  itemKind = vscode_languageserver_1.CompletionItemKind.EnumMember;
118778
118869
  }
118779
118870
  this.addNameToCompletions(detail.autoImportAlias ?? name, itemKind, priorWord, completionMap, {
118871
+ autoImportName: detail.autoImportName ?? name,
118780
118872
  autoImportText,
118781
118873
  extraCommitChars: detail.extraCommitChars,
118782
118874
  funcParensDisabled: detail.funcParensDisabled,
@@ -118928,8 +119020,8 @@ class CompletionProvider {
118928
119020
  completionItem.detail = detail.itemDetail;
118929
119021
  }
118930
119022
  else if (detail?.autoImportText) {
118931
- // Force auto-import entries to the end.
118932
- completionItem.sortText = this._makeSortText(SortCategory.AutoImport, `${name}.${this._formatInteger(detail.autoImportText.source.length, 2)}.${detail.autoImportText.source}`, detail.autoImportText.importText);
119023
+ // Force auto-import entries to the end unless they are `Enum` members.
119024
+ completionItem.sortText = this._makeSortText(itemKind === vscode_languageserver_1.CompletionItemKind.EnumMember ? SortCategory.EnumMember : SortCategory.AutoImport, `${detail.autoImportName ?? name}.${this._formatInteger(detail.autoImportText.source.length, 2)}.${detail.autoImportText.source}`, detail.autoImportText.importText);
118933
119025
  completionItemData.autoImportText = detail.autoImportText.importText;
118934
119026
  completionItem.detail = exports.autoImportDetail;
118935
119027
  if (detail.autoImportText.source) {
@@ -118953,7 +119045,7 @@ class CompletionProvider {
118953
119045
  else {
118954
119046
  completionItem.sortText = this._makeSortText(SortCategory.NormalSymbol, name);
118955
119047
  }
118956
- completionItemData.symbolLabel = name;
119048
+ completionItemData.symbolLabel = detail?.autoImportName ?? name;
118957
119049
  if (this.options.format === vscode_languageserver_1.MarkupKind.Markdown) {
118958
119050
  let markdownString = '';
118959
119051
  if (detail?.autoImportText) {
@@ -119129,7 +119221,7 @@ class CompletionProvider {
119129
119221
  while (true) {
119130
119222
  (0, cancellationUtils_1.throwIfCancellationRequested)(this.cancellationToken);
119131
119223
  if (curNode.nodeType === 49 /* ParseNodeType.String */) {
119132
- return this._getLiteralCompletions(curNode, offset, priorWord, priorText, postText);
119224
+ return this._getValueCompletions(curNode, offset, priorWord, priorText, postText);
119133
119225
  }
119134
119226
  if (curNode.nodeType === 48 /* ParseNodeType.StringList */ || curNode.nodeType === 30 /* ParseNodeType.FormatString */) {
119135
119227
  return undefined;
@@ -119418,7 +119510,7 @@ class CompletionProvider {
119418
119510
  }
119419
119511
  case 11 /* ErrorExpressionCategory.MissingPattern */:
119420
119512
  case 3 /* ErrorExpressionCategory.MissingIndexOrSlice */: {
119421
- let completionResults = this._getLiteralCompletions(node, offset, priorWord, priorText, postText);
119513
+ let completionResults = this._getValueCompletions(node, offset, priorWord, priorText, postText);
119422
119514
  if (!completionResults) {
119423
119515
  completionResults = this._getExpressionCompletions(node, priorWord, priorText, postText);
119424
119516
  }
@@ -119721,8 +119813,8 @@ class CompletionProvider {
119721
119813
  const parensDisabled = parseNode.parent?.nodeType === 16 /* ParseNodeType.Decorator */;
119722
119814
  this.addAutoImportCompletions(priorWord, similarityLimit, this.options.lazyEdit, completionMap, parensDisabled, parseNode);
119723
119815
  }
119724
- // Add literal values if appropriate.
119725
- this._tryAddLiterals(parseNode, priorWord, priorText, postText, completionMap);
119816
+ // Add values if appropriate.
119817
+ this._tryAddValues(parseNode, priorWord, priorText, postText, completionMap);
119726
119818
  return completionMap;
119727
119819
  }
119728
119820
  _isIndexArgument(node) {
@@ -119750,12 +119842,12 @@ class CompletionProvider {
119750
119842
  if (!atArgument) {
119751
119843
  this._addNamedParameters(signatureInfo, priorWord, completionMap);
119752
119844
  }
119753
- // Add literals that apply to this parameter.
119754
- this._addLiteralValuesForArgument(signatureInfo, priorWord, priorText, postText, completionMap);
119845
+ // Add values that apply to this parameter.
119846
+ this._addLiteralValuesForArgument(parseNode, signatureInfo, priorWord, priorText, postText, completionMap);
119755
119847
  }
119756
119848
  }
119757
119849
  }
119758
- _addLiteralValuesForArgument(signatureInfo, priorWord, priorText, postText, completionMap) {
119850
+ _addLiteralValuesForArgument(node, signatureInfo, priorWord, priorText, postText, completionMap) {
119759
119851
  signatureInfo.signatures.forEach((signature) => {
119760
119852
  if (!signature.activeParam) {
119761
119853
  return undefined;
@@ -119766,22 +119858,114 @@ class CompletionProvider {
119766
119858
  return undefined;
119767
119859
  }
119768
119860
  const paramType = types_1.FunctionType.getParamType(type, paramIndex);
119769
- this._addLiteralValuesForTargetType(paramType, priorWord, priorText, postText, completionMap);
119861
+ this._addValuesForTargetType(node, paramType, priorWord, priorText, postText, completionMap);
119770
119862
  return undefined;
119771
119863
  });
119772
119864
  }
119773
- _addLiteralValuesForTargetType(type, priorWord, priorText, postText, completionMap) {
119774
- const quoteValue = this._getQuoteInfo(priorWord, priorText);
119775
- this._getSubTypesWithLiteralValues(type).forEach((v) => {
119776
- if (types_1.ClassType.isBuiltIn(v, 'str')) {
119777
- const value = (0, typePrinter_1.printLiteralValue)(v, quoteValue.quoteCharacter, undefined);
119778
- if (quoteValue.stringValue === undefined) {
119779
- this.addNameToCompletions(value, vscode_languageserver_1.CompletionItemKind.Constant, priorWord, completionMap, {
119780
- sortText: this._makeSortText(SortCategory.LiteralValue, v.priv.literalValue),
119865
+ _getEnumMemberCompletionsImpl(node, enumType, forEachMember, priorWord, completionMap) {
119866
+ // Try to find names which the type of the left-hand side can be referenced by in the local scope.
119867
+ const scope = (0, scopeUtils_1.getScopeForNode)(node);
119868
+ const localTypeNames = scope ? (0, typeNameUtils_1.getLocalTypeNames)(this.evaluator, enumType, scope) : [];
119869
+ if (localTypeNames.length > 0) {
119870
+ // Add each combination of a local name and a member generated by `forEachMember` as a completion.
119871
+ localTypeNames.forEach((className) => {
119872
+ forEachMember((symbol, name) => {
119873
+ this.addSymbol(`${className}.${name}`, symbol, priorWord, completionMap, {
119874
+ actualName: name,
119875
+ boundObjectOrClass: enumType,
119781
119876
  });
119877
+ });
119878
+ });
119879
+ }
119880
+ else {
119881
+ // `enumType` does not have any local names: Try to add an auto-import completion.
119882
+ const nestedClassNameParts = (0, typeNameUtils_1.getNestedClassNameParts)(enumType);
119883
+ // If `getNestedClassNameParts` returns `undefined`, it was not able to find a way
119884
+ // to import `enumType`, e.g. if `enumType` was defined within a function.
119885
+ if (nestedClassNameParts) {
119886
+ const className = nestedClassNameParts.join('.');
119887
+ // Add an auto-import completion for each member generated by `forEachMember`.
119888
+ // For nested types, the outermost class (the first part in `nestedClassNameParts`)
119889
+ // is imported while the name of the member is prefixed with the combination of all enclosing types.
119890
+ forEachMember((symbol, name) => {
119891
+ this.addSymbol(`${className}.${name}`, symbol, priorWord, completionMap, {
119892
+ actualName: name,
119893
+ autoImportName: nestedClassNameParts[0],
119894
+ autoImportSource: enumType.shared.moduleName,
119895
+ boundObjectOrClass: enumType,
119896
+ });
119897
+ });
119898
+ }
119899
+ }
119900
+ }
119901
+ _getEnumMemberCompletions(node, enumType, memberName, priorWord, completionMap) {
119902
+ const symbol = types_1.ClassType.getSymbolTable(enumType).get(memberName);
119903
+ if (!symbol)
119904
+ return;
119905
+ this._getEnumMemberCompletionsImpl(node, enumType, (callback) => callback(symbol, memberName), priorWord, completionMap);
119906
+ }
119907
+ _getEnumCompletions(node, enumType, priorWord, completionMap) {
119908
+ this._getEnumMemberCompletionsImpl(node, enumType, (callback) => types_1.ClassType.getSymbolTable(enumType).forEach((symbol, name) => {
119909
+ if (this._isEnumMember(enumType, name)) {
119910
+ callback(symbol, name);
119911
+ }
119912
+ }), priorWord, completionMap);
119913
+ }
119914
+ /**
119915
+ * If `type` is a type whose values can be enumerated, or a union of such types, add completions
119916
+ * for the values that `type` can exhibit.
119917
+ * Currently, the values of a string/integer/Boolean/`Enum` literal, `bool`, or `Enum`s are added,
119918
+ * including proper handling of nested classes and auto-imports for `Enum` classes.
119919
+ *
119920
+ * If quotes have already been entered, this function only adds completions for string literals.
119921
+ */
119922
+ _addValuesForTargetType(node, type, priorWord, priorText, postText, completionMap) {
119923
+ const quoteValue = this._getQuoteInfo(priorWord, priorText);
119924
+ // If quotes have already been entered, `stringValue` is defined and we do not add
119925
+ // completions for anything other than string literals.
119926
+ const isString = quoteValue.stringValue !== undefined;
119927
+ (0, typeUtils_1.doForEachSubtype)(type, (v) => {
119928
+ if (!(0, types_1.isClass)(v)) {
119929
+ return;
119930
+ }
119931
+ if ((0, typeUtils_1.isLiteralType)(v)) {
119932
+ if (types_1.ClassType.isBuiltIn(v, 'str')) {
119933
+ const value = (0, typePrinter_1.printLiteralValue)(v, quoteValue.quoteCharacter, undefined);
119934
+ if (quoteValue.stringValue === undefined) {
119935
+ this.addNameToCompletions(value, vscode_languageserver_1.CompletionItemKind.Constant, priorWord, completionMap, {
119936
+ sortText: this._makeSortText(SortCategory.LiteralValue, v.priv.literalValue),
119937
+ });
119938
+ }
119939
+ else {
119940
+ this._addStringLiteralToCompletions(value.substr(1, value.length - 2), quoteValue, postText, completionMap);
119941
+ }
119782
119942
  }
119783
- else {
119784
- this._addStringLiteralToCompletions(value.substr(1, value.length - 2), quoteValue, postText, completionMap);
119943
+ else if (!isString) {
119944
+ if (typeof v.priv.literalValue === 'number' || typeof v.priv.literalValue === 'bigint') {
119945
+ const value = v.priv.literalValue.toString();
119946
+ this.addNameToCompletions(value, vscode_languageserver_1.CompletionItemKind.Constant, priorWord, completionMap, {
119947
+ sortText: this._makeSortText(SortCategory.LiteralValue, value),
119948
+ });
119949
+ }
119950
+ else if (typeof v.priv.literalValue === 'boolean') {
119951
+ const value = v.priv.literalValue ? 'True' : 'False';
119952
+ this.addNameToCompletions(value, vscode_languageserver_1.CompletionItemKind.Constant, priorWord, completionMap, {
119953
+ sortText: this._makeSortText(SortCategory.LiteralValue, value),
119954
+ });
119955
+ }
119956
+ else if (types_1.ClassType.isEnumClass(v) && v.priv.literalValue instanceof types_1.EnumLiteral) {
119957
+ this._getEnumMemberCompletions(node, v, v.priv.literalValue.itemName, priorWord, completionMap);
119958
+ }
119959
+ }
119960
+ }
119961
+ else if (!isString) {
119962
+ if (types_1.ClassType.isEnumClass(v)) {
119963
+ this._getEnumCompletions(node, v, priorWord, completionMap);
119964
+ }
119965
+ else if (types_1.ClassType.isBuiltIn(v, 'bool')) {
119966
+ ['True', 'False'].forEach((value) => this.addNameToCompletions(value, vscode_languageserver_1.CompletionItemKind.Constant, priorWord, completionMap, {
119967
+ sortText: this._makeSortText(SortCategory.LiteralValue, value),
119968
+ }));
119785
119969
  }
119786
119970
  }
119787
119971
  });
@@ -119930,7 +120114,16 @@ class CompletionProvider {
119930
120114
  }
119931
120115
  return Array.from(keys);
119932
120116
  }
119933
- _getLiteralCompletions(parseNode, offset, priorWord, priorText, postText) {
120117
+ /**
120118
+ * Checks whether `type` contains a _categorical_ type, i.e. its type or one of the types
120119
+ * in a union has a limited number of values that can be enumerated as completions.
120120
+ * Currently, this applies to `Literal[…]`, `Enum`, and `bool`.
120121
+ */
120122
+ _containsCategoricalType(type) {
120123
+ return (0, typeUtils_1.someSubtypes)(type, (subType) => (0, types_1.isClassInstance)(subType) &&
120124
+ ((0, typeUtils_1.isLiteralLikeType)(subType) || types_1.ClassType.isEnumClass(subType) || types_1.ClassType.isBuiltIn(subType, 'bool')));
120125
+ }
120126
+ _getValueCompletions(parseNode, offset, priorWord, priorText, postText) {
119934
120127
  if (this.options.triggerCharacter === '"' || this.options.triggerCharacter === "'") {
119935
120128
  if (parseNode.start !== offset - 1) {
119936
120129
  // If completion is triggered by typing " or ', it must be the one that starts a string
@@ -119939,12 +120132,12 @@ class CompletionProvider {
119939
120132
  }
119940
120133
  }
119941
120134
  const completionMap = new CompletionMap();
119942
- if (!this._tryAddLiterals(parseNode, priorWord, priorText, postText, completionMap)) {
120135
+ if (!this._tryAddValues(parseNode, priorWord, priorText, postText, completionMap)) {
119943
120136
  return undefined;
119944
120137
  }
119945
120138
  return completionMap;
119946
120139
  }
119947
- _tryAddLiterals(parseNode, priorWord, priorText, postText, completionMap) {
120140
+ _tryAddValues(parseNode, priorWord, priorText, postText, completionMap) {
119948
120141
  const parentAndChild = getParentSkippingStringList(parseNode);
119949
120142
  if (!parentAndChild) {
119950
120143
  return false;
@@ -119962,8 +120155,8 @@ class CompletionProvider {
119962
120155
  const inCallArg = !!(0, parseTreeUtils_1.getCallNodeAndActiveParamIndex)(parseNode, offset, this.parseResults.tokenizerOutput.tokens);
119963
120156
  if (nodeForExpectedType) {
119964
120157
  const expectedTypeResult = this.evaluator.getExpectedType(nodeForExpectedType);
119965
- if (expectedTypeResult && (0, typeUtils_1.containsLiteralType)(expectedTypeResult.type)) {
119966
- this._addLiteralValuesForTargetType(expectedTypeResult.type, priorWord, priorText, postText, completionMap);
120158
+ if (expectedTypeResult && this._containsCategoricalType(expectedTypeResult.type)) {
120159
+ this._addValuesForTargetType(parseNode, expectedTypeResult.type, priorWord, priorText, postText, completionMap);
119967
120160
  if (!inCallArg) {
119968
120161
  return true;
119969
120162
  }
@@ -120034,8 +120227,8 @@ class CompletionProvider {
120034
120227
  if (comparison.nodeType === 7 /* ParseNodeType.BinaryOperation */ &&
120035
120228
  supportedOperators.includes(comparison.d.operator)) {
120036
120229
  const type = this.evaluator.getType(comparison.d.leftExpr);
120037
- if (type && (0, typeUtils_1.containsLiteralType)(type)) {
120038
- this._addLiteralValuesForTargetType(type, priorWord, priorText, postText, completionMap);
120230
+ if (type && this._containsCategoricalType(type)) {
120231
+ this._addValuesForTargetType(parseNode, type, priorWord, priorText, postText, completionMap);
120039
120232
  return true;
120040
120233
  }
120041
120234
  }
@@ -120044,8 +120237,8 @@ class CompletionProvider {
120044
120237
  if (assignmentExpression.nodeType === 4 /* ParseNodeType.AssignmentExpression */ &&
120045
120238
  assignmentExpression.d.rightExpr === parentAndChild.child) {
120046
120239
  const type = this.evaluator.getType(assignmentExpression.d.name);
120047
- if (type && (0, typeUtils_1.containsLiteralType)(type)) {
120048
- this._addLiteralValuesForTargetType(type, priorWord, priorText, postText, completionMap);
120240
+ if (type && this._containsCategoricalType(type)) {
120241
+ this._addValuesForTargetType(parseNode, type, priorWord, priorText, postText, completionMap);
120049
120242
  return true;
120050
120243
  }
120051
120244
  }
@@ -120059,8 +120252,8 @@ class CompletionProvider {
120059
120252
  caseNode.d.suite === parentAndChild.child &&
120060
120253
  caseNode.parent?.nodeType === 63 /* ParseNodeType.Match */) {
120061
120254
  const type = this.evaluator.getType(caseNode.parent.d.expr);
120062
- if (type && (0, typeUtils_1.containsLiteralType)(type)) {
120063
- this._addLiteralValuesForTargetType(type, priorWord, priorText, postText, completionMap);
120255
+ if (type && this._containsCategoricalType(type)) {
120256
+ this._addValuesForTargetType(parseNode, type, priorWord, priorText, postText, completionMap);
120064
120257
  return true;
120065
120258
  }
120066
120259
  }
@@ -120074,8 +120267,8 @@ class CompletionProvider {
120074
120267
  patternLiteral.parent.parent?.nodeType === 64 /* ParseNodeType.Case */ &&
120075
120268
  patternLiteral.parent.parent.parent?.nodeType === 63 /* ParseNodeType.Match */) {
120076
120269
  const type = this.evaluator.getType(patternLiteral.parent.parent.parent.d.expr);
120077
- if (type && (0, typeUtils_1.containsLiteralType)(type)) {
120078
- this._addLiteralValuesForTargetType(type, priorWord, priorText, postText, completionMap);
120270
+ if (type && this._containsCategoricalType(type)) {
120271
+ this._addValuesForTargetType(parseNode, type, priorWord, priorText, postText, completionMap);
120079
120272
  return true;
120080
120273
  }
120081
120274
  }
@@ -120613,6 +120806,10 @@ class CompletionMap {
120613
120806
  delete(key) {
120614
120807
  return this._completions.delete(key);
120615
120808
  }
120809
+ /** Merges `other` into `this`, i.e. `this` is modified and `other` remains unchanged. */
120810
+ merge(other) {
120811
+ other._completions.forEach((item) => (Array.isArray(item) ? item.forEach((i) => this.set(i)) : this.set(item)));
120812
+ }
120616
120813
  toArray() {
120617
120814
  const items = [];
120618
120815
  this._completions?.forEach((value) => {
@@ -138959,7 +139156,7 @@ exports.PyrightServer = PyrightServer;
138959
139156
  /***/ ((module) => {
138960
139157
 
138961
139158
  "use strict";
138962
- module.exports = "1.34.0";
139159
+ module.exports = "1.35.0";
138963
139160
 
138964
139161
  /***/ }),
138965
139162