@zzzen/pyright-internal 1.2.0-dev.20241215 → 1.2.0-dev.20241222

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.
Files changed (281) hide show
  1. package/dist/analyzer/analysis.js +1 -1
  2. package/dist/analyzer/analysis.js.map +1 -1
  3. package/dist/analyzer/analyzerNodeInfo.js +17 -18
  4. package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
  5. package/dist/analyzer/backgroundAnalysisProgram.js +18 -35
  6. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  7. package/dist/analyzer/binder.js +38 -55
  8. package/dist/analyzer/binder.js.map +1 -1
  9. package/dist/analyzer/checker.js +146 -185
  10. package/dist/analyzer/checker.js.map +1 -1
  11. package/dist/analyzer/codeFlowEngine.js +24 -31
  12. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  13. package/dist/analyzer/constraintSolver.js +23 -24
  14. package/dist/analyzer/constraintSolver.js.map +1 -1
  15. package/dist/analyzer/constraintTracker.js +1 -2
  16. package/dist/analyzer/constraintTracker.js.map +1 -1
  17. package/dist/analyzer/constructorTransform.js +10 -12
  18. package/dist/analyzer/constructorTransform.js.map +1 -1
  19. package/dist/analyzer/constructors.js +14 -19
  20. package/dist/analyzer/constructors.js.map +1 -1
  21. package/dist/analyzer/dataClasses.js +27 -26
  22. package/dist/analyzer/dataClasses.js.map +1 -1
  23. package/dist/analyzer/declarationUtils.js +8 -11
  24. package/dist/analyzer/declarationUtils.js.map +1 -1
  25. package/dist/analyzer/decorators.js +2 -3
  26. package/dist/analyzer/decorators.js.map +1 -1
  27. package/dist/analyzer/docStringConversion.js +6 -8
  28. package/dist/analyzer/docStringConversion.js.map +1 -1
  29. package/dist/analyzer/enums.js +12 -13
  30. package/dist/analyzer/enums.js.map +1 -1
  31. package/dist/analyzer/functionTransform.js +1 -2
  32. package/dist/analyzer/functionTransform.js.map +1 -1
  33. package/dist/analyzer/importResolver.js +18 -27
  34. package/dist/analyzer/importResolver.js.map +1 -1
  35. package/dist/analyzer/importStatementUtils.js +4 -5
  36. package/dist/analyzer/importStatementUtils.js.map +1 -1
  37. package/dist/analyzer/namedTuples.js +6 -7
  38. package/dist/analyzer/namedTuples.js.map +1 -1
  39. package/dist/analyzer/operations.js +14 -17
  40. package/dist/analyzer/operations.js.map +1 -1
  41. package/dist/analyzer/packageTypeVerifier.js +35 -39
  42. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  43. package/dist/analyzer/parameterUtils.js +5 -7
  44. package/dist/analyzer/parameterUtils.js.map +1 -1
  45. package/dist/analyzer/parentDirectoryCache.js +8 -9
  46. package/dist/analyzer/parentDirectoryCache.js.map +1 -1
  47. package/dist/analyzer/parseTreeUtils.js +30 -44
  48. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  49. package/dist/analyzer/parseTreeWalker.js +2 -3
  50. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  51. package/dist/analyzer/patternMatching.js +11 -20
  52. package/dist/analyzer/patternMatching.js.map +1 -1
  53. package/dist/analyzer/program.js +29 -40
  54. package/dist/analyzer/program.js.map +1 -1
  55. package/dist/analyzer/properties.js +7 -8
  56. package/dist/analyzer/properties.js.map +1 -1
  57. package/dist/analyzer/protocols.js +21 -23
  58. package/dist/analyzer/protocols.js.map +1 -1
  59. package/dist/analyzer/pythonPathUtils.js +1 -1
  60. package/dist/analyzer/pythonPathUtils.js.map +1 -1
  61. package/dist/analyzer/scope.js +10 -10
  62. package/dist/analyzer/scope.js.map +1 -1
  63. package/dist/analyzer/service.js +32 -47
  64. package/dist/analyzer/service.js.map +1 -1
  65. package/dist/analyzer/sourceFile.js +21 -26
  66. package/dist/analyzer/sourceFile.js.map +1 -1
  67. package/dist/analyzer/sourceFileInfo.js +2 -3
  68. package/dist/analyzer/sourceFileInfo.js.map +1 -1
  69. package/dist/analyzer/sourceFileInfoUtils.js +5 -5
  70. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  71. package/dist/analyzer/sourceMapper.js +19 -30
  72. package/dist/analyzer/sourceMapper.js.map +1 -1
  73. package/dist/analyzer/testWalker.js +1 -2
  74. package/dist/analyzer/testWalker.js.map +1 -1
  75. package/dist/analyzer/tracePrinter.js +7 -9
  76. package/dist/analyzer/tracePrinter.js.map +1 -1
  77. package/dist/analyzer/tuples.js +11 -13
  78. package/dist/analyzer/tuples.js.map +1 -1
  79. package/dist/analyzer/typeCacheUtils.js +5 -6
  80. package/dist/analyzer/typeCacheUtils.js.map +1 -1
  81. package/dist/analyzer/typeDocStringUtils.js +7 -11
  82. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  83. package/dist/analyzer/typeEvaluator.js +618 -776
  84. package/dist/analyzer/typeEvaluator.js.map +1 -1
  85. package/dist/analyzer/typeEvaluatorTypes.d.ts +1 -1
  86. package/dist/analyzer/typeEvaluatorWithTracker.js +2 -2
  87. package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
  88. package/dist/analyzer/typeGuards.js +26 -36
  89. package/dist/analyzer/typeGuards.js.map +1 -1
  90. package/dist/analyzer/typePrinter.js +15 -24
  91. package/dist/analyzer/typePrinter.js.map +1 -1
  92. package/dist/analyzer/typeStubWriter.js +1 -2
  93. package/dist/analyzer/typeStubWriter.js.map +1 -1
  94. package/dist/analyzer/typeUtils.js +65 -94
  95. package/dist/analyzer/typeUtils.js.map +1 -1
  96. package/dist/analyzer/typeWalker.js +4 -8
  97. package/dist/analyzer/typeWalker.js.map +1 -1
  98. package/dist/analyzer/typedDicts.js +39 -46
  99. package/dist/analyzer/typedDicts.js.map +1 -1
  100. package/dist/analyzer/types.js +64 -103
  101. package/dist/analyzer/types.js.map +1 -1
  102. package/dist/backgroundAnalysis.js +2 -3
  103. package/dist/backgroundAnalysis.js.map +1 -1
  104. package/dist/backgroundAnalysisBase.js +9 -10
  105. package/dist/backgroundAnalysisBase.js.map +1 -1
  106. package/dist/backgroundThreadBase.js +6 -7
  107. package/dist/backgroundThreadBase.js.map +1 -1
  108. package/dist/commands/createTypeStub.js +1 -1
  109. package/dist/commands/createTypeStub.js.map +1 -1
  110. package/dist/commands/dumpFileDebugInfoCommand.js +3 -3
  111. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  112. package/dist/commands/quickActionCommand.js +1 -1
  113. package/dist/commands/quickActionCommand.js.map +1 -1
  114. package/dist/common/asyncInitialization.js +1 -1
  115. package/dist/common/chokidarFileWatcherProvider.js +2 -4
  116. package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
  117. package/dist/common/configOptions.js +6 -9
  118. package/dist/common/configOptions.js.map +1 -1
  119. package/dist/common/console.js +1 -2
  120. package/dist/common/console.js.map +1 -1
  121. package/dist/common/core.js +2 -2
  122. package/dist/common/core.js.map +1 -1
  123. package/dist/common/crypto.js +1 -1
  124. package/dist/common/crypto.js.map +1 -1
  125. package/dist/common/diagnostic.js +3 -5
  126. package/dist/common/diagnostic.js.map +1 -1
  127. package/dist/common/envVarUtils.js +1 -1
  128. package/dist/common/envVarUtils.js.map +1 -1
  129. package/dist/common/extensibility.d.ts +1 -0
  130. package/dist/common/extensibility.js.map +1 -1
  131. package/dist/common/fileSystem.d.ts +1 -0
  132. package/dist/common/fileSystem.js.map +1 -1
  133. package/dist/common/fullAccessHost.js +5 -5
  134. package/dist/common/fullAccessHost.js.map +1 -1
  135. package/dist/common/host.js +1 -1
  136. package/dist/common/host.js.map +1 -1
  137. package/dist/common/logTracker.js +1 -1
  138. package/dist/common/logTracker.js.map +1 -1
  139. package/dist/common/lspUtils.js +1 -2
  140. package/dist/common/lspUtils.js.map +1 -1
  141. package/dist/common/progressReporter.js +1 -2
  142. package/dist/common/progressReporter.js.map +1 -1
  143. package/dist/common/realFileSystem.js +2 -3
  144. package/dist/common/realFileSystem.js.map +1 -1
  145. package/dist/common/serviceProvider.js +1 -1
  146. package/dist/common/serviceProvider.js.map +1 -1
  147. package/dist/common/textEditTracker.js +4 -6
  148. package/dist/common/textEditTracker.js.map +1 -1
  149. package/dist/common/tomlUtils.js +3 -1
  150. package/dist/common/tomlUtils.js.map +1 -1
  151. package/dist/common/uri/baseUri.js +1 -1
  152. package/dist/common/uri/baseUri.js.map +1 -1
  153. package/dist/common/uri/emptyUri.js +1 -1
  154. package/dist/common/uri/emptyUri.js.map +1 -1
  155. package/dist/common/uri/fileUri.js +2 -2
  156. package/dist/common/uri/fileUri.js.map +1 -1
  157. package/dist/common/uri/memoization.js +1 -1
  158. package/dist/common/uri/memoization.js.map +1 -1
  159. package/dist/common/uri/uri.js +2 -3
  160. package/dist/common/uri/uri.js.map +1 -1
  161. package/dist/common/uri/uriUtils.js +6 -8
  162. package/dist/common/uri/uriUtils.js.map +1 -1
  163. package/dist/common/uri/webUri.js +2 -2
  164. package/dist/common/uri/webUri.js.map +1 -1
  165. package/dist/common/workspaceEditUtils.js +10 -15
  166. package/dist/common/workspaceEditUtils.js.map +1 -1
  167. package/dist/languageServerBase.js +34 -42
  168. package/dist/languageServerBase.js.map +1 -1
  169. package/dist/languageService/analyzerServiceExecutor.js +8 -10
  170. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  171. package/dist/languageService/autoImporter.js +16 -19
  172. package/dist/languageService/autoImporter.js.map +1 -1
  173. package/dist/languageService/callHierarchyProvider.js +6 -11
  174. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  175. package/dist/languageService/completionProvider.js +81 -106
  176. package/dist/languageService/completionProvider.js.map +1 -1
  177. package/dist/languageService/completionProviderUtils.js +3 -3
  178. package/dist/languageService/completionProviderUtils.js.map +1 -1
  179. package/dist/languageService/definitionProvider.js +6 -9
  180. package/dist/languageService/definitionProvider.js.map +1 -1
  181. package/dist/languageService/documentSymbolCollector.js +32 -32
  182. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  183. package/dist/languageService/dynamicFeature.js +1 -2
  184. package/dist/languageService/dynamicFeature.js.map +1 -1
  185. package/dist/languageService/hoverProvider.js +17 -23
  186. package/dist/languageService/hoverProvider.js.map +1 -1
  187. package/dist/languageService/referencesProvider.js +4 -9
  188. package/dist/languageService/referencesProvider.js.map +1 -1
  189. package/dist/languageService/renameProvider.js +2 -4
  190. package/dist/languageService/renameProvider.js.map +1 -1
  191. package/dist/languageService/signatureHelpProvider.js +11 -15
  192. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  193. package/dist/languageService/tooltipUtils.js +15 -17
  194. package/dist/languageService/tooltipUtils.js.map +1 -1
  195. package/dist/localization/localize.js +3 -3
  196. package/dist/localization/localize.js.map +1 -1
  197. package/dist/localization/package.nls.cs.json +6 -0
  198. package/dist/localization/package.nls.de.json +6 -0
  199. package/dist/localization/package.nls.en-us.json +8 -8
  200. package/dist/localization/package.nls.es.json +6 -0
  201. package/dist/localization/package.nls.fr.json +7 -1
  202. package/dist/localization/package.nls.it.json +6 -0
  203. package/dist/localization/package.nls.ja.json +6 -0
  204. package/dist/localization/package.nls.ko.json +6 -0
  205. package/dist/localization/package.nls.pl.json +6 -0
  206. package/dist/localization/package.nls.pt-br.json +6 -0
  207. package/dist/localization/package.nls.qps-ploc.json +6 -0
  208. package/dist/localization/package.nls.ru.json +6 -0
  209. package/dist/localization/package.nls.tr.json +6 -0
  210. package/dist/localization/package.nls.zh-cn.json +6 -0
  211. package/dist/localization/package.nls.zh-tw.json +6 -0
  212. package/dist/parser/parser.js +30 -38
  213. package/dist/parser/parser.js.map +1 -1
  214. package/dist/parser/tokenizer.js +8 -13
  215. package/dist/parser/tokenizer.js.map +1 -1
  216. package/dist/pprof/profiler.js +3 -3
  217. package/dist/pprof/profiler.js.map +1 -1
  218. package/dist/pyright.js +5 -7
  219. package/dist/pyright.js.map +1 -1
  220. package/dist/pyrightFileSystem.js +4 -5
  221. package/dist/pyrightFileSystem.js.map +1 -1
  222. package/dist/readonlyAugmentedFileSystem.js +3 -5
  223. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  224. package/dist/server.js +1 -1
  225. package/dist/server.js.map +1 -1
  226. package/dist/tests/chainedSourceFiles.test.js +3 -3
  227. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  228. package/dist/tests/classDeclaration.test.js +7 -10
  229. package/dist/tests/classDeclaration.test.js.map +1 -1
  230. package/dist/tests/completions.test.js +3 -3
  231. package/dist/tests/completions.test.js.map +1 -1
  232. package/dist/tests/config.test.js +10 -15
  233. package/dist/tests/config.test.js.map +1 -1
  234. package/dist/tests/diagnosticOverrides.test.js +4 -6
  235. package/dist/tests/diagnosticOverrides.test.js.map +1 -1
  236. package/dist/tests/envVarUtils.test.js +9 -12
  237. package/dist/tests/envVarUtils.test.js.map +1 -1
  238. package/dist/tests/harness/fourslash/testLanguageService.js +1 -1
  239. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  240. package/dist/tests/harness/fourslash/testState.js +45 -60
  241. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  242. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +6 -7
  243. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
  244. package/dist/tests/harness/vfs/filesystem.js +3 -3
  245. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  246. package/dist/tests/importResolver.test.js +6 -7
  247. package/dist/tests/importResolver.test.js.map +1 -1
  248. package/dist/tests/importStatementUtils.test.js +2 -2
  249. package/dist/tests/importStatementUtils.test.js.map +1 -1
  250. package/dist/tests/ipythonMode.test.js +11 -12
  251. package/dist/tests/ipythonMode.test.js.map +1 -1
  252. package/dist/tests/languageServer.test.js +1 -2
  253. package/dist/tests/languageServer.test.js.map +1 -1
  254. package/dist/tests/lsp/languageServer.js +10 -14
  255. package/dist/tests/lsp/languageServer.js.map +1 -1
  256. package/dist/tests/lsp/languageServerTestUtils.js +10 -14
  257. package/dist/tests/lsp/languageServerTestUtils.js.map +1 -1
  258. package/dist/tests/parseTreeUtils.test.js +7 -7
  259. package/dist/tests/parseTreeUtils.test.js.map +1 -1
  260. package/dist/tests/parser.test.js +2 -2
  261. package/dist/tests/parser.test.js.map +1 -1
  262. package/dist/tests/service.test.js +2 -3
  263. package/dist/tests/service.test.js.map +1 -1
  264. package/dist/tests/sourceFile.test.js +2 -3
  265. package/dist/tests/sourceFile.test.js.map +1 -1
  266. package/dist/tests/sourceMapperUtils.test.js +3 -4
  267. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  268. package/dist/tests/testState.test.js +3 -6
  269. package/dist/tests/testState.test.js.map +1 -1
  270. package/dist/tests/testStateUtils.js +3 -4
  271. package/dist/tests/testStateUtils.js.map +1 -1
  272. package/dist/tests/textEditUtil.test.js +2 -2
  273. package/dist/tests/textEditUtil.test.js.map +1 -1
  274. package/dist/tests/typeEvaluator1.test.js +1 -1
  275. package/dist/tests/typePrinter.test.js +1 -2
  276. package/dist/tests/typePrinter.test.js.map +1 -1
  277. package/dist/tests/workspaceEditUtils.test.js +3 -5
  278. package/dist/tests/workspaceEditUtils.test.js.map +1 -1
  279. package/dist/workspaceFactory.js +2 -3
  280. package/dist/workspaceFactory.js.map +1 -1
  281. package/package.json +1 -1
@@ -106,7 +106,6 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
106
106
  this._fileInfo = fileInfo;
107
107
  }
108
108
  bindModule(node) {
109
- var _a;
110
109
  // We'll assume that if there is no builtins scope provided, we must be
111
110
  // binding the builtins module itself.
112
111
  const isBuiltInModule = this._fileInfo.builtinsScope === undefined;
@@ -141,8 +140,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
141
140
  // Use the __all__ list to determine whether any potential private
142
141
  // symbols should be made externally hidden or private.
143
142
  this._potentialHiddenSymbols.forEach((symbol, name) => {
144
- var _a;
145
- if (!((_a = this._dunderAllNames) === null || _a === void 0 ? void 0 : _a.some((sym) => sym === name))) {
143
+ if (!this._dunderAllNames?.some((sym) => sym === name)) {
146
144
  if (this._fileInfo.isStubFile) {
147
145
  symbol.setIsExternallyHidden();
148
146
  }
@@ -152,8 +150,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
152
150
  }
153
151
  });
154
152
  this._potentialPrivateSymbols.forEach((symbol, name) => {
155
- var _a;
156
- if (!((_a = this._dunderAllNames) === null || _a === void 0 ? void 0 : _a.some((sym) => sym === name))) {
153
+ if (!this._dunderAllNames?.some((sym) => sym === name)) {
157
154
  symbol.setIsPrivateMember();
158
155
  }
159
156
  });
@@ -171,7 +168,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
171
168
  const scope = AnalyzerNodeInfo.getScope(node);
172
169
  if (scope && this._dunderAllNames) {
173
170
  for (const name of this._dunderAllNames) {
174
- (_a = scope.symbolTable.get(name)) === null || _a === void 0 ? void 0 : _a.setIsInDunderAll();
171
+ scope.symbolTable.get(name)?.setIsInDunderAll();
175
172
  }
176
173
  }
177
174
  }
@@ -236,7 +233,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
236
233
  typeParamScope = AnalyzerNodeInfo.getScope(node.d.typeParams);
237
234
  }
238
235
  this.walkMultiple(node.d.arguments);
239
- this._createNewScope(3 /* ScopeType.Class */, typeParamScope !== null && typeParamScope !== void 0 ? typeParamScope : this._getNonClassParentScope(),
236
+ this._createNewScope(3 /* ScopeType.Class */, typeParamScope ?? this._getNonClassParentScope(),
240
237
  /* proxyScope */ undefined, () => {
241
238
  AnalyzerNodeInfo.setScope(node, this._currentScope);
242
239
  this._addImplicitSymbolToCurrentScope('__doc__', node, 'str | None');
@@ -303,7 +300,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
303
300
  }
304
301
  // Don't walk the body of the function until we're done analyzing
305
302
  // the current scope.
306
- this._createNewScope(2 /* ScopeType.Function */, typeParamScope !== null && typeParamScope !== void 0 ? typeParamScope : this._getNonClassParentScope(),
303
+ this._createNewScope(2 /* ScopeType.Function */, typeParamScope ?? this._getNonClassParentScope(),
307
304
  /* proxyScope */ undefined, () => {
308
305
  AnalyzerNodeInfo.setScope(node, this._currentScope);
309
306
  const enclosingClass = ParseTreeUtils.getEnclosingClass(node);
@@ -399,7 +396,6 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
399
396
  return false;
400
397
  }
401
398
  visitCall(node) {
402
- var _a, _b;
403
399
  this._disableTrueFalseTargets(() => {
404
400
  this.walk(node.d.leftExpr);
405
401
  const sortedArgs = ParseTreeUtils.getArgsByRuntimeOrder(node);
@@ -435,12 +431,11 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
435
431
  // Is this a call to "__all__.extend([<list>])"?
436
432
  if (argExpr.nodeType === 34 /* ParseNodeType.List */) {
437
433
  if (argExpr.d.items.every((listEntryNode) => {
438
- var _a, _b;
439
434
  if (listEntryNode.nodeType === 48 /* ParseNodeType.StringList */ &&
440
435
  listEntryNode.d.strings.length === 1 &&
441
436
  listEntryNode.d.strings[0].nodeType === 49 /* ParseNodeType.String */) {
442
- (_a = this._dunderAllNames) === null || _a === void 0 ? void 0 : _a.push(listEntryNode.d.strings[0].d.value);
443
- (_b = this._dunderAllStringNodes) === null || _b === void 0 ? void 0 : _b.push(listEntryNode.d.strings[0]);
437
+ this._dunderAllNames?.push(listEntryNode.d.strings[0].d.value);
438
+ this._dunderAllStringNodes?.push(listEntryNode.d.strings[0]);
444
439
  return true;
445
440
  }
446
441
  return false;
@@ -455,8 +450,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
455
450
  const namesToAdd = this._getDunderAllNamesFromImport(argExpr.d.leftExpr.d.value);
456
451
  if (namesToAdd && namesToAdd.length > 0) {
457
452
  namesToAdd.forEach((name) => {
458
- var _a;
459
- (_a = this._dunderAllNames) === null || _a === void 0 ? void 0 : _a.push(name);
453
+ this._dunderAllNames?.push(name);
460
454
  });
461
455
  }
462
456
  emitDunderAllWarning = false;
@@ -480,8 +474,8 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
480
474
  if (argExpr.nodeType === 48 /* ParseNodeType.StringList */ &&
481
475
  argExpr.d.strings.length === 1 &&
482
476
  argExpr.d.strings[0].nodeType === 49 /* ParseNodeType.String */) {
483
- (_a = this._dunderAllNames) === null || _a === void 0 ? void 0 : _a.push(argExpr.d.strings[0].d.value);
484
- (_b = this._dunderAllStringNodes) === null || _b === void 0 ? void 0 : _b.push(argExpr.d.strings[0]);
477
+ this._dunderAllNames?.push(argExpr.d.strings[0].d.value);
478
+ this._dunderAllStringNodes?.push(argExpr.d.strings[0]);
485
479
  emitDunderAllWarning = false;
486
480
  }
487
481
  }
@@ -553,7 +547,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
553
547
  AnalyzerNodeInfo.setDeclaration(node, typeAliasDeclaration);
554
548
  this._createAssignmentTargetFlowNodes(node.d.name, /* walkTargets */ true, /* unbound */ false);
555
549
  const prevScope = this._currentScope;
556
- this._currentScope = typeParamScope !== null && typeParamScope !== void 0 ? typeParamScope : this._currentScope;
550
+ this._currentScope = typeParamScope ?? this._currentScope;
557
551
  this.walk(node.d.expr);
558
552
  this._currentScope = prevScope;
559
553
  return false;
@@ -746,11 +740,10 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
746
740
  if (expr.nodeType === 34 /* ParseNodeType.List */) {
747
741
  // Is this the form __all__ += ["a", "b"]?
748
742
  expr.d.items.forEach((listEntryNode) => {
749
- var _a;
750
743
  if (listEntryNode.nodeType === 48 /* ParseNodeType.StringList */ &&
751
744
  listEntryNode.d.strings.length === 1 &&
752
745
  listEntryNode.d.strings[0].nodeType === 49 /* ParseNodeType.String */) {
753
- (_a = this._dunderAllNames) === null || _a === void 0 ? void 0 : _a.push(listEntryNode.d.strings[0].d.value);
746
+ this._dunderAllNames?.push(listEntryNode.d.strings[0].d.value);
754
747
  this._dunderAllStringNodes.push(listEntryNode.d.strings[0]);
755
748
  }
756
749
  });
@@ -763,8 +756,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
763
756
  const namesToAdd = this._getDunderAllNamesFromImport(expr.d.leftExpr.d.value);
764
757
  if (namesToAdd) {
765
758
  namesToAdd.forEach((name) => {
766
- var _a;
767
- (_a = this._dunderAllNames) === null || _a === void 0 ? void 0 : _a.push(name);
759
+ this._dunderAllNames?.push(name);
768
760
  });
769
761
  emitDunderAllWarning = false;
770
762
  }
@@ -785,13 +777,12 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
785
777
  return false;
786
778
  }
787
779
  visitTypeAnnotation(node) {
788
- var _a;
789
780
  if (this._handleTypingStubAssignmentOrAnnotation(node)) {
790
781
  return false;
791
782
  }
792
783
  // If this is an annotated variable assignment within a class body,
793
784
  // we need to evaluate the type annotation first.
794
- const bindVariableBeforeAnnotationEvaluation = ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* ParseNodeType.Assignment */ &&
785
+ const bindVariableBeforeAnnotationEvaluation = node.parent?.nodeType === 3 /* ParseNodeType.Assignment */ &&
795
786
  ParseTreeUtils.getEnclosingClass(node, /* stopAtFunction */ true) !== undefined;
796
787
  if (!bindVariableBeforeAnnotationEvaluation) {
797
788
  this.walk(node.d.annotation);
@@ -834,8 +825,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
834
825
  this._addAntecedent(preForLabel, this._currentFlowNode);
835
826
  // Add any target expressions since they are modified in the loop.
836
827
  targetExpressions.forEach((value) => {
837
- var _a;
838
- (_a = this._currentScopeCodeFlowExpressions) === null || _a === void 0 ? void 0 : _a.add(value);
828
+ this._currentScopeCodeFlowExpressions?.add(value);
839
829
  });
840
830
  });
841
831
  this._currentFlowNode = this._finishFlowLabel(preElseLabel);
@@ -1169,18 +1159,17 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1169
1159
  return false;
1170
1160
  }
1171
1161
  visitAwait(node) {
1172
- var _a, _b, _c, _d, _e, _f, _g;
1173
1162
  // Make sure this is within an async lambda or function.
1174
1163
  const execScopeNode = ParseTreeUtils.getExecutionScopeNode(node);
1175
- if ((execScopeNode === null || execScopeNode === void 0 ? void 0 : execScopeNode.nodeType) !== 31 /* ParseNodeType.Function */ || !execScopeNode.d.isAsync) {
1176
- if (this._fileInfo.ipythonMode && (execScopeNode === null || execScopeNode === void 0 ? void 0 : execScopeNode.nodeType) === 36 /* ParseNodeType.Module */) {
1164
+ if (execScopeNode?.nodeType !== 31 /* ParseNodeType.Function */ || !execScopeNode.d.isAsync) {
1165
+ if (this._fileInfo.ipythonMode && execScopeNode?.nodeType === 36 /* ParseNodeType.Module */) {
1177
1166
  // Top level await is allowed in ipython mode.
1178
1167
  return true;
1179
1168
  }
1180
- const isInGenerator = ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.nodeType) === 11 /* ParseNodeType.Comprehension */ &&
1181
- ((_c = (_b = node.parent) === null || _b === void 0 ? void 0 : _b.parent) === null || _c === void 0 ? void 0 : _c.nodeType) !== 34 /* ParseNodeType.List */ &&
1182
- ((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.nodeType) !== 45 /* ParseNodeType.Set */ &&
1183
- ((_g = (_f = node.parent) === null || _f === void 0 ? void 0 : _f.parent) === null || _g === void 0 ? void 0 : _g.nodeType) !== 18 /* ParseNodeType.Dictionary */;
1169
+ const isInGenerator = node.parent?.nodeType === 11 /* ParseNodeType.Comprehension */ &&
1170
+ node.parent?.parent?.nodeType !== 34 /* ParseNodeType.List */ &&
1171
+ node.parent?.parent?.nodeType !== 45 /* ParseNodeType.Set */ &&
1172
+ node.parent?.parent?.nodeType !== 18 /* ParseNodeType.Dictionary */;
1184
1173
  // Allow if it's within a generator expression. Execution of
1185
1174
  // generator expressions is deferred and therefore can be
1186
1175
  // run within the context of an async function later.
@@ -1239,7 +1228,6 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1239
1228
  return true;
1240
1229
  }
1241
1230
  visitImportAs(node) {
1242
- var _a, _b, _c, _d, _e, _f;
1243
1231
  if (node.d.module.d.nameParts.length > 0) {
1244
1232
  const firstNamePartValue = node.d.module.d.nameParts[0].d.value;
1245
1233
  let symbolName;
@@ -1277,20 +1265,19 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1277
1265
  this._createFlowAssignment(node.d.alias ? node.d.alias : node.d.module.d.nameParts[0]);
1278
1266
  if (node.d.module.d.nameParts.length === 1) {
1279
1267
  if (firstNamePartValue === 'typing' || firstNamePartValue === 'typing_extensions') {
1280
- this._typingImportAliases.push((_b = (_a = node.d.alias) === null || _a === void 0 ? void 0 : _a.d.value) !== null && _b !== void 0 ? _b : firstNamePartValue);
1268
+ this._typingImportAliases.push(node.d.alias?.d.value ?? firstNamePartValue);
1281
1269
  }
1282
1270
  else if (firstNamePartValue === 'sys') {
1283
- this._sysImportAliases.push((_d = (_c = node.d.alias) === null || _c === void 0 ? void 0 : _c.d.value) !== null && _d !== void 0 ? _d : firstNamePartValue);
1271
+ this._sysImportAliases.push(node.d.alias?.d.value ?? firstNamePartValue);
1284
1272
  }
1285
1273
  else if (firstNamePartValue === 'dataclasses') {
1286
- this._dataclassesImportAliases.push((_f = (_e = node.d.alias) === null || _e === void 0 ? void 0 : _e.d.value) !== null && _f !== void 0 ? _f : firstNamePartValue);
1274
+ this._dataclassesImportAliases.push(node.d.alias?.d.value ?? firstNamePartValue);
1287
1275
  }
1288
1276
  }
1289
1277
  }
1290
1278
  return true;
1291
1279
  }
1292
1280
  visitImportFrom(node) {
1293
- var _a;
1294
1281
  const typingSymbolsOfInterest = ['Final', 'ClassVar', 'Annotated'];
1295
1282
  const dataclassesSymbolsOfInterest = ['InitVar'];
1296
1283
  const importInfo = AnalyzerNodeInfo.getImportInfo(node.d.module);
@@ -1326,7 +1313,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1326
1313
  const names = [];
1327
1314
  // Note that this scope uses a wildcard import, so we cannot shortcut
1328
1315
  // any code flow checks. All expressions are potentially in play.
1329
- (_a = this._currentScopeCodeFlowExpressions) === null || _a === void 0 ? void 0 : _a.add(codeFlowTypes_1.wildcardImportReferenceKey);
1316
+ this._currentScopeCodeFlowExpressions?.add(codeFlowTypes_1.wildcardImportReferenceKey);
1330
1317
  const lookupInfo = this._fileInfo.importLookup(resolvedPath);
1331
1318
  if (lookupInfo) {
1332
1319
  const wildcardNames = this._getWildcardImportNames(lookupInfo);
@@ -1483,7 +1470,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1483
1470
  range: (0, positionUtils_1.convertTextRangeToRange)(nameNode, this._fileInfo.lines),
1484
1471
  moduleName: this._formatModuleName(node.d.module),
1485
1472
  isInExceptSuite: this._isInExceptSuite,
1486
- isNativeLib: importInfo === null || importInfo === void 0 ? void 0 : importInfo.isNativeLib,
1473
+ isNativeLib: importInfo?.isNativeLib,
1487
1474
  };
1488
1475
  symbol.addDeclaration(aliasDecl);
1489
1476
  this._createFlowAssignment(importSymbolNode.d.alias || importSymbolNode.d.name);
@@ -1646,7 +1633,6 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1646
1633
  }
1647
1634
  this._createNewScope(1 /* ScopeType.Comprehension */, this._getNonClassParentScope(),
1648
1635
  /* proxyScope */ undefined, () => {
1649
- var _a, _b, _c;
1650
1636
  AnalyzerNodeInfo.setScope(node, this._currentScope);
1651
1637
  const falseLabel = this._createBranchLabel();
1652
1638
  // We'll walk the forIfNodes list twice. The first time we'll
@@ -1665,9 +1651,9 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1665
1651
  // Allow if it's within a generator expression. Execution of
1666
1652
  // generator expressions is deferred and therefore can be
1667
1653
  // run within the context of an async function later.
1668
- if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.nodeType) === 34 /* ParseNodeType.List */ ||
1669
- ((_b = node.parent) === null || _b === void 0 ? void 0 : _b.nodeType) === 45 /* ParseNodeType.Set */ ||
1670
- ((_c = node.parent) === null || _c === void 0 ? void 0 : _c.nodeType) === 18 /* ParseNodeType.Dictionary */) {
1654
+ if (node.parent?.nodeType === 34 /* ParseNodeType.List */ ||
1655
+ node.parent?.nodeType === 45 /* ParseNodeType.Set */ ||
1656
+ node.parent?.nodeType === 18 /* ParseNodeType.Dictionary */) {
1671
1657
  this._addSyntaxError(localize_1.LocMessage.asyncNotInAsyncFunction(), compr.d.asyncToken);
1672
1658
  }
1673
1659
  }
@@ -1930,16 +1916,15 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1930
1916
  // Attempts to resolve the module name, import it, and return
1931
1917
  // its __all__ symbols.
1932
1918
  _getDunderAllNamesFromImport(varName) {
1933
- var _a, _b;
1934
1919
  const varSymbol = this._currentScope.lookUpSymbol(varName);
1935
1920
  if (!varSymbol) {
1936
1921
  return undefined;
1937
1922
  }
1938
1923
  // There should be only one declaration for the variable.
1939
1924
  const aliasDecl = varSymbol.getDeclarations().find((decl) => decl.type === 8 /* DeclarationType.Alias */);
1940
- const resolvedUri = (aliasDecl === null || aliasDecl === void 0 ? void 0 : aliasDecl.uri) && !aliasDecl.uri.isEmpty() && aliasDecl.loadSymbolsFromPath
1925
+ const resolvedUri = aliasDecl?.uri && !aliasDecl.uri.isEmpty() && aliasDecl.loadSymbolsFromPath
1941
1926
  ? aliasDecl.uri
1942
- : ((_a = aliasDecl === null || aliasDecl === void 0 ? void 0 : aliasDecl.submoduleFallback) === null || _a === void 0 ? void 0 : _a.uri) &&
1927
+ : aliasDecl?.submoduleFallback?.uri &&
1943
1928
  !aliasDecl.submoduleFallback.uri.isEmpty() &&
1944
1929
  aliasDecl.submoduleFallback.loadSymbolsFromPath
1945
1930
  ? aliasDecl.submoduleFallback.uri
@@ -1948,12 +1933,12 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1948
1933
  return undefined;
1949
1934
  }
1950
1935
  let lookupInfo = this._fileInfo.importLookup(resolvedUri);
1951
- if (lookupInfo === null || lookupInfo === void 0 ? void 0 : lookupInfo.dunderAllNames) {
1936
+ if (lookupInfo?.dunderAllNames) {
1952
1937
  return lookupInfo.dunderAllNames;
1953
1938
  }
1954
- if (((_b = aliasDecl === null || aliasDecl === void 0 ? void 0 : aliasDecl.submoduleFallback) === null || _b === void 0 ? void 0 : _b.uri) && !aliasDecl.submoduleFallback.uri.isEmpty()) {
1939
+ if (aliasDecl?.submoduleFallback?.uri && !aliasDecl.submoduleFallback.uri.isEmpty()) {
1955
1940
  lookupInfo = this._fileInfo.importLookup(aliasDecl.submoduleFallback.uri);
1956
- return lookupInfo === null || lookupInfo === void 0 ? void 0 : lookupInfo.dunderAllNames;
1941
+ return lookupInfo?.dunderAllNames;
1957
1942
  }
1958
1943
  return undefined;
1959
1944
  }
@@ -1966,7 +1951,6 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1966
1951
  this._createFlowAssignment(node.d.module.d.nameParts[0]);
1967
1952
  }
1968
1953
  _createAliasDeclarationForMultipartImportName(node, importAlias, importInfo, symbol) {
1969
- var _a;
1970
1954
  const firstNamePartValue = node.d.module.d.nameParts[0].d.value;
1971
1955
  AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
1972
1956
  // See if there's already a matching alias declaration for this import.
@@ -2017,7 +2001,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2017
2001
  loadSymbolsFromPath: true,
2018
2002
  range: (0, textRange_1.getEmptyRange)(),
2019
2003
  usesLocalName: !!importAlias,
2020
- moduleName: (_a = importInfo === null || importInfo === void 0 ? void 0 : importInfo.importName) !== null && _a !== void 0 ? _a : '',
2004
+ moduleName: importInfo?.importName ?? '',
2021
2005
  firstNamePart: importAlias
2022
2006
  ? this._formatModuleName(node.d.module)
2023
2007
  : '.'.repeat(node.d.module.d.leadingDots) + firstNamePartValue,
@@ -2910,7 +2894,6 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2910
2894
  return exemptSymbols.some((name) => name === symbolName);
2911
2895
  }
2912
2896
  _addTypeDeclarationForVariable(target, typeAnnotation) {
2913
- var _a, _b, _c;
2914
2897
  let declarationHandled = false;
2915
2898
  switch (target.nodeType) {
2916
2899
  case 38 /* ParseNodeType.Name */: {
@@ -2940,8 +2923,8 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2940
2923
  const containingClass = ParseTreeUtils.getEnclosingClassOrFunction(target);
2941
2924
  if (containingClass && containingClass.nodeType === 10 /* ParseNodeType.Class */) {
2942
2925
  // Make sure it's part of an assignment.
2943
- if (((_a = target.parent) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* ParseNodeType.Assignment */ ||
2944
- ((_c = (_b = target.parent) === null || _b === void 0 ? void 0 : _b.parent) === null || _c === void 0 ? void 0 : _c.nodeType) === 3 /* ParseNodeType.Assignment */) {
2926
+ if (target.parent?.nodeType === 3 /* ParseNodeType.Assignment */ ||
2927
+ target.parent?.parent?.nodeType === 3 /* ParseNodeType.Assignment */) {
2945
2928
  isFinalAssignedInClassBody = true;
2946
2929
  }
2947
2930
  }
@@ -3090,7 +3073,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
3090
3073
  // Allow Final to be enclosed in ClassVar. Normally, Final implies
3091
3074
  // ClassVar, but this combination is required in the case of dataclasses.
3092
3075
  const classVarInfo = this._isAnnotationClassVar(typeAnnotation);
3093
- if (classVarInfo === null || classVarInfo === void 0 ? void 0 : classVarInfo.classVarTypeNode) {
3076
+ if (classVarInfo?.classVarTypeNode) {
3094
3077
  typeAnnotation = classVarInfo.classVarTypeNode;
3095
3078
  }
3096
3079
  if (this._isTypingAnnotation(typeAnnotation, 'Final')) {