@zzzen/pyright-internal 1.1.254
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.
- package/dist/analyzer/aliasDeclarationUtils.d.ts +9 -0
- package/dist/analyzer/aliasDeclarationUtils.js +128 -0
- package/dist/analyzer/aliasDeclarationUtils.js.map +1 -0
- package/dist/analyzer/analysis.d.ts +18 -0
- package/dist/analyzer/analysis.js +81 -0
- package/dist/analyzer/analysis.js.map +1 -0
- package/dist/analyzer/analyzerFileInfo.d.ts +39 -0
- package/dist/analyzer/analyzerFileInfo.js +17 -0
- package/dist/analyzer/analyzerFileInfo.js.map +1 -0
- package/dist/analyzer/analyzerNodeInfo.d.ts +32 -0
- package/dist/analyzer/analyzerNodeInfo.js +138 -0
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -0
- package/dist/analyzer/backgroundAnalysisProgram.d.ts +54 -0
- package/dist/analyzer/backgroundAnalysisProgram.js +222 -0
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -0
- package/dist/analyzer/binder.d.ts +149 -0
- package/dist/analyzer/binder.js +3195 -0
- package/dist/analyzer/binder.js.map +1 -0
- package/dist/analyzer/checker.d.ts +116 -0
- package/dist/analyzer/checker.js +3828 -0
- package/dist/analyzer/checker.js.map +1 -0
- package/dist/analyzer/circularDependency.d.ts +7 -0
- package/dist/analyzer/circularDependency.js +51 -0
- package/dist/analyzer/circularDependency.js.map +1 -0
- package/dist/analyzer/codeFlowEngine.d.ts +21 -0
- package/dist/analyzer/codeFlowEngine.js +1132 -0
- package/dist/analyzer/codeFlowEngine.js.map +1 -0
- package/dist/analyzer/codeFlowTypes.d.ts +82 -0
- package/dist/analyzer/codeFlowTypes.js +134 -0
- package/dist/analyzer/codeFlowTypes.js.map +1 -0
- package/dist/analyzer/codeFlowUtils.d.ts +2 -0
- package/dist/analyzer/codeFlowUtils.js +348 -0
- package/dist/analyzer/codeFlowUtils.js.map +1 -0
- package/dist/analyzer/commentUtils.d.ts +4 -0
- package/dist/analyzer/commentUtils.js +131 -0
- package/dist/analyzer/commentUtils.js.map +1 -0
- package/dist/analyzer/constraintSolver.d.ts +7 -0
- package/dist/analyzer/constraintSolver.js +605 -0
- package/dist/analyzer/constraintSolver.js.map +1 -0
- package/dist/analyzer/constructorTransform.d.ts +4 -0
- package/dist/analyzer/constructorTransform.js +219 -0
- package/dist/analyzer/constructorTransform.js.map +1 -0
- package/dist/analyzer/dataClasses.d.ts +9 -0
- package/dist/analyzer/dataClasses.js +762 -0
- package/dist/analyzer/dataClasses.js.map +1 -0
- package/dist/analyzer/declaration.d.ts +90 -0
- package/dist/analyzer/declaration.js +42 -0
- package/dist/analyzer/declaration.js.map +1 -0
- package/dist/analyzer/declarationUtils.d.ts +12 -0
- package/dist/analyzer/declarationUtils.js +212 -0
- package/dist/analyzer/declarationUtils.js.map +1 -0
- package/dist/analyzer/docStringConversion.d.ts +2 -0
- package/dist/analyzer/docStringConversion.js +699 -0
- package/dist/analyzer/docStringConversion.js.map +1 -0
- package/dist/analyzer/docStringUtils.d.ts +3 -0
- package/dist/analyzer/docStringUtils.js +103 -0
- package/dist/analyzer/docStringUtils.js.map +1 -0
- package/dist/analyzer/functionTransform.d.ts +4 -0
- package/dist/analyzer/functionTransform.js +96 -0
- package/dist/analyzer/functionTransform.js.map +1 -0
- package/dist/analyzer/importResolver.d.ts +97 -0
- package/dist/analyzer/importResolver.js +1617 -0
- package/dist/analyzer/importResolver.js.map +1 -0
- package/dist/analyzer/importResult.d.ts +33 -0
- package/dist/analyzer/importResult.js +11 -0
- package/dist/analyzer/importResult.js.map +1 -0
- package/dist/analyzer/importStatementUtils.d.ts +46 -0
- package/dist/analyzer/importStatementUtils.js +618 -0
- package/dist/analyzer/importStatementUtils.js.map +1 -0
- package/dist/analyzer/namedTuples.d.ts +5 -0
- package/dist/analyzer/namedTuples.js +342 -0
- package/dist/analyzer/namedTuples.js.map +1 -0
- package/dist/analyzer/packageTypeReport.d.ts +52 -0
- package/dist/analyzer/packageTypeReport.js +45 -0
- package/dist/analyzer/packageTypeReport.js.map +1 -0
- package/dist/analyzer/packageTypeVerifier.d.ts +37 -0
- package/dist/analyzer/packageTypeVerifier.js +908 -0
- package/dist/analyzer/packageTypeVerifier.js.map +1 -0
- package/dist/analyzer/parentDirectoryCache.d.ts +23 -0
- package/dist/analyzer/parentDirectoryCache.js +71 -0
- package/dist/analyzer/parentDirectoryCache.js.map +1 -0
- package/dist/analyzer/parseTreeCleaner.d.ts +8 -0
- package/dist/analyzer/parseTreeCleaner.js +51 -0
- package/dist/analyzer/parseTreeCleaner.js.map +1 -0
- package/dist/analyzer/parseTreeUtils.d.ts +98 -0
- package/dist/analyzer/parseTreeUtils.js +1753 -0
- package/dist/analyzer/parseTreeUtils.js.map +1 -0
- package/dist/analyzer/parseTreeWalker.d.ts +81 -0
- package/dist/analyzer/parseTreeWalker.js +437 -0
- package/dist/analyzer/parseTreeWalker.js.map +1 -0
- package/dist/analyzer/patternMatching.d.ts +6 -0
- package/dist/analyzer/patternMatching.js +866 -0
- package/dist/analyzer/patternMatching.js.map +1 -0
- package/dist/analyzer/program.d.ts +158 -0
- package/dist/analyzer/program.js +1902 -0
- package/dist/analyzer/program.js.map +1 -0
- package/dist/analyzer/properties.d.ts +10 -0
- package/dist/analyzer/properties.js +368 -0
- package/dist/analyzer/properties.js.map +1 -0
- package/dist/analyzer/protocols.d.ts +8 -0
- package/dist/analyzer/protocols.js +409 -0
- package/dist/analyzer/protocols.js.map +1 -0
- package/dist/analyzer/pyTypedUtils.d.ts +6 -0
- package/dist/analyzer/pyTypedUtils.js +42 -0
- package/dist/analyzer/pyTypedUtils.js.map +1 -0
- package/dist/analyzer/pythonPathUtils.d.ts +14 -0
- package/dist/analyzer/pythonPathUtils.js +173 -0
- package/dist/analyzer/pythonPathUtils.js.map +1 -0
- package/dist/analyzer/scope.d.ts +39 -0
- package/dist/analyzer/scope.js +110 -0
- package/dist/analyzer/scope.js.map +1 -0
- package/dist/analyzer/scopeUtils.d.ts +6 -0
- package/dist/analyzer/scopeUtils.js +72 -0
- package/dist/analyzer/scopeUtils.js.map +1 -0
- package/dist/analyzer/service.d.ts +144 -0
- package/dist/analyzer/service.js +1197 -0
- package/dist/analyzer/service.js.map +1 -0
- package/dist/analyzer/sourceFile.d.ts +123 -0
- package/dist/analyzer/sourceFile.js +908 -0
- package/dist/analyzer/sourceFile.js.map +1 -0
- package/dist/analyzer/sourceMapper.d.ts +47 -0
- package/dist/analyzer/sourceMapper.js +543 -0
- package/dist/analyzer/sourceMapper.js.map +1 -0
- package/dist/analyzer/staticExpressions.d.ts +4 -0
- package/dist/analyzer/staticExpressions.js +242 -0
- package/dist/analyzer/staticExpressions.js.map +1 -0
- package/dist/analyzer/symbol.d.ts +50 -0
- package/dist/analyzer/symbol.js +160 -0
- package/dist/analyzer/symbol.js.map +1 -0
- package/dist/analyzer/symbolNameUtils.d.ts +8 -0
- package/dist/analyzer/symbolNameUtils.js +53 -0
- package/dist/analyzer/symbolNameUtils.js.map +1 -0
- package/dist/analyzer/symbolUtils.d.ts +7 -0
- package/dist/analyzer/symbolUtils.js +46 -0
- package/dist/analyzer/symbolUtils.js.map +1 -0
- package/dist/analyzer/testWalker.d.ts +14 -0
- package/dist/analyzer/testWalker.js +92 -0
- package/dist/analyzer/testWalker.js.map +1 -0
- package/dist/analyzer/tracePrinter.d.ts +11 -0
- package/dist/analyzer/tracePrinter.js +222 -0
- package/dist/analyzer/tracePrinter.js.map +1 -0
- package/dist/analyzer/typeCache.d.ts +40 -0
- package/dist/analyzer/typeCache.js +134 -0
- package/dist/analyzer/typeCache.js.map +1 -0
- package/dist/analyzer/typeDocStringUtils.d.ts +12 -0
- package/dist/analyzer/typeDocStringUtils.js +293 -0
- package/dist/analyzer/typeDocStringUtils.js.map +1 -0
- package/dist/analyzer/typeEvaluator.d.ts +18 -0
- package/dist/analyzer/typeEvaluator.js +16598 -0
- package/dist/analyzer/typeEvaluator.js.map +1 -0
- package/dist/analyzer/typeEvaluatorTypes.d.ts +220 -0
- package/dist/analyzer/typeEvaluatorTypes.js +16 -0
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -0
- package/dist/analyzer/typeEvaluatorWithTracker.d.ts +6 -0
- package/dist/analyzer/typeEvaluatorWithTracker.js +121 -0
- package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -0
- package/dist/analyzer/typeGuards.d.ts +6 -0
- package/dist/analyzer/typeGuards.js +1293 -0
- package/dist/analyzer/typeGuards.js.map +1 -0
- package/dist/analyzer/typePrinter.d.ts +17 -0
- package/dist/analyzer/typePrinter.js +603 -0
- package/dist/analyzer/typePrinter.js.map +1 -0
- package/dist/analyzer/typeStubWriter.d.ts +48 -0
- package/dist/analyzer/typeStubWriter.js +605 -0
- package/dist/analyzer/typeStubWriter.js.map +1 -0
- package/dist/analyzer/typeUtils.d.ts +134 -0
- package/dist/analyzer/typeUtils.js +2380 -0
- package/dist/analyzer/typeUtils.js.map +1 -0
- package/dist/analyzer/typeVarContext.d.ts +50 -0
- package/dist/analyzer/typeVarContext.js +250 -0
- package/dist/analyzer/typeVarContext.js.map +1 -0
- package/dist/analyzer/typedDicts.d.ts +12 -0
- package/dist/analyzer/typedDicts.js +695 -0
- package/dist/analyzer/typedDicts.js.map +1 -0
- package/dist/analyzer/types.d.ts +484 -0
- package/dist/analyzer/types.js +1844 -0
- package/dist/analyzer/types.js.map +1 -0
- package/dist/backgroundAnalysis.d.ts +14 -0
- package/dist/backgroundAnalysis.js +42 -0
- package/dist/backgroundAnalysis.js.map +1 -0
- package/dist/backgroundAnalysisBase.d.ts +83 -0
- package/dist/backgroundAnalysisBase.js +429 -0
- package/dist/backgroundAnalysisBase.js.map +1 -0
- package/dist/backgroundThreadBase.d.ts +34 -0
- package/dist/backgroundThreadBase.js +134 -0
- package/dist/backgroundThreadBase.js.map +1 -0
- package/dist/commands/commandController.d.ts +13 -0
- package/dist/commands/commandController.js +48 -0
- package/dist/commands/commandController.js.map +1 -0
- package/dist/commands/commandResult.d.ts +9 -0
- package/dist/commands/commandResult.js +19 -0
- package/dist/commands/commandResult.js.map +1 -0
- package/dist/commands/commands.d.ts +7 -0
- package/dist/commands/commands.js +11 -0
- package/dist/commands/commands.js.map +1 -0
- package/dist/commands/createTypeStub.d.ts +8 -0
- package/dist/commands/createTypeStub.js +50 -0
- package/dist/commands/createTypeStub.js.map +1 -0
- package/dist/commands/quickActionCommand.d.ts +8 -0
- package/dist/commands/quickActionCommand.js +31 -0
- package/dist/commands/quickActionCommand.js.map +1 -0
- package/dist/commands/restartServer.d.ts +8 -0
- package/dist/commands/restartServer.js +20 -0
- package/dist/commands/restartServer.js.map +1 -0
- package/dist/common/cancellationUtils.d.ts +16 -0
- package/dist/common/cancellationUtils.js +60 -0
- package/dist/common/cancellationUtils.js.map +1 -0
- package/dist/common/chokidarFileWatcherProvider.d.ts +9 -0
- package/dist/common/chokidarFileWatcherProvider.js +88 -0
- package/dist/common/chokidarFileWatcherProvider.js.map +1 -0
- package/dist/common/collectionUtils.d.ts +114 -0
- package/dist/common/collectionUtils.js +292 -0
- package/dist/common/collectionUtils.js.map +1 -0
- package/dist/common/commandLineOptions.d.ts +41 -0
- package/dist/common/commandLineOptions.js +46 -0
- package/dist/common/commandLineOptions.js.map +1 -0
- package/dist/common/configOptions.d.ts +144 -0
- package/dist/common/configOptions.js +908 -0
- package/dist/common/configOptions.js.map +1 -0
- package/dist/common/console.d.ts +61 -0
- package/dist/common/console.js +191 -0
- package/dist/common/console.js.map +1 -0
- package/dist/common/core.d.ts +67 -0
- package/dist/common/core.js +118 -0
- package/dist/common/core.js.map +1 -0
- package/dist/common/crypto.d.ts +1 -0
- package/dist/common/crypto.js +37 -0
- package/dist/common/crypto.js.map +1 -0
- package/dist/common/debug.d.ts +13 -0
- package/dist/common/debug.js +131 -0
- package/dist/common/debug.js.map +1 -0
- package/dist/common/deferred.d.ts +11 -0
- package/dist/common/deferred.js +62 -0
- package/dist/common/deferred.js.map +1 -0
- package/dist/common/diagnostic.d.ts +59 -0
- package/dist/common/diagnostic.js +134 -0
- package/dist/common/diagnostic.js.map +1 -0
- package/dist/common/diagnosticRules.d.ts +67 -0
- package/dist/common/diagnosticRules.js +83 -0
- package/dist/common/diagnosticRules.js.map +1 -0
- package/dist/common/diagnosticSink.d.ts +34 -0
- package/dist/common/diagnosticSink.js +110 -0
- package/dist/common/diagnosticSink.js.map +1 -0
- package/dist/common/editAction.d.ts +29 -0
- package/dist/common/editAction.js +11 -0
- package/dist/common/editAction.js.map +1 -0
- package/dist/common/extensibility.d.ts +11 -0
- package/dist/common/extensibility.js +10 -0
- package/dist/common/extensibility.js.map +1 -0
- package/dist/common/extensions.d.ts +3 -0
- package/dist/common/extensions.js +15 -0
- package/dist/common/extensions.js.map +1 -0
- package/dist/common/fileBasedCancellationUtils.d.ts +11 -0
- package/dist/common/fileBasedCancellationUtils.js +259 -0
- package/dist/common/fileBasedCancellationUtils.js.map +1 -0
- package/dist/common/fileSystem.d.ts +72 -0
- package/dist/common/fileSystem.js +69 -0
- package/dist/common/fileSystem.js.map +1 -0
- package/dist/common/fullAccessHost.d.ts +19 -0
- package/dist/common/fullAccessHost.js +193 -0
- package/dist/common/fullAccessHost.js.map +1 -0
- package/dist/common/host.d.ts +21 -0
- package/dist/common/host.js +30 -0
- package/dist/common/host.js.map +1 -0
- package/dist/common/logTracker.d.ts +15 -0
- package/dist/common/logTracker.js +129 -0
- package/dist/common/logTracker.js.map +1 -0
- package/dist/common/lspUtils.d.ts +3 -0
- package/dist/common/lspUtils.js +20 -0
- package/dist/common/lspUtils.js.map +1 -0
- package/dist/common/memUtils.d.ts +3 -0
- package/dist/common/memUtils.js +37 -0
- package/dist/common/memUtils.js.map +1 -0
- package/dist/common/pathConsts.d.ts +8 -0
- package/dist/common/pathConsts.js +19 -0
- package/dist/common/pathConsts.js.map +1 -0
- package/dist/common/pathUtils.d.ts +170 -0
- package/dist/common/pathUtils.js +762 -0
- package/dist/common/pathUtils.js.map +1 -0
- package/dist/common/positionUtils.d.ts +7 -0
- package/dist/common/positionUtils.js +71 -0
- package/dist/common/positionUtils.js.map +1 -0
- package/dist/common/progressReporter.d.ts +15 -0
- package/dist/common/progressReporter.js +44 -0
- package/dist/common/progressReporter.js.map +1 -0
- package/dist/common/pythonVersion.d.ts +20 -0
- package/dist/common/pythonVersion.js +71 -0
- package/dist/common/pythonVersion.js.map +1 -0
- package/dist/common/realFileSystem.d.ts +8 -0
- package/dist/common/realFileSystem.js +368 -0
- package/dist/common/realFileSystem.js.map +1 -0
- package/dist/common/stringUtils.d.ts +47 -0
- package/dist/common/stringUtils.js +160 -0
- package/dist/common/stringUtils.js.map +1 -0
- package/dist/common/textEditUtils.d.ts +3 -0
- package/dist/common/textEditUtils.js +29 -0
- package/dist/common/textEditUtils.js.map +1 -0
- package/dist/common/textRange.d.ts +47 -0
- package/dist/common/textRange.js +211 -0
- package/dist/common/textRange.js.map +1 -0
- package/dist/common/textRangeCollection.d.ts +13 -0
- package/dist/common/textRangeCollection.js +108 -0
- package/dist/common/textRangeCollection.js.map +1 -0
- package/dist/common/timing.d.ts +31 -0
- package/dist/common/timing.js +100 -0
- package/dist/common/timing.js.map +1 -0
- package/dist/common/uriParser.d.ts +12 -0
- package/dist/common/uriParser.js +25 -0
- package/dist/common/uriParser.js.map +1 -0
- package/dist/common/workspaceEditUtils.d.ts +7 -0
- package/dist/common/workspaceEditUtils.js +63 -0
- package/dist/common/workspaceEditUtils.js.map +1 -0
- package/dist/languageServerBase.d.ts +211 -0
- package/dist/languageServerBase.js +923 -0
- package/dist/languageServerBase.js.map +1 -0
- package/dist/languageService/analyzerServiceExecutor.d.ts +8 -0
- package/dist/languageService/analyzerServiceExecutor.js +97 -0
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -0
- package/dist/languageService/autoImporter.d.ts +84 -0
- package/dist/languageService/autoImporter.js +635 -0
- package/dist/languageService/autoImporter.js.map +1 -0
- package/dist/languageService/callHierarchyProvider.d.ts +12 -0
- package/dist/languageService/callHierarchyProvider.js +368 -0
- package/dist/languageService/callHierarchyProvider.js.map +1 -0
- package/dist/languageService/codeActionProvider.d.ts +6 -0
- package/dist/languageService/codeActionProvider.js +53 -0
- package/dist/languageService/codeActionProvider.js.map +1 -0
- package/dist/languageService/completionProvider.d.ts +147 -0
- package/dist/languageService/completionProvider.js +2220 -0
- package/dist/languageService/completionProvider.js.map +1 -0
- package/dist/languageService/definitionProvider.d.ts +17 -0
- package/dist/languageService/definitionProvider.js +206 -0
- package/dist/languageService/definitionProvider.js.map +1 -0
- package/dist/languageService/documentHighlightProvider.d.ts +7 -0
- package/dist/languageService/documentHighlightProvider.js +63 -0
- package/dist/languageService/documentHighlightProvider.js.map +1 -0
- package/dist/languageService/documentSymbolCollector.d.ts +37 -0
- package/dist/languageService/documentSymbolCollector.js +344 -0
- package/dist/languageService/documentSymbolCollector.js.map +1 -0
- package/dist/languageService/documentSymbolProvider.d.ts +37 -0
- package/dist/languageService/documentSymbolProvider.js +308 -0
- package/dist/languageService/documentSymbolProvider.js.map +1 -0
- package/dist/languageService/hoverProvider.d.ts +25 -0
- package/dist/languageService/hoverProvider.js +366 -0
- package/dist/languageService/hoverProvider.js.map +1 -0
- package/dist/languageService/importAdder.d.ts +24 -0
- package/dist/languageService/importAdder.js +296 -0
- package/dist/languageService/importAdder.js.map +1 -0
- package/dist/languageService/importSorter.d.ts +15 -0
- package/dist/languageService/importSorter.js +152 -0
- package/dist/languageService/importSorter.js.map +1 -0
- package/dist/languageService/indentationUtils.d.ts +4 -0
- package/dist/languageService/indentationUtils.js +597 -0
- package/dist/languageService/indentationUtils.js.map +1 -0
- package/dist/languageService/quickActions.d.ts +4 -0
- package/dist/languageService/quickActions.js +97 -0
- package/dist/languageService/quickActions.js.map +1 -0
- package/dist/languageService/referencesProvider.d.ts +36 -0
- package/dist/languageService/referencesProvider.js +236 -0
- package/dist/languageService/referencesProvider.js.map +1 -0
- package/dist/languageService/renameModuleProvider.d.ts +58 -0
- package/dist/languageService/renameModuleProvider.js +884 -0
- package/dist/languageService/renameModuleProvider.js.map +1 -0
- package/dist/languageService/signatureHelpProvider.d.ts +26 -0
- package/dist/languageService/signatureHelpProvider.js +180 -0
- package/dist/languageService/signatureHelpProvider.js.map +1 -0
- package/dist/languageService/tooltipUtils.d.ts +9 -0
- package/dist/languageService/tooltipUtils.js +129 -0
- package/dist/languageService/tooltipUtils.js.map +1 -0
- package/dist/localization/localize.d.ts +1324 -0
- package/dist/localization/localize.js +788 -0
- package/dist/localization/localize.js.map +1 -0
- package/dist/localization/package.nls.de.json +1 -0
- package/dist/localization/package.nls.en-us.json +636 -0
- package/dist/localization/package.nls.es.json +1 -0
- package/dist/localization/package.nls.fr.json +1 -0
- package/dist/localization/package.nls.ja.json +1 -0
- package/dist/localization/package.nls.ru.json +1 -0
- package/dist/localization/package.nls.zh-cn.json +1 -0
- package/dist/localization/package.nls.zh-tw.json +1 -0
- package/dist/nodeMain.d.ts +1 -0
- package/dist/nodeMain.js +21 -0
- package/dist/nodeMain.js.map +1 -0
- package/dist/nodeServer.d.ts +3 -0
- package/dist/nodeServer.js +31 -0
- package/dist/nodeServer.js.map +1 -0
- package/dist/parser/characterStream.d.ts +27 -0
- package/dist/parser/characterStream.js +120 -0
- package/dist/parser/characterStream.js.map +1 -0
- package/dist/parser/characters.d.ts +17 -0
- package/dist/parser/characters.js +240 -0
- package/dist/parser/characters.js.map +1 -0
- package/dist/parser/parseNodes.d.ts +750 -0
- package/dist/parser/parseNodes.js +1406 -0
- package/dist/parser/parseNodes.js.map +1 -0
- package/dist/parser/parser.d.ts +191 -0
- package/dist/parser/parser.js +3806 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/stringTokenUtils.d.ts +25 -0
- package/dist/parser/stringTokenUtils.js +455 -0
- package/dist/parser/stringTokenUtils.js.map +1 -0
- package/dist/parser/tokenizer.d.ts +71 -0
- package/dist/parser/tokenizer.js +1111 -0
- package/dist/parser/tokenizer.js.map +1 -0
- package/dist/parser/tokenizerTypes.d.ts +223 -0
- package/dist/parser/tokenizerTypes.js +164 -0
- package/dist/parser/tokenizerTypes.js.map +1 -0
- package/dist/parser/unicode.d.ts +23 -0
- package/dist/parser/unicode.js +2899 -0
- package/dist/parser/unicode.js.map +1 -0
- package/dist/pyright.d.ts +1 -0
- package/dist/pyright.js +645 -0
- package/dist/pyright.js.map +1 -0
- package/dist/pyrightFileSystem.d.ts +28 -0
- package/dist/pyrightFileSystem.js +196 -0
- package/dist/pyrightFileSystem.js.map +1 -0
- package/dist/readonlyAugmentedFileSystem.d.ts +40 -0
- package/dist/readonlyAugmentedFileSystem.js +155 -0
- package/dist/readonlyAugmentedFileSystem.js.map +1 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.js +232 -0
- package/dist/server.js.map +1 -0
- package/dist/tests/chainedSourceFiles.test.d.ts +1 -0
- package/dist/tests/chainedSourceFiles.test.js +153 -0
- package/dist/tests/chainedSourceFiles.test.js.map +1 -0
- package/dist/tests/checker.test.d.ts +1 -0
- package/dist/tests/checker.test.js +346 -0
- package/dist/tests/checker.test.js.map +1 -0
- package/dist/tests/collectionUtils.test.d.ts +1 -0
- package/dist/tests/collectionUtils.test.js +153 -0
- package/dist/tests/collectionUtils.test.js.map +1 -0
- package/dist/tests/common.test.d.ts +1 -0
- package/dist/tests/common.test.js +125 -0
- package/dist/tests/common.test.js.map +1 -0
- package/dist/tests/config.test.d.ts +1 -0
- package/dist/tests/config.test.js +230 -0
- package/dist/tests/config.test.js.map +1 -0
- package/dist/tests/debug.test.d.ts +1 -0
- package/dist/tests/debug.test.js +102 -0
- package/dist/tests/debug.test.js.map +1 -0
- package/dist/tests/deferred.test.d.ts +1 -0
- package/dist/tests/deferred.test.js +65 -0
- package/dist/tests/deferred.test.js.map +1 -0
- package/dist/tests/diagnosticOverrides.test.d.ts +1 -0
- package/dist/tests/diagnosticOverrides.test.js +108 -0
- package/dist/tests/diagnosticOverrides.test.js.map +1 -0
- package/dist/tests/docStringConversion.test.d.ts +1 -0
- package/dist/tests/docStringConversion.test.js +695 -0
- package/dist/tests/docStringConversion.test.js.map +1 -0
- package/dist/tests/docStringUtils.test.d.ts +1 -0
- package/dist/tests/docStringUtils.test.js +70 -0
- package/dist/tests/docStringUtils.test.js.map +1 -0
- package/dist/tests/documentSymbolCollector.test.d.ts +1 -0
- package/dist/tests/documentSymbolCollector.test.js +635 -0
- package/dist/tests/documentSymbolCollector.test.js.map +1 -0
- package/dist/tests/filesystem.test.d.ts +1 -0
- package/dist/tests/filesystem.test.js +194 -0
- package/dist/tests/filesystem.test.js.map +1 -0
- package/dist/tests/fourSlashParser.test.d.ts +1 -0
- package/dist/tests/fourSlashParser.test.js +281 -0
- package/dist/tests/fourSlashParser.test.js.map +1 -0
- package/dist/tests/fourSlashRunner.test.d.ts +1 -0
- package/dist/tests/fourSlashRunner.test.js +52 -0
- package/dist/tests/fourSlashRunner.test.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.js +30 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.js +42 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.js +13 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.js +23 -0
- package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.js +35 -0
- package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.fourslash.js +27 -0
- package/dist/tests/fourslash/completions.autoimport.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.js +128 -0
- package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.js +27 -0
- package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js +43 -0
- package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.js +29 -0
- package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.js +50 -0
- package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js +116 -0
- package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.builtinOverride.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.builtinOverride.fourslash.js +21 -0
- package/dist/tests/fourslash/completions.builtinOverride.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.js +54 -0
- package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.fourslash.js +245 -0
- package/dist/tests/fourslash/completions.call.typedDict.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js +162 -0
- package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js +132 -0
- package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.classVariable.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.classVariable.fourslash.js +37 -0
- package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.comment.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.comment.fourslash.js +27 -0
- package/dist/tests/fourslash/completions.comment.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.class.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.class.fourslash.js +30 -0
- package/dist/tests/fourslash/completions.declNames.class.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.exception.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.exception.fourslash.js +18 -0
- package/dist/tests/fourslash/completions.declNames.exception.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.for.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.for.fourslash.js +26 -0
- package/dist/tests/fourslash/completions.declNames.for.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.js +15 -0
- package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.lambda.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.lambda.fourslash.js +36 -0
- package/dist/tests/fourslash/completions.declNames.lambda.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.method.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.method.fourslash.js +68 -0
- package/dist/tests/fourslash/completions.declNames.method.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.overload.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.overload.fourslash.js +147 -0
- package/dist/tests/fourslash/completions.declNames.overload.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.js +131 -0
- package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.js +73 -0
- package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js +58 -0
- package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js +154 -0
- package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.js +143 -0
- package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js +109 -0
- package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.js +50 -0
- package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.enums.members.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.enums.members.fourslash.js +44 -0
- package/dist/tests/fourslash/completions.enums.members.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.excluded.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.excluded.fourslash.js +12 -0
- package/dist/tests/fourslash/completions.excluded.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.fourslash.js +51 -0
- package/dist/tests/fourslash/completions.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.fstring.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.fstring.fourslash.js +32 -0
- package/dist/tests/fourslash/completions.fstring.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js +96 -0
- package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.js +30 -0
- package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.importDunderNames.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.importDunderNames.fourslash.js +29 -0
- package/dist/tests/fourslash/completions.importDunderNames.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.importSubmodule.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.importSubmodule.fourslash.js +22 -0
- package/dist/tests/fourslash/completions.importSubmodule.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.importsDuplicates.fourslash.d.ts +0 -0
- package/dist/tests/fourslash/completions.importsDuplicates.fourslash.js +22 -0
- package/dist/tests/fourslash/completions.importsDuplicates.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inList.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inList.fourslash.js +32 -0
- package/dist/tests/fourslash/completions.inList.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.included.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.included.fourslash.js +12 -0
- package/dist/tests/fourslash/completions.included.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.js +54 -0
- package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.js +26 -0
- package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js +49 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js +50 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.js +101 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.js +105 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.js +67 -0
- package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js +75 -0
- package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js +66 -0
- package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.libStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.libStub.fourslash.js +66 -0
- package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.literals.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.literals.fourslash.js +31 -0
- package/dist/tests/fourslash/completions.literals.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.localCode.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.localCode.fourslash.js +71 -0
- package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.js +17 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.js +57 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.js +27 -0
- package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.overloads.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.overloads.fourslash.js +37 -0
- package/dist/tests/fourslash/completions.overloads.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.default.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.default.fourslash.js +47 -0
- package/dist/tests/fourslash/completions.override.default.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.default.importStub.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.default.importStub.js +49 -0
- package/dist/tests/fourslash/completions.override.default.importStub.js.map +1 -0
- package/dist/tests/fourslash/completions.override.default.imported.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.default.imported.fourslash.js +60 -0
- package/dist/tests/fourslash/completions.override.default.imported.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.default.stub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.default.stub.fourslash.js +47 -0
- package/dist/tests/fourslash/completions.override.default.stub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.fourslash.js +47 -0
- package/dist/tests/fourslash/completions.override.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.property.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.property.fourslash.js +31 -0
- package/dist/tests/fourslash/completions.override.property.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.property.stub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.property.stub.fourslash.js +31 -0
- package/dist/tests/fourslash/completions.override.property.stub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.js +63 -0
- package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.stub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.stub.fourslash.js +47 -0
- package/dist/tests/fourslash/completions.override.stub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override2.fourslash.js +66 -0
- package/dist/tests/fourslash/completions.override2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.parameters.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.parameters.fourslash.js +22 -0
- package/dist/tests/fourslash/completions.parameters.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.params.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.params.fourslash.js +23 -0
- package/dist/tests/fourslash/completions.params.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.parentFolder.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.parentFolder.fourslash.js +15 -0
- package/dist/tests/fourslash/completions.parentFolder.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.parentFolders.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.parentFolders.fourslash.js +68 -0
- package/dist/tests/fourslash/completions.parentFolders.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.plainText.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.plainText.fourslash.js +34 -0
- package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.private.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.private.fourslash.js +61 -0
- package/dist/tests/fourslash/completions.private.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.property.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.property.fourslash.js +28 -0
- package/dist/tests/fourslash/completions.property.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.js +64 -0
- package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.self.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.self.fourslash.js +43 -0
- package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.js +71 -0
- package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.stringLiteral.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.stringLiteral.fourslash.js +78 -0
- package/dist/tests/fourslash/completions.stringLiteral.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.typeAlias.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.typeAlias.fourslash.js +29 -0
- package/dist/tests/fourslash/completions.typeAlias.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.typeshed.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.typeshed.fourslash.js +9 -0
- package/dist/tests/fourslash/completions.typeshed.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.vardecls.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.vardecls.fourslash.js +33 -0
- package/dist/tests/fourslash/completions.vardecls.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.variableDocStrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js +68 -0
- package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.wildcardimports.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.wildcardimports.fourslash.js +109 -0
- package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.with.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.with.fourslash.js +25 -0
- package/dist/tests/fourslash/completions.with.fourslash.js.map +1 -0
- package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.js +64 -0
- package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.js +24 -0
- package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.classes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.classes.fourslash.js +93 -0
- package/dist/tests/fourslash/findDefinitions.classes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.js +23 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.js +19 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.js +23 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.js +20 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.fields.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.fields.fourslash.js +123 -0
- package/dist/tests/fourslash/findDefinitions.fields.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.functions.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.functions.fourslash.js +79 -0
- package/dist/tests/fourslash/findDefinitions.functions.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.methods.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.methods.fourslash.js +154 -0
- package/dist/tests/fourslash/findDefinitions.methods.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.modules.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.modules.fourslash.js +42 -0
- package/dist/tests/fourslash/findDefinitions.modules.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js +34 -0
- package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.overloads.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.overloads.fourslash.js +213 -0
- package/dist/tests/fourslash/findDefinitions.overloads.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.parameters.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.parameters.fourslash.js +154 -0
- package/dist/tests/fourslash/findDefinitions.parameters.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.js +23 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.js +29 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.js +30 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.js +25 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.js +26 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.js +28 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.js +33 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.js +26 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.js +25 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.js +25 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.js +20 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.js +20 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.js +59 -0
- package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.js +59 -0
- package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.js +94 -0
- package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.variables.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.variables.fourslash.js +79 -0
- package/dist/tests/fourslash/findDefinitions.variables.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.js +106 -0
- package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.js +24 -0
- package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.js +66 -0
- package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.js +26 -0
- package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.js +36 -0
- package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.fourslash.js +30 -0
- package/dist/tests/fourslash/findallreferences.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.importalias.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.importalias.fourslash.js +30 -0
- package/dist/tests/fourslash/findallreferences.importalias.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.js +46 -0
- package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.module.nested.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.module.nested.fourslash.js +60 -0
- package/dist/tests/fourslash/findallreferences.module.nested.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.js +54 -0
- package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.modules.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.modules.fourslash.js +41 -0
- package/dist/tests/fourslash/findallreferences.modules.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.js +83 -0
- package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.openFiles.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.openFiles.fourslash.js +32 -0
- package/dist/tests/fourslash/findallreferences.openFiles.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.parameter.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.parameter.fourslash.js +22 -0
- package/dist/tests/fourslash/findallreferences.parameter.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.js +29 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.js +33 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.js +36 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.js +44 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.js +31 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.variable.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.variable.fourslash.js +22 -0
- package/dist/tests/fourslash/findallreferences.variable.fourslash.js.map +1 -0
- package/dist/tests/fourslash/fourslash.d.ts +301 -0
- package/dist/tests/fourslash/fourslash.js +25 -0
- package/dist/tests/fourslash/fourslash.js.map +1 -0
- package/dist/tests/fourslash/highlightreferences.attributes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/highlightreferences.attributes.fourslash.js +30 -0
- package/dist/tests/fourslash/highlightreferences.attributes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js +63 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.classNoInit.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.classNoInit.fourslash.js +14 -0
- package/dist/tests/fourslash/hover.classNoInit.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromScr.stringFormat.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromScr.stringFormat.fourslash.js +47 -0
- package/dist/tests/fourslash/hover.docFromScr.stringFormat.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.fourslash.js +77 -0
- package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js +22 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js +22 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js +21 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js +20 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js +38 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js +25 -0
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js +18 -0
- package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docstring.links.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docstring.links.fourslash.js +12 -0
- package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docstring.overloads.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docstring.overloads.fourslash.js +38 -0
- package/dist/tests/fourslash/hover.docstring.overloads.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docstring.split.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js +24 -0
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.fourslash.js +20 -0
- package/dist/tests/fourslash/hover.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.import.django.view.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.import.django.view.fourslash.js +23 -0
- package/dist/tests/fourslash/hover.import.django.view.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.import.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.import.fourslash.js +10 -0
- package/dist/tests/fourslash/hover.import.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js +61 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js +51 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js +40 -0
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js +43 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js +44 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.js +84 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.js +88 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.init.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.init.fourslash.js +38 -0
- package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js +49 -0
- package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js +39 -0
- package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.libStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.libStub.fourslash.js +39 -0
- package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.js +14 -0
- package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.plainText.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.plainText.fourslash.js +20 -0
- package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.typedDict.key.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.typedDict.key.fourslash.js +50 -0
- package/dist/tests/fourslash/hover.typedDict.key.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.variable.docString.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.variable.docString.fourslash.js +35 -0
- package/dist/tests/fourslash/hover.variable.docString.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.wildcardimports.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.wildcardimports.fourslash.js +73 -0
- package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.publicSymbols.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.publicSymbols.fourslash.js +63 -0
- package/dist/tests/fourslash/import.publicSymbols.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.js +72 -0
- package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.js +61 -0
- package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js +35 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js +35 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.wildcard.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.wildcard.fourslash.js +24 -0
- package/dist/tests/fourslash/import.wildcard.fourslash.js.map +1 -0
- package/dist/tests/fourslash/importnotresolved.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/importnotresolved.fourslash.js +13 -0
- package/dist/tests/fourslash/importnotresolved.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.js +18 -0
- package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingModuleSource.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingModuleSource.fourslash.js +13 -0
- package/dist/tests/fourslash/missingModuleSource.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js +31 -0
- package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.d.ts +7 -0
- package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.js +44 -0
- package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.d.ts +7 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.js +35 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.d.ts +7 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.js +35 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingTypeStub.fourslash.js +18 -0
- package/dist/tests/fourslash/missingTypeStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.js +34 -0
- package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.js.map +1 -0
- package/dist/tests/fourslash/noerrors.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/noerrors.fourslash.js +9 -0
- package/dist/tests/fourslash/noerrors.fourslash.js.map +1 -0
- package/dist/tests/fourslash/orderImports1.command.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/orderImports1.command.fourslash.js +17 -0
- package/dist/tests/fourslash/orderImports1.command.fourslash.js.map +1 -0
- package/dist/tests/fourslash/orderImports2.command.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/orderImports2.command.fourslash.js +21 -0
- package/dist/tests/fourslash/orderImports2.command.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.js +23 -0
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js +23 -0
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.fourslash.js +26 -0
- package/dist/tests/fourslash/rename.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.library.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.library.fourslash.js +26 -0
- package/dist/tests/fourslash/rename.library.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.js +29 -0
- package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.multipleDecl.fourslash.d.ts +2 -0
- package/dist/tests/fourslash/rename.multipleDecl.fourslash.js +19 -0
- package/dist/tests/fourslash/rename.multipleDecl.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.sourceAndStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.sourceAndStub.fourslash.js +33 -0
- package/dist/tests/fourslash/rename.sourceAndStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.string.excluded.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.string.excluded.fourslash.js +39 -0
- package/dist/tests/fourslash/rename.string.excluded.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.string.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.string.fourslash.js +25 -0
- package/dist/tests/fourslash/rename.string.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js +62 -0
- package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.complicated.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.complicated.fourslash.js +97 -0
- package/dist/tests/fourslash/signature.complicated.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.cornercases.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.cornercases.fourslash.js +22 -0
- package/dist/tests/fourslash/signature.cornercases.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.docstrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.docstrings.fourslash.js +42 -0
- package/dist/tests/fourslash/signature.docstrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js +49 -0
- package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.js +115 -0
- package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.overload.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.overload.fourslash.js +63 -0
- package/dist/tests/fourslash/signature.overload.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.simple.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.simple.fourslash.js +104 -0
- package/dist/tests/fourslash/signature.simple.fourslash.js.map +1 -0
- package/dist/tests/harness/fourslash/fourSlashParser.d.ts +10 -0
- package/dist/tests/harness/fourslash/fourSlashParser.js +347 -0
- package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -0
- package/dist/tests/harness/fourslash/fourSlashTypes.d.ts +81 -0
- package/dist/tests/harness/fourslash/fourSlashTypes.js +65 -0
- package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -0
- package/dist/tests/harness/fourslash/runner.d.ts +20 -0
- package/dist/tests/harness/fourslash/runner.js +93 -0
- package/dist/tests/harness/fourslash/runner.js.map +1 -0
- package/dist/tests/harness/fourslash/testLanguageService.d.ts +40 -0
- package/dist/tests/harness/fourslash/testLanguageService.js +120 -0
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -0
- package/dist/tests/harness/fourslash/testState.Consts.d.ts +11 -0
- package/dist/tests/harness/fourslash/testState.Consts.js +50 -0
- package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -0
- package/dist/tests/harness/fourslash/testState.d.ts +232 -0
- package/dist/tests/harness/fourslash/testState.js +1381 -0
- package/dist/tests/harness/fourslash/testState.js.map +1 -0
- package/dist/tests/harness/testAccessHost.d.ts +8 -0
- package/dist/tests/harness/testAccessHost.js +26 -0
- package/dist/tests/harness/testAccessHost.js.map +1 -0
- package/dist/tests/harness/testHost.d.ts +16 -0
- package/dist/tests/harness/testHost.js +161 -0
- package/dist/tests/harness/testHost.js.map +1 -0
- package/dist/tests/harness/utils.d.ts +74 -0
- package/dist/tests/harness/utils.js +328 -0
- package/dist/tests/harness/utils.js.map +1 -0
- package/dist/tests/harness/vfs/factory.d.ts +32 -0
- package/dist/tests/harness/vfs/factory.js +173 -0
- package/dist/tests/harness/vfs/factory.js.map +1 -0
- package/dist/tests/harness/vfs/filesystem.d.ts +430 -0
- package/dist/tests/harness/vfs/filesystem.js +1455 -0
- package/dist/tests/harness/vfs/filesystem.js.map +1 -0
- package/dist/tests/harness/vfs/pathValidation.d.ts +24 -0
- package/dist/tests/harness/vfs/pathValidation.js +123 -0
- package/dist/tests/harness/vfs/pathValidation.js.map +1 -0
- package/dist/tests/importAdder.test.d.ts +1 -0
- package/dist/tests/importAdder.test.js +1192 -0
- package/dist/tests/importAdder.test.js.map +1 -0
- package/dist/tests/importResolver.test.d.ts +1 -0
- package/dist/tests/importResolver.test.js +450 -0
- package/dist/tests/importResolver.test.js.map +1 -0
- package/dist/tests/importStatementUtils.test.d.ts +1 -0
- package/dist/tests/importStatementUtils.test.js +371 -0
- package/dist/tests/importStatementUtils.test.js.map +1 -0
- package/dist/tests/indentationUtils.ptvs.test.d.ts +1 -0
- package/dist/tests/indentationUtils.ptvs.test.js +324 -0
- package/dist/tests/indentationUtils.ptvs.test.js.map +1 -0
- package/dist/tests/indentationUtils.reindent.test.d.ts +1 -0
- package/dist/tests/indentationUtils.reindent.test.js +332 -0
- package/dist/tests/indentationUtils.reindent.test.js.map +1 -0
- package/dist/tests/indentationUtils.test.d.ts +1 -0
- package/dist/tests/indentationUtils.test.js +375 -0
- package/dist/tests/indentationUtils.test.js.map +1 -0
- package/dist/tests/ipythonMode.test.d.ts +1 -0
- package/dist/tests/ipythonMode.test.js +303 -0
- package/dist/tests/ipythonMode.test.js.map +1 -0
- package/dist/tests/localizer.test.d.ts +1 -0
- package/dist/tests/localizer.test.js +64 -0
- package/dist/tests/localizer.test.js.map +1 -0
- package/dist/tests/parseTreeUtils.test.d.ts +1 -0
- package/dist/tests/parseTreeUtils.test.js +228 -0
- package/dist/tests/parseTreeUtils.test.js.map +1 -0
- package/dist/tests/parser.test.d.ts +1 -0
- package/dist/tests/parser.test.js +101 -0
- package/dist/tests/parser.test.js.map +1 -0
- package/dist/tests/pathUtils.test.d.ts +1 -0
- package/dist/tests/pathUtils.test.js +253 -0
- package/dist/tests/pathUtils.test.js.map +1 -0
- package/dist/tests/pyrightFileSystem.test.d.ts +1 -0
- package/dist/tests/pyrightFileSystem.test.js +152 -0
- package/dist/tests/pyrightFileSystem.test.js.map +1 -0
- package/dist/tests/renameModule.folder.test.d.ts +1 -0
- package/dist/tests/renameModule.folder.test.js +229 -0
- package/dist/tests/renameModule.folder.test.js.map +1 -0
- package/dist/tests/renameModule.fromImports.test.d.ts +1 -0
- package/dist/tests/renameModule.fromImports.test.js +790 -0
- package/dist/tests/renameModule.fromImports.test.js.map +1 -0
- package/dist/tests/renameModule.imports.test.d.ts +1 -0
- package/dist/tests/renameModule.imports.test.js +380 -0
- package/dist/tests/renameModule.imports.test.js.map +1 -0
- package/dist/tests/renameModule.misc.test.d.ts +1 -0
- package/dist/tests/renameModule.misc.test.js +615 -0
- package/dist/tests/renameModule.misc.test.js.map +1 -0
- package/dist/tests/renameModule.relativePath.test.d.ts +1 -0
- package/dist/tests/renameModule.relativePath.test.js +231 -0
- package/dist/tests/renameModule.relativePath.test.js.map +1 -0
- package/dist/tests/renameModuleTestUtils.d.ts +4 -0
- package/dist/tests/renameModuleTestUtils.js +148 -0
- package/dist/tests/renameModuleTestUtils.js.map +1 -0
- package/dist/tests/sourceFile.test.d.ts +1 -0
- package/dist/tests/sourceFile.test.js +25 -0
- package/dist/tests/sourceFile.test.js.map +1 -0
- package/dist/tests/stringUtils.test.d.ts +1 -0
- package/dist/tests/stringUtils.test.js +69 -0
- package/dist/tests/stringUtils.test.js.map +1 -0
- package/dist/tests/symbolNameUtils.test.d.ts +1 -0
- package/dist/tests/symbolNameUtils.test.js +83 -0
- package/dist/tests/symbolNameUtils.test.js.map +1 -0
- package/dist/tests/testState.test.d.ts +1 -0
- package/dist/tests/testState.test.js +521 -0
- package/dist/tests/testState.test.js.map +1 -0
- package/dist/tests/testUtils.d.ts +27 -0
- package/dist/tests/testUtils.js +213 -0
- package/dist/tests/testUtils.js.map +1 -0
- package/dist/tests/tokenizer.test.d.ts +1 -0
- package/dist/tests/tokenizer.test.js +1277 -0
- package/dist/tests/tokenizer.test.js.map +1 -0
- package/dist/tests/typeEvaluator1.test.d.ts +1 -0
- package/dist/tests/typeEvaluator1.test.js +1023 -0
- package/dist/tests/typeEvaluator1.test.js.map +1 -0
- package/dist/tests/typeEvaluator2.test.d.ts +1 -0
- package/dist/tests/typeEvaluator2.test.js +869 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -0
- package/dist/tests/typeEvaluator3.test.d.ts +1 -0
- package/dist/tests/typeEvaluator3.test.js +915 -0
- package/dist/tests/typeEvaluator3.test.js.map +1 -0
- package/dist/tests/typeEvaluator4.test.d.ts +1 -0
- package/dist/tests/typeEvaluator4.test.js +901 -0
- package/dist/tests/typeEvaluator4.test.js.map +1 -0
- package/dist/tests/updateSymbolReference.test.d.ts +1 -0
- package/dist/tests/updateSymbolReference.test.js +980 -0
- package/dist/tests/updateSymbolReference.test.js.map +1 -0
- package/dist/tests/zipfs.test.d.ts +1 -0
- package/dist/tests/zipfs.test.js +112 -0
- package/dist/tests/zipfs.test.js.map +1 -0
- package/dist/workspaceMap.d.ts +6 -0
- package/dist/workspaceMap.js +73 -0
- package/dist/workspaceMap.js.map +1 -0
- package/package.json +45 -0
@@ -0,0 +1,1617 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
* importResolver.ts
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
5
|
+
* Licensed under the MIT license.
|
6
|
+
* Author: Eric Traut
|
7
|
+
*
|
8
|
+
* Provides the logic for resolving imports according to the
|
9
|
+
* runtime rules of Python.
|
10
|
+
*/
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
12
|
+
if (k2 === undefined) k2 = k;
|
13
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
14
|
+
}) : (function(o, m, k, k2) {
|
15
|
+
if (k2 === undefined) k2 = k;
|
16
|
+
o[k2] = m[k];
|
17
|
+
}));
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
20
|
+
}) : function(o, v) {
|
21
|
+
o["default"] = v;
|
22
|
+
});
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
24
|
+
if (mod && mod.__esModule) return mod;
|
25
|
+
var result = {};
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
27
|
+
__setModuleDefault(result, mod);
|
28
|
+
return result;
|
29
|
+
};
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
31
|
+
exports.ImportResolver = exports.supportedFileExtensions = exports.createImportedModuleDescriptor = void 0;
|
32
|
+
const collectionUtils_1 = require("../common/collectionUtils");
|
33
|
+
const pathConsts_1 = require("../common/pathConsts");
|
34
|
+
const pathUtils_1 = require("../common/pathUtils");
|
35
|
+
const pythonVersion_1 = require("../common/pythonVersion");
|
36
|
+
const stringUtils_1 = require("../common/stringUtils");
|
37
|
+
const StringUtils = __importStar(require("../common/stringUtils"));
|
38
|
+
const characters_1 = require("../parser/characters");
|
39
|
+
const pyrightFileSystem_1 = require("../pyrightFileSystem");
|
40
|
+
const importStatementUtils_1 = require("./importStatementUtils");
|
41
|
+
const parentDirectoryCache_1 = require("./parentDirectoryCache");
|
42
|
+
const PythonPathUtils = __importStar(require("./pythonPathUtils"));
|
43
|
+
const pyTypedUtils_1 = require("./pyTypedUtils");
|
44
|
+
const symbolNameUtils_1 = require("./symbolNameUtils");
|
45
|
+
function createImportedModuleDescriptor(moduleName) {
|
46
|
+
if (moduleName.length === 0) {
|
47
|
+
return { leadingDots: 0, nameParts: [], importedSymbols: [] };
|
48
|
+
}
|
49
|
+
let startIndex = 0;
|
50
|
+
let leadingDots = 0;
|
51
|
+
for (; startIndex < moduleName.length; startIndex++) {
|
52
|
+
if (moduleName[startIndex] !== '.') {
|
53
|
+
break;
|
54
|
+
}
|
55
|
+
leadingDots++;
|
56
|
+
}
|
57
|
+
return {
|
58
|
+
leadingDots,
|
59
|
+
nameParts: moduleName.slice(startIndex).split('.'),
|
60
|
+
importedSymbols: [],
|
61
|
+
};
|
62
|
+
}
|
63
|
+
exports.createImportedModuleDescriptor = createImportedModuleDescriptor;
|
64
|
+
const supportedNativeLibExtensions = ['.pyd', '.so', '.dylib'];
|
65
|
+
exports.supportedFileExtensions = ['.py', '.pyi', ...supportedNativeLibExtensions];
|
66
|
+
// Should we allow partial resolution for third-party packages? Some use tricks
|
67
|
+
// to populate their package namespaces, so we might be able to partially resolve
|
68
|
+
// a multi - part import(e.g. "a.b.c") but not fully resolve it. If this is set to
|
69
|
+
// false, we will have some false positives. If it is set to true, we won't report
|
70
|
+
// errors when these partial-resolutions fail.
|
71
|
+
const allowPartialResolutionForThirdPartyPackages = false;
|
72
|
+
class ImportResolver {
|
73
|
+
constructor(fileSystem, _configOptions, host) {
|
74
|
+
this.fileSystem = fileSystem;
|
75
|
+
this._configOptions = _configOptions;
|
76
|
+
this.host = host;
|
77
|
+
this._cachedImportResults = new Map();
|
78
|
+
this._cachedModuleNameResults = new Map();
|
79
|
+
this._cachedEntriesForPath = new Map();
|
80
|
+
this.cachedParentImportResults = new parentDirectoryCache_1.ParentDirectoryCache(() => this.getPythonSearchPaths([]));
|
81
|
+
}
|
82
|
+
invalidateCache() {
|
83
|
+
this._cachedImportResults = new Map();
|
84
|
+
this._cachedModuleNameResults = new Map();
|
85
|
+
this.cachedParentImportResults.reset();
|
86
|
+
this._invalidateFileSystemCache();
|
87
|
+
if (this.fileSystem instanceof pyrightFileSystem_1.PyrightFileSystem) {
|
88
|
+
this.fileSystem.clearPartialStubs();
|
89
|
+
}
|
90
|
+
}
|
91
|
+
// Resolves the import and returns the path if it exists, otherwise
|
92
|
+
// returns undefined.
|
93
|
+
resolveImport(sourceFilePath, execEnv, moduleDescriptor) {
|
94
|
+
// Wrap internal call to _resolveImport() to prevent calling any
|
95
|
+
// child class version of resolveImport().
|
96
|
+
return this._resolveImport(sourceFilePath, execEnv, moduleDescriptor);
|
97
|
+
}
|
98
|
+
// Resolves the import and returns the path if it exists, otherwise
|
99
|
+
// returns undefined.
|
100
|
+
_resolveImport(sourceFilePath, execEnv, moduleDescriptor) {
|
101
|
+
const importName = this.formatImportName(moduleDescriptor);
|
102
|
+
const importFailureInfo = [];
|
103
|
+
const importResult = this._resolveImportStrict(importName, sourceFilePath, execEnv, moduleDescriptor, importFailureInfo);
|
104
|
+
if (importResult.isImportFound || moduleDescriptor.leadingDots > 0) {
|
105
|
+
return importResult;
|
106
|
+
}
|
107
|
+
// If the import is absolute and no other method works, try resolving the
|
108
|
+
// absolute in the importing file's directory, then the parent directory,
|
109
|
+
// and so on, until the import root is reached.
|
110
|
+
sourceFilePath = (0, pathUtils_1.normalizePathCase)(this.fileSystem, (0, pathUtils_1.normalizePath)(sourceFilePath));
|
111
|
+
const origin = (0, pathUtils_1.ensureTrailingDirectorySeparator)((0, pathUtils_1.getDirectoryPath)(sourceFilePath));
|
112
|
+
const result = this.cachedParentImportResults.getImportResult(origin, importName, importResult);
|
113
|
+
if (result) {
|
114
|
+
// Already ran the parent directory resolution for this import name on this location.
|
115
|
+
return this.filterImplicitImports(result, moduleDescriptor.importedSymbols);
|
116
|
+
}
|
117
|
+
// Check whether the given file is in the parent directory import resolution cache.
|
118
|
+
const root = this.getParentImportResolutionRoot(sourceFilePath, execEnv.root);
|
119
|
+
if (!this.cachedParentImportResults.checkValidPath(this.fileSystem, sourceFilePath, root)) {
|
120
|
+
return importResult;
|
121
|
+
}
|
122
|
+
const importPath = { importPath: undefined };
|
123
|
+
// Going up the given folder one by one until we can resolve the import.
|
124
|
+
let current = origin;
|
125
|
+
while (this._shouldWalkUp(current, root, execEnv)) {
|
126
|
+
const result = this.resolveAbsoluteImport(current, execEnv, moduleDescriptor, importName, [],
|
127
|
+
/* allowPartial */ undefined,
|
128
|
+
/* allowNativeLib */ undefined,
|
129
|
+
/* useStubPackage */ false,
|
130
|
+
/* allowPyi */ true);
|
131
|
+
this.cachedParentImportResults.checked(current, importName, importPath);
|
132
|
+
if (result.isImportFound) {
|
133
|
+
// This will make cache to point to actual path that contains the module we found
|
134
|
+
importPath.importPath = current;
|
135
|
+
this.cachedParentImportResults.add({
|
136
|
+
importResult: result,
|
137
|
+
path: current,
|
138
|
+
importName,
|
139
|
+
});
|
140
|
+
return this.filterImplicitImports(result, moduleDescriptor.importedSymbols);
|
141
|
+
}
|
142
|
+
let success;
|
143
|
+
[success, current] = this._tryWalkUp(current);
|
144
|
+
if (!success) {
|
145
|
+
break;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
this.cachedParentImportResults.checked(current, importName, importPath);
|
149
|
+
return importResult;
|
150
|
+
}
|
151
|
+
_resolveImportStrict(importName, sourceFilePath, execEnv, moduleDescriptor, importFailureInfo) {
|
152
|
+
const notFoundResult = {
|
153
|
+
importName,
|
154
|
+
isRelative: false,
|
155
|
+
isImportFound: false,
|
156
|
+
isPartlyResolved: false,
|
157
|
+
isNamespacePackage: false,
|
158
|
+
isStubPackage: false,
|
159
|
+
importFailureInfo,
|
160
|
+
resolvedPaths: [],
|
161
|
+
importType: 2 /* Local */,
|
162
|
+
isStubFile: false,
|
163
|
+
isNativeLib: false,
|
164
|
+
implicitImports: [],
|
165
|
+
filteredImplicitImports: [],
|
166
|
+
nonStubImportResult: undefined,
|
167
|
+
};
|
168
|
+
this.ensurePartialStubPackages(execEnv);
|
169
|
+
// Is it a relative import?
|
170
|
+
if (moduleDescriptor.leadingDots > 0) {
|
171
|
+
const relativeImport = this._resolveRelativeImport(sourceFilePath, execEnv, moduleDescriptor, importName, importFailureInfo);
|
172
|
+
if (relativeImport) {
|
173
|
+
relativeImport.isRelative = true;
|
174
|
+
return relativeImport;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
else {
|
178
|
+
// Is it already cached?
|
179
|
+
const cachedResults = this._lookUpResultsInCache(execEnv, importName, moduleDescriptor.importedSymbols);
|
180
|
+
if (cachedResults) {
|
181
|
+
// In most cases, we can simply return a cached entry. However, there are cases
|
182
|
+
// where the cached entry refers to a previously-resolved namespace package
|
183
|
+
// that does not resolve the symbols specified in the module descriptor.
|
184
|
+
// In this case, we will ignore the cached value and run the full import
|
185
|
+
// resolution again to try to find a package that resolves the import.
|
186
|
+
const isUnresolvedNamespace = cachedResults.isImportFound &&
|
187
|
+
cachedResults.isNamespacePackage &&
|
188
|
+
!this._isNamespacePackageResolved(moduleDescriptor, cachedResults.implicitImports);
|
189
|
+
if (!isUnresolvedNamespace) {
|
190
|
+
return cachedResults;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
const bestImport = this._resolveBestAbsoluteImport(sourceFilePath, execEnv, moduleDescriptor,
|
194
|
+
/* allowPyi */ true);
|
195
|
+
if (bestImport) {
|
196
|
+
if (bestImport.isStubFile) {
|
197
|
+
bestImport.nonStubImportResult =
|
198
|
+
this._resolveBestAbsoluteImport(sourceFilePath, execEnv, moduleDescriptor,
|
199
|
+
/* allowPyi */ false) || notFoundResult;
|
200
|
+
}
|
201
|
+
return this.addResultsToCache(execEnv, importName, bestImport, moduleDescriptor.importedSymbols);
|
202
|
+
}
|
203
|
+
}
|
204
|
+
return this.addResultsToCache(execEnv, importName, notFoundResult, /* importedSymbols */ undefined);
|
205
|
+
}
|
206
|
+
getCompletionSuggestions(sourceFilePath, execEnv, moduleDescriptor) {
|
207
|
+
const suggestions = this._getCompletionSuggestionsStrict(sourceFilePath, execEnv, moduleDescriptor);
|
208
|
+
// We only do parent import resolution for absolute path.
|
209
|
+
if (moduleDescriptor.leadingDots > 0) {
|
210
|
+
return suggestions;
|
211
|
+
}
|
212
|
+
const root = this.getParentImportResolutionRoot(sourceFilePath, execEnv.root);
|
213
|
+
const origin = (0, pathUtils_1.ensureTrailingDirectorySeparator)((0, pathUtils_1.getDirectoryPath)((0, pathUtils_1.normalizePathCase)(this.fileSystem, (0, pathUtils_1.normalizePath)(sourceFilePath))));
|
214
|
+
let current = origin;
|
215
|
+
while (this._shouldWalkUp(current, root, execEnv)) {
|
216
|
+
this._getCompletionSuggestionsAbsolute(sourceFilePath, execEnv, current, moduleDescriptor, suggestions,
|
217
|
+
/* strictOnly */ false);
|
218
|
+
let success;
|
219
|
+
[success, current] = this._tryWalkUp(current);
|
220
|
+
if (!success) {
|
221
|
+
break;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
return suggestions;
|
225
|
+
}
|
226
|
+
getConfigOption() {
|
227
|
+
return this._configOptions;
|
228
|
+
}
|
229
|
+
_getCompletionSuggestionsStrict(sourceFilePath, execEnv, moduleDescriptor) {
|
230
|
+
const importFailureInfo = [];
|
231
|
+
const suggestions = new Set();
|
232
|
+
// Is it a relative import?
|
233
|
+
if (moduleDescriptor.leadingDots > 0) {
|
234
|
+
this._getCompletionSuggestionsRelative(sourceFilePath, execEnv, moduleDescriptor, suggestions);
|
235
|
+
}
|
236
|
+
else {
|
237
|
+
// First check for a typeshed file.
|
238
|
+
if (moduleDescriptor.nameParts.length > 0) {
|
239
|
+
this._getCompletionSuggestionsTypeshedPath(sourceFilePath, execEnv, moduleDescriptor, true, suggestions);
|
240
|
+
}
|
241
|
+
// Look for it in the root directory of the execution environment.
|
242
|
+
if (execEnv.root) {
|
243
|
+
this._getCompletionSuggestionsAbsolute(sourceFilePath, execEnv, execEnv.root, moduleDescriptor, suggestions);
|
244
|
+
}
|
245
|
+
for (const extraPath of execEnv.extraPaths) {
|
246
|
+
this._getCompletionSuggestionsAbsolute(sourceFilePath, execEnv, extraPath, moduleDescriptor, suggestions);
|
247
|
+
}
|
248
|
+
// Check for a typings file.
|
249
|
+
if (this._configOptions.stubPath) {
|
250
|
+
this._getCompletionSuggestionsAbsolute(sourceFilePath, execEnv, this._configOptions.stubPath, moduleDescriptor, suggestions);
|
251
|
+
}
|
252
|
+
// Check for a typeshed file.
|
253
|
+
this._getCompletionSuggestionsTypeshedPath(sourceFilePath, execEnv, moduleDescriptor, false, suggestions);
|
254
|
+
// Look for the import in the list of third-party packages.
|
255
|
+
const pythonSearchPaths = this.getPythonSearchPaths(importFailureInfo);
|
256
|
+
for (const searchPath of pythonSearchPaths) {
|
257
|
+
this._getCompletionSuggestionsAbsolute(sourceFilePath, execEnv, searchPath, moduleDescriptor, suggestions);
|
258
|
+
}
|
259
|
+
}
|
260
|
+
return suggestions;
|
261
|
+
}
|
262
|
+
// Returns the implementation file(s) for the given stub file.
|
263
|
+
getSourceFilesFromStub(stubFilePath, execEnv, _mapCompiled) {
|
264
|
+
const sourceFilePaths = [];
|
265
|
+
// When ImportResolver resolves an import to a stub file, a second resolve is done
|
266
|
+
// ignoring stub files, which gives us an approximation of where the implementation
|
267
|
+
// for that stub is located.
|
268
|
+
this._cachedImportResults.forEach((map) => {
|
269
|
+
map.forEach((result) => {
|
270
|
+
if (result.isStubFile && result.isImportFound && result.nonStubImportResult) {
|
271
|
+
if (result.resolvedPaths[result.resolvedPaths.length - 1] === stubFilePath) {
|
272
|
+
if (result.nonStubImportResult.isImportFound) {
|
273
|
+
const nonEmptyPath = result.nonStubImportResult.resolvedPaths[result.nonStubImportResult.resolvedPaths.length - 1];
|
274
|
+
if (nonEmptyPath.endsWith('.py') || nonEmptyPath.endsWith('.pyi')) {
|
275
|
+
// We allow pyi in case there are multiple pyi for a compiled module such as
|
276
|
+
// numpy.random.mtrand
|
277
|
+
sourceFilePaths.push(nonEmptyPath);
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}
|
281
|
+
}
|
282
|
+
});
|
283
|
+
});
|
284
|
+
// We haven't seen an import of that stub, attempt to find the source
|
285
|
+
// in some other ways.
|
286
|
+
if (sourceFilePaths.length === 0) {
|
287
|
+
// Simple case where the stub and source files are next to each other.
|
288
|
+
const sourceFilePath = (0, pathUtils_1.changeAnyExtension)(stubFilePath, '.py');
|
289
|
+
if (this.dirExistsCached(sourceFilePath)) {
|
290
|
+
sourceFilePaths.push(sourceFilePath);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
if (sourceFilePaths.length === 0) {
|
294
|
+
// The stub and the source file may have the same name, but be located
|
295
|
+
// in different folder hierarchies.
|
296
|
+
// Example:
|
297
|
+
// <stubPath>\package\module.pyi
|
298
|
+
// <site-packages>\package\module.py
|
299
|
+
// We get the relative path(s) of the stub to its import root(s),
|
300
|
+
// in theory there can be more than one, then look for source
|
301
|
+
// files in all the import roots using the same relative path(s).
|
302
|
+
const importRootPaths = this.getImportRoots(execEnv);
|
303
|
+
const relativeStubPaths = [];
|
304
|
+
for (const importRootPath of importRootPaths) {
|
305
|
+
if ((0, pathUtils_1.containsPath)(importRootPath, stubFilePath, true)) {
|
306
|
+
const parts = (0, pathUtils_1.getRelativePathComponentsFromDirectory)(importRootPath, stubFilePath, true);
|
307
|
+
// Note that relative paths have an empty parts[0]
|
308
|
+
if (parts.length > 1) {
|
309
|
+
// Handle the case where the symbol was resolved to a stubs package
|
310
|
+
// rather than the real package. We'll strip off the "-stubs" suffix
|
311
|
+
// in this case.
|
312
|
+
if (parts[1].endsWith(pathConsts_1.stubsSuffix)) {
|
313
|
+
parts[1] = parts[1].substr(0, parts[1].length - pathConsts_1.stubsSuffix.length);
|
314
|
+
}
|
315
|
+
const relativeStubPath = (0, pathUtils_1.combinePathComponents)(parts);
|
316
|
+
if (relativeStubPath) {
|
317
|
+
relativeStubPaths.push(relativeStubPath);
|
318
|
+
}
|
319
|
+
}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
for (const relativeStubPath of relativeStubPaths) {
|
323
|
+
for (const importRootPath of importRootPaths) {
|
324
|
+
const absoluteStubPath = (0, pathUtils_1.resolvePaths)(importRootPath, relativeStubPath);
|
325
|
+
let absoluteSourcePath = (0, pathUtils_1.changeAnyExtension)(absoluteStubPath, '.py');
|
326
|
+
if (this.fileExistsCached(absoluteSourcePath)) {
|
327
|
+
sourceFilePaths.push(absoluteSourcePath);
|
328
|
+
}
|
329
|
+
else {
|
330
|
+
const filePathWithoutExtension = (0, pathUtils_1.stripFileExtension)(absoluteSourcePath);
|
331
|
+
if (filePathWithoutExtension.endsWith('__init__')) {
|
332
|
+
// Did not match: <root>/package/__init__.py
|
333
|
+
// Try equivalent: <root>/package.py
|
334
|
+
absoluteSourcePath =
|
335
|
+
filePathWithoutExtension.substr(0, filePathWithoutExtension.length - 9) + '.py';
|
336
|
+
if (this.fileExistsCached(absoluteSourcePath)) {
|
337
|
+
sourceFilePaths.push(absoluteSourcePath);
|
338
|
+
}
|
339
|
+
}
|
340
|
+
else {
|
341
|
+
// Did not match: <root>/package.py
|
342
|
+
// Try equivalent: <root>/package/__init__.py
|
343
|
+
absoluteSourcePath = (0, pathUtils_1.combinePaths)(filePathWithoutExtension, '__init__.py');
|
344
|
+
if (this.fileExistsCached(absoluteSourcePath)) {
|
345
|
+
sourceFilePaths.push(absoluteSourcePath);
|
346
|
+
}
|
347
|
+
}
|
348
|
+
}
|
349
|
+
}
|
350
|
+
}
|
351
|
+
}
|
352
|
+
return sourceFilePaths;
|
353
|
+
}
|
354
|
+
// Returns the module name (of the form X.Y.Z) that needs to be imported
|
355
|
+
// from the current context to access the module with the specified file path.
|
356
|
+
// In a sense, it's performing the inverse of resolveImport.
|
357
|
+
getModuleNameForImport(filePath, execEnv) {
|
358
|
+
// Cache results of the reverse of resolveImport as we cache resolveImport.
|
359
|
+
const cache = (0, collectionUtils_1.getOrAdd)(this._cachedModuleNameResults, execEnv.root, () => new Map());
|
360
|
+
return (0, collectionUtils_1.getOrAdd)(cache, filePath, () => this._getModuleNameForImport(filePath, execEnv));
|
361
|
+
}
|
362
|
+
_getModuleNameForImport(filePath, execEnv) {
|
363
|
+
let moduleName;
|
364
|
+
let importType = 0 /* BuiltIn */;
|
365
|
+
let isLocalTypingsFile = false;
|
366
|
+
const importFailureInfo = [];
|
367
|
+
// Is this a stdlib typeshed path?
|
368
|
+
const stdLibTypeshedPath = this._getStdlibTypeshedPath(execEnv, importFailureInfo);
|
369
|
+
if (stdLibTypeshedPath) {
|
370
|
+
moduleName = this.getModuleNameFromPath(stdLibTypeshedPath, filePath);
|
371
|
+
if (moduleName) {
|
372
|
+
const moduleDescriptor = {
|
373
|
+
leadingDots: 0,
|
374
|
+
nameParts: moduleName.split('.'),
|
375
|
+
importedSymbols: undefined,
|
376
|
+
};
|
377
|
+
if (this._isStdlibTypeshedStubValidForVersion(moduleDescriptor, execEnv, [])) {
|
378
|
+
return { moduleName, importType, isLocalTypingsFile };
|
379
|
+
}
|
380
|
+
}
|
381
|
+
}
|
382
|
+
// Look for it in the root directory of the execution environment.
|
383
|
+
if (execEnv.root) {
|
384
|
+
moduleName = this.getModuleNameFromPath(execEnv.root, filePath);
|
385
|
+
importType = 2 /* Local */;
|
386
|
+
}
|
387
|
+
for (const extraPath of execEnv.extraPaths) {
|
388
|
+
const candidateModuleName = this.getModuleNameFromPath(extraPath, filePath);
|
389
|
+
// Does this candidate look better than the previous best module name?
|
390
|
+
// We'll always try to use the shortest version.
|
391
|
+
if (!moduleName || (candidateModuleName && candidateModuleName.length < moduleName.length)) {
|
392
|
+
moduleName = candidateModuleName;
|
393
|
+
importType = 2 /* Local */;
|
394
|
+
}
|
395
|
+
}
|
396
|
+
// Check for a typings file.
|
397
|
+
if (this._configOptions.stubPath) {
|
398
|
+
const candidateModuleName = this.getModuleNameFromPath(this._configOptions.stubPath, filePath);
|
399
|
+
// Does this candidate look better than the previous best module name?
|
400
|
+
// We'll always try to use the shortest version.
|
401
|
+
if (!moduleName || (candidateModuleName && candidateModuleName.length < moduleName.length)) {
|
402
|
+
moduleName = candidateModuleName;
|
403
|
+
// Treat the typings path as a local import so errors are reported for it.
|
404
|
+
importType = 2 /* Local */;
|
405
|
+
isLocalTypingsFile = true;
|
406
|
+
}
|
407
|
+
}
|
408
|
+
// Check for a typeshed file.
|
409
|
+
const thirdPartyTypeshedPath = this._getThirdPartyTypeshedPath(execEnv, importFailureInfo);
|
410
|
+
if (thirdPartyTypeshedPath) {
|
411
|
+
const candidateModuleName = this.getModuleNameFromPath(thirdPartyTypeshedPath, filePath,
|
412
|
+
/* stripTopContainerDir */ true);
|
413
|
+
// Does this candidate look better than the previous best module name?
|
414
|
+
// We'll always try to use the shortest version.
|
415
|
+
if (!moduleName || (candidateModuleName && candidateModuleName.length < moduleName.length)) {
|
416
|
+
moduleName = candidateModuleName;
|
417
|
+
importType = 1 /* ThirdParty */;
|
418
|
+
}
|
419
|
+
}
|
420
|
+
const thirdPartyTypeshedPathEx = this.getTypeshedPathEx(execEnv, importFailureInfo);
|
421
|
+
if (thirdPartyTypeshedPathEx) {
|
422
|
+
const candidateModuleName = this.getModuleNameFromPath(thirdPartyTypeshedPathEx, filePath);
|
423
|
+
// Does this candidate look better than the previous best module name?
|
424
|
+
// We'll always try to use the shortest version.
|
425
|
+
if (!moduleName || (candidateModuleName && candidateModuleName.length < moduleName.length)) {
|
426
|
+
moduleName = candidateModuleName;
|
427
|
+
importType = 1 /* ThirdParty */;
|
428
|
+
}
|
429
|
+
}
|
430
|
+
// Look for the import in the list of third-party packages.
|
431
|
+
const pythonSearchPaths = this.getPythonSearchPaths(importFailureInfo);
|
432
|
+
for (const searchPath of pythonSearchPaths) {
|
433
|
+
const candidateModuleName = this.getModuleNameFromPath(searchPath, filePath);
|
434
|
+
// Does this candidate look better than the previous best module name?
|
435
|
+
// We'll always try to use the shortest version.
|
436
|
+
if (!moduleName || (candidateModuleName && candidateModuleName.length < moduleName.length)) {
|
437
|
+
moduleName = candidateModuleName;
|
438
|
+
importType = 1 /* ThirdParty */;
|
439
|
+
}
|
440
|
+
}
|
441
|
+
if (moduleName) {
|
442
|
+
return { moduleName, importType, isLocalTypingsFile };
|
443
|
+
}
|
444
|
+
// We didn't find any module name.
|
445
|
+
return { moduleName: '', importType: 2 /* Local */, isLocalTypingsFile };
|
446
|
+
}
|
447
|
+
getTypeshedStdLibPath(execEnv) {
|
448
|
+
const unused = [];
|
449
|
+
return this._getStdlibTypeshedPath(execEnv, unused);
|
450
|
+
}
|
451
|
+
getImportRoots(execEnv, forLogging = false) {
|
452
|
+
const importFailureInfo = [];
|
453
|
+
const roots = [];
|
454
|
+
const stdTypeshed = this._getStdlibTypeshedPath(execEnv, importFailureInfo);
|
455
|
+
if (stdTypeshed) {
|
456
|
+
roots.push(stdTypeshed);
|
457
|
+
}
|
458
|
+
// The "default" workspace has a root-less execution environment; ignore it.
|
459
|
+
if (execEnv.root) {
|
460
|
+
roots.push(execEnv.root);
|
461
|
+
}
|
462
|
+
(0, collectionUtils_1.appendArray)(roots, execEnv.extraPaths);
|
463
|
+
if (this._configOptions.stubPath) {
|
464
|
+
roots.push(this._configOptions.stubPath);
|
465
|
+
}
|
466
|
+
if (forLogging) {
|
467
|
+
// There's one path for each third party package, which blows up logging.
|
468
|
+
// Just get the root directly and show it with `...` to indicate that this
|
469
|
+
// is where the third party folder is in the roots.
|
470
|
+
const thirdPartyRoot = this._getThirdPartyTypeshedPath(execEnv, importFailureInfo);
|
471
|
+
if (thirdPartyRoot) {
|
472
|
+
roots.push((0, pathUtils_1.combinePaths)(thirdPartyRoot, '...'));
|
473
|
+
}
|
474
|
+
}
|
475
|
+
else {
|
476
|
+
const thirdPartyPaths = this._getThirdPartyTypeshedPackageRoots(execEnv, importFailureInfo);
|
477
|
+
(0, collectionUtils_1.appendArray)(roots, thirdPartyPaths);
|
478
|
+
}
|
479
|
+
const typeshedPathEx = this.getTypeshedPathEx(execEnv, importFailureInfo);
|
480
|
+
if (typeshedPathEx) {
|
481
|
+
roots.push(typeshedPathEx);
|
482
|
+
}
|
483
|
+
const pythonSearchPaths = this.getPythonSearchPaths(importFailureInfo);
|
484
|
+
if (pythonSearchPaths.length > 0) {
|
485
|
+
(0, collectionUtils_1.appendArray)(roots, pythonSearchPaths);
|
486
|
+
}
|
487
|
+
return roots;
|
488
|
+
}
|
489
|
+
readdirEntriesCached(path) {
|
490
|
+
const cachedValue = this._cachedEntriesForPath.get(path);
|
491
|
+
if (cachedValue) {
|
492
|
+
return cachedValue;
|
493
|
+
}
|
494
|
+
let newCacheValue;
|
495
|
+
try {
|
496
|
+
newCacheValue = this.fileSystem.readdirEntriesSync(path);
|
497
|
+
}
|
498
|
+
catch {
|
499
|
+
newCacheValue = [];
|
500
|
+
}
|
501
|
+
// Populate cache for next time.
|
502
|
+
this._cachedEntriesForPath.set(path, newCacheValue);
|
503
|
+
return newCacheValue;
|
504
|
+
}
|
505
|
+
fileExistsCached(path) {
|
506
|
+
var _a, _b;
|
507
|
+
const splitPath = this._splitPath(path);
|
508
|
+
if (!splitPath[0] || !splitPath[1]) {
|
509
|
+
if (!this.fileSystem.existsSync(path)) {
|
510
|
+
return false;
|
511
|
+
}
|
512
|
+
return (_b = (_a = (0, pathUtils_1.tryStat)(this.fileSystem, path)) === null || _a === void 0 ? void 0 : _a.isFile()) !== null && _b !== void 0 ? _b : false;
|
513
|
+
}
|
514
|
+
const entries = this.readdirEntriesCached(splitPath[0]);
|
515
|
+
const entry = entries.find((entry) => entry.name === splitPath[1]);
|
516
|
+
if (entry === null || entry === void 0 ? void 0 : entry.isFile()) {
|
517
|
+
return true;
|
518
|
+
}
|
519
|
+
if (entry === null || entry === void 0 ? void 0 : entry.isSymbolicLink()) {
|
520
|
+
const realPath = (0, pathUtils_1.tryRealpath)(this.fileSystem, path);
|
521
|
+
if (realPath && this.fileSystem.existsSync(realPath) && (0, pathUtils_1.isFile)(this.fileSystem, realPath)) {
|
522
|
+
return true;
|
523
|
+
}
|
524
|
+
}
|
525
|
+
return false;
|
526
|
+
}
|
527
|
+
dirExistsCached(path) {
|
528
|
+
var _a, _b;
|
529
|
+
const splitPath = this._splitPath(path);
|
530
|
+
if (!splitPath[0] || !splitPath[1]) {
|
531
|
+
if (!this.fileSystem.existsSync(path)) {
|
532
|
+
return false;
|
533
|
+
}
|
534
|
+
return (_b = (_a = (0, pathUtils_1.tryStat)(this.fileSystem, path)) === null || _a === void 0 ? void 0 : _a.isDirectory()) !== null && _b !== void 0 ? _b : false;
|
535
|
+
}
|
536
|
+
const entries = this.readdirEntriesCached(splitPath[0]);
|
537
|
+
const entry = entries.find((entry) => entry.name === splitPath[1]);
|
538
|
+
if (entry === null || entry === void 0 ? void 0 : entry.isDirectory()) {
|
539
|
+
return true;
|
540
|
+
}
|
541
|
+
if (entry === null || entry === void 0 ? void 0 : entry.isSymbolicLink()) {
|
542
|
+
const realPath = (0, pathUtils_1.tryRealpath)(this.fileSystem, path);
|
543
|
+
if (realPath && this.fileSystem.existsSync(realPath) && (0, pathUtils_1.isDirectory)(this.fileSystem, realPath)) {
|
544
|
+
return true;
|
545
|
+
}
|
546
|
+
}
|
547
|
+
return false;
|
548
|
+
}
|
549
|
+
ensurePartialStubPackages(execEnv) {
|
550
|
+
if (!(this.fileSystem instanceof pyrightFileSystem_1.PyrightFileSystem)) {
|
551
|
+
return false;
|
552
|
+
}
|
553
|
+
if (this.fileSystem.isPartialStubPackagesScanned(execEnv)) {
|
554
|
+
return false;
|
555
|
+
}
|
556
|
+
const fs = this.fileSystem;
|
557
|
+
const ignored = [];
|
558
|
+
const paths = [];
|
559
|
+
// Add paths to search stub packages.
|
560
|
+
addPaths(this._configOptions.stubPath);
|
561
|
+
addPaths(execEnv.root);
|
562
|
+
execEnv.extraPaths.forEach((p) => addPaths(p));
|
563
|
+
addPaths(this.getTypeshedPathEx(execEnv, ignored));
|
564
|
+
this.getPythonSearchPaths(ignored).forEach((p) => addPaths(p));
|
565
|
+
this.fileSystem.processPartialStubPackages(paths, this.getImportRoots(execEnv));
|
566
|
+
this._invalidateFileSystemCache();
|
567
|
+
return true;
|
568
|
+
function addPaths(path) {
|
569
|
+
if (!path || fs.isPathScanned(path)) {
|
570
|
+
return;
|
571
|
+
}
|
572
|
+
paths.push(path);
|
573
|
+
}
|
574
|
+
}
|
575
|
+
addResultsToCache(execEnv, importName, importResult, importedSymbols) {
|
576
|
+
(0, collectionUtils_1.getOrAdd)(this._cachedImportResults, execEnv.root, () => new Map()).set(importName, importResult);
|
577
|
+
return this.filterImplicitImports(importResult, importedSymbols);
|
578
|
+
}
|
579
|
+
// Follows import resolution algorithm defined in PEP-420:
|
580
|
+
// https://www.python.org/dev/peps/pep-0420/
|
581
|
+
resolveAbsoluteImport(rootPath, execEnv, moduleDescriptor, importName, importFailureInfo, allowPartial = false, allowNativeLib = false, useStubPackage = false, allowPyi = true, lookForPyTyped = false) {
|
582
|
+
if (allowPyi && useStubPackage) {
|
583
|
+
// Look for packaged stubs first. PEP 561 indicates that package authors can ship
|
584
|
+
// their stubs separately from their package implementation by appending the string
|
585
|
+
// '-stubs' to its top - level directory name. We'll look there first.
|
586
|
+
const importResult = this._resolveAbsoluteImport(rootPath, execEnv, moduleDescriptor, importName, importFailureInfo, allowPartial,
|
587
|
+
/* allowNativeLib */ false,
|
588
|
+
/* useStubPackage */ true,
|
589
|
+
/* allowPyi */ true,
|
590
|
+
/* lookForPyTyped */ true);
|
591
|
+
// We found fully typed stub packages.
|
592
|
+
if (importResult.packageDirectory) {
|
593
|
+
// If this is a namespace package that wasn't resolved, assume that
|
594
|
+
// it's a partial stub package and continue looking for a real package.
|
595
|
+
if (!importResult.isNamespacePackage || importResult.isImportFound) {
|
596
|
+
return importResult;
|
597
|
+
}
|
598
|
+
}
|
599
|
+
}
|
600
|
+
return this._resolveAbsoluteImport(rootPath, execEnv, moduleDescriptor, importName, importFailureInfo, allowPartial, allowNativeLib,
|
601
|
+
/* useStubPackage */ false, allowPyi, lookForPyTyped);
|
602
|
+
}
|
603
|
+
_invalidateFileSystemCache() {
|
604
|
+
this._cachedEntriesForPath.clear();
|
605
|
+
}
|
606
|
+
// Splits a path into the name of the containing directory and
|
607
|
+
// a file or dir within that containing directory.
|
608
|
+
_splitPath(path) {
|
609
|
+
const pathComponents = (0, pathUtils_1.getPathComponents)(path);
|
610
|
+
if (pathComponents.length <= 1) {
|
611
|
+
return [path, ''];
|
612
|
+
}
|
613
|
+
const containingPath = (0, pathUtils_1.combinePathComponents)(pathComponents.slice(0, -1));
|
614
|
+
const fileOrDirName = pathComponents[pathComponents.length - 1];
|
615
|
+
return [containingPath, fileOrDirName];
|
616
|
+
}
|
617
|
+
_resolveAbsoluteImport(rootPath, execEnv, moduleDescriptor, importName, importFailureInfo, allowPartial, allowNativeLib, useStubPackage, allowPyi, lookForPyTyped) {
|
618
|
+
if (useStubPackage) {
|
619
|
+
importFailureInfo.push(`Attempting to resolve stub package using root path '${rootPath}'`);
|
620
|
+
}
|
621
|
+
else {
|
622
|
+
importFailureInfo.push(`Attempting to resolve using root path '${rootPath}'`);
|
623
|
+
}
|
624
|
+
// Starting at the specified path, walk the file system to find the
|
625
|
+
// specified module.
|
626
|
+
const resolvedPaths = [];
|
627
|
+
let dirPath = rootPath;
|
628
|
+
let isNamespacePackage = false;
|
629
|
+
let isStubPackage = false;
|
630
|
+
let isStubFile = false;
|
631
|
+
let isNativeLib = false;
|
632
|
+
let implicitImports = [];
|
633
|
+
let packageDirectory;
|
634
|
+
let pyTypedInfo;
|
635
|
+
// Handle the "from . import XXX" case.
|
636
|
+
if (moduleDescriptor.nameParts.length === 0) {
|
637
|
+
const fileNameWithoutExtension = '__init__';
|
638
|
+
const pyFilePath = (0, pathUtils_1.combinePaths)(dirPath, fileNameWithoutExtension + '.py');
|
639
|
+
const pyiFilePath = (0, pathUtils_1.combinePaths)(dirPath, fileNameWithoutExtension + '.pyi');
|
640
|
+
if (allowPyi && this.fileExistsCached(pyiFilePath)) {
|
641
|
+
importFailureInfo.push(`Resolved import with file '${pyiFilePath}'`);
|
642
|
+
resolvedPaths.push(pyiFilePath);
|
643
|
+
isStubFile = true;
|
644
|
+
}
|
645
|
+
else if (this.fileExistsCached(pyFilePath)) {
|
646
|
+
importFailureInfo.push(`Resolved import with file '${pyFilePath}'`);
|
647
|
+
resolvedPaths.push(pyFilePath);
|
648
|
+
}
|
649
|
+
else {
|
650
|
+
importFailureInfo.push(`Partially resolved import with directory '${dirPath}'`);
|
651
|
+
resolvedPaths.push('');
|
652
|
+
isNamespacePackage = true;
|
653
|
+
}
|
654
|
+
implicitImports = this._findImplicitImports(importName, dirPath, [pyFilePath, pyiFilePath]);
|
655
|
+
}
|
656
|
+
else {
|
657
|
+
for (let i = 0; i < moduleDescriptor.nameParts.length; i++) {
|
658
|
+
const isFirstPart = i === 0;
|
659
|
+
const isLastPart = i === moduleDescriptor.nameParts.length - 1;
|
660
|
+
dirPath = (0, pathUtils_1.combinePaths)(dirPath, moduleDescriptor.nameParts[i]);
|
661
|
+
if (useStubPackage && isFirstPart) {
|
662
|
+
dirPath += pathConsts_1.stubsSuffix;
|
663
|
+
isStubPackage = true;
|
664
|
+
}
|
665
|
+
const foundDirectory = this.dirExistsCached(dirPath);
|
666
|
+
if (foundDirectory) {
|
667
|
+
if (isFirstPart) {
|
668
|
+
packageDirectory = dirPath;
|
669
|
+
}
|
670
|
+
// See if we can find an __init__.py[i] in this directory.
|
671
|
+
const fileNameWithoutExtension = '__init__';
|
672
|
+
const pyFilePath = (0, pathUtils_1.combinePaths)(dirPath, fileNameWithoutExtension + '.py');
|
673
|
+
const pyiFilePath = (0, pathUtils_1.combinePaths)(dirPath, fileNameWithoutExtension + '.pyi');
|
674
|
+
let foundInit = false;
|
675
|
+
if (allowPyi && this.fileExistsCached(pyiFilePath)) {
|
676
|
+
importFailureInfo.push(`Resolved import with file '${pyiFilePath}'`);
|
677
|
+
resolvedPaths.push(pyiFilePath);
|
678
|
+
if (isLastPart) {
|
679
|
+
isStubFile = true;
|
680
|
+
}
|
681
|
+
foundInit = true;
|
682
|
+
}
|
683
|
+
else if (this.fileExistsCached(pyFilePath)) {
|
684
|
+
importFailureInfo.push(`Resolved import with file '${pyFilePath}'`);
|
685
|
+
resolvedPaths.push(pyFilePath);
|
686
|
+
foundInit = true;
|
687
|
+
}
|
688
|
+
if (!pyTypedInfo && lookForPyTyped) {
|
689
|
+
if (this.fileExistsCached((0, pathUtils_1.combinePaths)(dirPath, 'py.typed'))) {
|
690
|
+
pyTypedInfo = (0, pyTypedUtils_1.getPyTypedInfo)(this.fileSystem, dirPath);
|
691
|
+
}
|
692
|
+
}
|
693
|
+
if (!isLastPart) {
|
694
|
+
// We are not at the last part, and we found a directory,
|
695
|
+
// so continue to look for the next part.
|
696
|
+
if (!foundInit) {
|
697
|
+
resolvedPaths.push('');
|
698
|
+
isNamespacePackage = true;
|
699
|
+
pyTypedInfo = undefined;
|
700
|
+
}
|
701
|
+
continue;
|
702
|
+
}
|
703
|
+
if (foundInit) {
|
704
|
+
implicitImports = this._findImplicitImports(moduleDescriptor.nameParts.join('.'), dirPath, [
|
705
|
+
pyFilePath,
|
706
|
+
pyiFilePath,
|
707
|
+
]);
|
708
|
+
break;
|
709
|
+
}
|
710
|
+
}
|
711
|
+
// We weren't able to find a directory or we found a directory with
|
712
|
+
// no __init__.py[i] file. See if we can find a ".py" or ".pyi" file
|
713
|
+
// with this name.
|
714
|
+
let fileDirectory = (0, pathUtils_1.stripTrailingDirectorySeparator)(dirPath);
|
715
|
+
const fileNameWithoutExtension = (0, pathUtils_1.getFileName)(fileDirectory);
|
716
|
+
fileDirectory = (0, pathUtils_1.getDirectoryPath)(fileDirectory);
|
717
|
+
const pyFilePath = (0, pathUtils_1.combinePaths)(fileDirectory, fileNameWithoutExtension + '.py');
|
718
|
+
const pyiFilePath = (0, pathUtils_1.combinePaths)(fileDirectory, fileNameWithoutExtension + '.pyi');
|
719
|
+
if (allowPyi && this.fileExistsCached(pyiFilePath)) {
|
720
|
+
importFailureInfo.push(`Resolved import with file '${pyiFilePath}'`);
|
721
|
+
resolvedPaths.push(pyiFilePath);
|
722
|
+
if (isLastPart) {
|
723
|
+
isStubFile = true;
|
724
|
+
}
|
725
|
+
}
|
726
|
+
else if (this.fileExistsCached(pyFilePath)) {
|
727
|
+
importFailureInfo.push(`Resolved import with file '${pyFilePath}'`);
|
728
|
+
resolvedPaths.push(pyFilePath);
|
729
|
+
}
|
730
|
+
else {
|
731
|
+
if (allowNativeLib && this.dirExistsCached(fileDirectory)) {
|
732
|
+
const filesInDir = this._getFilesInDirectory(fileDirectory);
|
733
|
+
const nativeLibFileName = filesInDir.find((f) => this._isNativeModuleFileName(fileNameWithoutExtension, f));
|
734
|
+
if (nativeLibFileName) {
|
735
|
+
const nativeLibPath = (0, pathUtils_1.combinePaths)(fileDirectory, nativeLibFileName);
|
736
|
+
// Try resolving native library to a custom stub.
|
737
|
+
isNativeLib = this._resolveNativeModuleStub(nativeLibPath, execEnv, importName, moduleDescriptor, importFailureInfo, resolvedPaths);
|
738
|
+
}
|
739
|
+
}
|
740
|
+
if (!isNativeLib && foundDirectory) {
|
741
|
+
importFailureInfo.push(`Partially resolved import with directory '${dirPath}'`);
|
742
|
+
resolvedPaths.push('');
|
743
|
+
if (isLastPart) {
|
744
|
+
implicitImports = this._findImplicitImports(importName, dirPath, [pyFilePath, pyiFilePath]);
|
745
|
+
isNamespacePackage = true;
|
746
|
+
}
|
747
|
+
}
|
748
|
+
else if (isNativeLib) {
|
749
|
+
importFailureInfo.push(`Did not find file '${pyiFilePath}' or '${pyFilePath}'`);
|
750
|
+
}
|
751
|
+
}
|
752
|
+
break;
|
753
|
+
}
|
754
|
+
}
|
755
|
+
let importFound;
|
756
|
+
const isPartlyResolved = resolvedPaths.length > 0 && resolvedPaths.length < moduleDescriptor.nameParts.length;
|
757
|
+
if (allowPartial) {
|
758
|
+
importFound = resolvedPaths.length > 0;
|
759
|
+
}
|
760
|
+
else {
|
761
|
+
importFound = resolvedPaths.length >= moduleDescriptor.nameParts.length;
|
762
|
+
}
|
763
|
+
return {
|
764
|
+
importName,
|
765
|
+
isRelative: false,
|
766
|
+
isNamespacePackage,
|
767
|
+
isStubPackage,
|
768
|
+
isImportFound: importFound,
|
769
|
+
isPartlyResolved,
|
770
|
+
importFailureInfo,
|
771
|
+
importType: 2 /* Local */,
|
772
|
+
resolvedPaths,
|
773
|
+
searchPath: rootPath,
|
774
|
+
isStubFile,
|
775
|
+
isNativeLib,
|
776
|
+
implicitImports,
|
777
|
+
pyTypedInfo,
|
778
|
+
filteredImplicitImports: implicitImports,
|
779
|
+
packageDirectory,
|
780
|
+
};
|
781
|
+
}
|
782
|
+
// Intended to be overridden by subclasses to provide additional stub
|
783
|
+
// path capabilities. Return undefined if no extra stub path were found.
|
784
|
+
getTypeshedPathEx(execEnv, importFailureInfo) {
|
785
|
+
return undefined;
|
786
|
+
}
|
787
|
+
// Intended to be overridden by subclasses to provide additional stub
|
788
|
+
// resolving capabilities. Return undefined if no stubs were found for
|
789
|
+
// this import.
|
790
|
+
resolveImportEx(sourceFilePath, execEnv, moduleDescriptor, importName, importFailureInfo = [], allowPyi = true) {
|
791
|
+
return undefined;
|
792
|
+
}
|
793
|
+
// Intended to be overridden by subclasses to provide additional stub
|
794
|
+
// resolving capabilities for native (compiled) modules. Returns undefined
|
795
|
+
// if no stubs were found for this import.
|
796
|
+
resolveNativeImportEx(libraryFilePath, importName, importFailureInfo = []) {
|
797
|
+
return undefined;
|
798
|
+
}
|
799
|
+
getNativeModuleName(fileName) {
|
800
|
+
const fileExtension = (0, pathUtils_1.getFileExtension)(fileName, /* multiDotExtension */ false).toLowerCase();
|
801
|
+
if (this._isNativeModuleFileExtension(fileExtension)) {
|
802
|
+
return (0, pathUtils_1.stripFileExtension)((0, pathUtils_1.stripFileExtension)(fileName));
|
803
|
+
}
|
804
|
+
return undefined;
|
805
|
+
}
|
806
|
+
_lookUpResultsInCache(execEnv, importName, importedSymbols) {
|
807
|
+
const cacheForExecEnv = this._cachedImportResults.get(execEnv.root);
|
808
|
+
if (!cacheForExecEnv) {
|
809
|
+
return undefined;
|
810
|
+
}
|
811
|
+
const cachedEntry = cacheForExecEnv.get(importName);
|
812
|
+
if (!cachedEntry) {
|
813
|
+
return undefined;
|
814
|
+
}
|
815
|
+
return this.filterImplicitImports(cachedEntry, importedSymbols);
|
816
|
+
}
|
817
|
+
// Determines whether a namespace package resolves all of the symbols
|
818
|
+
// requested in the module descriptor. Namespace packages have no "__init__.py"
|
819
|
+
// file, so the only way that symbols can be resolved is if submodules
|
820
|
+
// are present. If specific symbols were requested, make sure they
|
821
|
+
// are all satisfied by submodules (as listed in the implicit imports).
|
822
|
+
_isNamespacePackageResolved(moduleDescriptor, implicitImports) {
|
823
|
+
if (moduleDescriptor.importedSymbols) {
|
824
|
+
if (!moduleDescriptor.importedSymbols.some((symbol) => {
|
825
|
+
return implicitImports.some((implicitImport) => {
|
826
|
+
return implicitImport.name === symbol;
|
827
|
+
});
|
828
|
+
})) {
|
829
|
+
return false;
|
830
|
+
}
|
831
|
+
}
|
832
|
+
else if (implicitImports.length === 0) {
|
833
|
+
return false;
|
834
|
+
}
|
835
|
+
return true;
|
836
|
+
}
|
837
|
+
getModuleNameFromPath(containerPath, filePath, stripTopContainerDir = false) {
|
838
|
+
containerPath = (0, pathUtils_1.ensureTrailingDirectorySeparator)(containerPath);
|
839
|
+
let filePathWithoutExtension = (0, pathUtils_1.stripFileExtension)(filePath);
|
840
|
+
// If module is native, strip platform part, such as 'cp36-win_amd64' in 'mtrand.cp36-win_amd64'.
|
841
|
+
if (this._isNativeModuleFileExtension((0, pathUtils_1.getFileExtension)(filePath))) {
|
842
|
+
filePathWithoutExtension = (0, pathUtils_1.stripFileExtension)(filePathWithoutExtension);
|
843
|
+
}
|
844
|
+
if (!filePathWithoutExtension.startsWith(containerPath)) {
|
845
|
+
return undefined;
|
846
|
+
}
|
847
|
+
// Strip off the '/__init__' if it's present.
|
848
|
+
if (filePathWithoutExtension.endsWith('__init__')) {
|
849
|
+
filePathWithoutExtension = filePathWithoutExtension.substr(0, filePathWithoutExtension.length - 9);
|
850
|
+
}
|
851
|
+
const relativeFilePath = filePathWithoutExtension.substr(containerPath.length);
|
852
|
+
const parts = (0, pathUtils_1.getPathComponents)(relativeFilePath);
|
853
|
+
parts.shift();
|
854
|
+
if (stripTopContainerDir) {
|
855
|
+
if (parts.length === 0) {
|
856
|
+
return undefined;
|
857
|
+
}
|
858
|
+
parts.shift();
|
859
|
+
}
|
860
|
+
if (parts.length === 0) {
|
861
|
+
return undefined;
|
862
|
+
}
|
863
|
+
// Handle the case where the symbol was resolved to a stubs package
|
864
|
+
// rather than the real package. We'll strip off the "-stubs" suffix
|
865
|
+
// in this case.
|
866
|
+
if (parts[0].endsWith(pathConsts_1.stubsSuffix)) {
|
867
|
+
parts[0] = parts[0].substr(0, parts[0].length - pathConsts_1.stubsSuffix.length);
|
868
|
+
}
|
869
|
+
// Check whether parts contains invalid characters.
|
870
|
+
if (parts.some((p) => !this._isIdentifier(p))) {
|
871
|
+
return undefined;
|
872
|
+
}
|
873
|
+
return parts.join('.');
|
874
|
+
}
|
875
|
+
_resolveBestAbsoluteImport(sourceFilePath, execEnv, moduleDescriptor, allowPyi) {
|
876
|
+
const importName = this.formatImportName(moduleDescriptor);
|
877
|
+
const importFailureInfo = [];
|
878
|
+
// Check for a local stub file using stubPath.
|
879
|
+
if (allowPyi && this._configOptions.stubPath) {
|
880
|
+
importFailureInfo.push(`Looking in stubPath '${this._configOptions.stubPath}'`);
|
881
|
+
const typingsImport = this.resolveAbsoluteImport(this._configOptions.stubPath, execEnv, moduleDescriptor, importName, importFailureInfo,
|
882
|
+
/* allowPartial */ undefined,
|
883
|
+
/* allowNativeLib */ false,
|
884
|
+
/* useStubPackage */ true, allowPyi,
|
885
|
+
/* lookForPyTyped */ false);
|
886
|
+
if (typingsImport.isImportFound) {
|
887
|
+
// We will treat typings files as "local" rather than "third party".
|
888
|
+
typingsImport.importType = 2 /* Local */;
|
889
|
+
typingsImport.isLocalTypingsFile = true;
|
890
|
+
// If it's a namespace package that didn't resolve to a file, make sure that
|
891
|
+
// the imported symbols are present in the implicit imports. If not, we'll
|
892
|
+
// skip the typings import and continue searching.
|
893
|
+
if (typingsImport.isNamespacePackage &&
|
894
|
+
!typingsImport.resolvedPaths[typingsImport.resolvedPaths.length - 1]) {
|
895
|
+
if (this._isNamespacePackageResolved(moduleDescriptor, typingsImport.implicitImports)) {
|
896
|
+
return typingsImport;
|
897
|
+
}
|
898
|
+
}
|
899
|
+
else {
|
900
|
+
return typingsImport;
|
901
|
+
}
|
902
|
+
}
|
903
|
+
}
|
904
|
+
let bestResultSoFar;
|
905
|
+
let localImport;
|
906
|
+
// Look for it in the root directory of the execution environment.
|
907
|
+
if (execEnv.root) {
|
908
|
+
importFailureInfo.push(`Looking in root directory of execution environment ` + `'${execEnv.root}'`);
|
909
|
+
localImport = this.resolveAbsoluteImport(execEnv.root, execEnv, moduleDescriptor, importName, importFailureInfo,
|
910
|
+
/* allowPartial */ undefined,
|
911
|
+
/* allowNativeLib */ true,
|
912
|
+
/* useStubPackage */ true, allowPyi,
|
913
|
+
/* lookForPyTyped */ false);
|
914
|
+
bestResultSoFar = localImport;
|
915
|
+
}
|
916
|
+
for (const extraPath of execEnv.extraPaths) {
|
917
|
+
importFailureInfo.push(`Looking in extraPath '${extraPath}'`);
|
918
|
+
localImport = this.resolveAbsoluteImport(extraPath, execEnv, moduleDescriptor, importName, importFailureInfo,
|
919
|
+
/* allowPartial */ undefined,
|
920
|
+
/* allowNativeLib */ true,
|
921
|
+
/* useStubPackage */ true, allowPyi,
|
922
|
+
/* lookForPyTyped */ false);
|
923
|
+
bestResultSoFar = this._pickBestImport(bestResultSoFar, localImport, moduleDescriptor);
|
924
|
+
}
|
925
|
+
// Look for the import in the list of third-party packages.
|
926
|
+
const pythonSearchPaths = this.getPythonSearchPaths(importFailureInfo);
|
927
|
+
if (pythonSearchPaths.length > 0) {
|
928
|
+
for (const searchPath of pythonSearchPaths) {
|
929
|
+
importFailureInfo.push(`Looking in python search path '${searchPath}'`);
|
930
|
+
const thirdPartyImport = this.resolveAbsoluteImport(searchPath, execEnv, moduleDescriptor, importName, importFailureInfo,
|
931
|
+
/* allowPartial */ allowPartialResolutionForThirdPartyPackages,
|
932
|
+
/* allowNativeLib */ true,
|
933
|
+
/* useStubPackage */ true, allowPyi,
|
934
|
+
/* lookForPyTyped */ true);
|
935
|
+
if (thirdPartyImport) {
|
936
|
+
thirdPartyImport.importType = 1 /* ThirdParty */;
|
937
|
+
bestResultSoFar = this._pickBestImport(bestResultSoFar, thirdPartyImport, moduleDescriptor);
|
938
|
+
}
|
939
|
+
}
|
940
|
+
}
|
941
|
+
else {
|
942
|
+
importFailureInfo.push('No python interpreter search path');
|
943
|
+
}
|
944
|
+
// If a library is fully py.typed, then we have found the best match,
|
945
|
+
// unless the execution environment is typeshed itself, in which case
|
946
|
+
// we don't want to favor py.typed libraries. Use the typeshed lookup below.
|
947
|
+
if (execEnv.root !== this._getTypeshedRoot(execEnv, importFailureInfo)) {
|
948
|
+
if ((bestResultSoFar === null || bestResultSoFar === void 0 ? void 0 : bestResultSoFar.pyTypedInfo) && !bestResultSoFar.isPartlyResolved) {
|
949
|
+
return bestResultSoFar;
|
950
|
+
}
|
951
|
+
}
|
952
|
+
// Call the extensibility hook for subclasses.
|
953
|
+
const extraResults = this.resolveImportEx(sourceFilePath, execEnv, moduleDescriptor, importName, importFailureInfo, allowPyi);
|
954
|
+
if (extraResults) {
|
955
|
+
return extraResults;
|
956
|
+
}
|
957
|
+
if (allowPyi && moduleDescriptor.nameParts.length > 0) {
|
958
|
+
// Check for a stdlib typeshed file.
|
959
|
+
importFailureInfo.push(`Looking for typeshed stdlib path`);
|
960
|
+
const typeshedStdlibImport = this._findTypeshedPath(execEnv, moduleDescriptor, importName,
|
961
|
+
/* isStdLib */ true, importFailureInfo);
|
962
|
+
if (typeshedStdlibImport) {
|
963
|
+
typeshedStdlibImport.isTypeshedFile = true;
|
964
|
+
return typeshedStdlibImport;
|
965
|
+
}
|
966
|
+
// Check for a third-party typeshed file.
|
967
|
+
importFailureInfo.push(`Looking for typeshed third-party path`);
|
968
|
+
const typeshedImport = this._findTypeshedPath(execEnv, moduleDescriptor, importName,
|
969
|
+
/* isStdLib */ false, importFailureInfo);
|
970
|
+
if (typeshedImport) {
|
971
|
+
typeshedImport.isTypeshedFile = true;
|
972
|
+
bestResultSoFar = this._pickBestImport(bestResultSoFar, typeshedImport, moduleDescriptor);
|
973
|
+
}
|
974
|
+
}
|
975
|
+
// We weren't able to find an exact match, so return the best
|
976
|
+
// partial match.
|
977
|
+
return bestResultSoFar;
|
978
|
+
}
|
979
|
+
_pickBestImport(bestImportSoFar, newImport, moduleDescriptor) {
|
980
|
+
if (!bestImportSoFar) {
|
981
|
+
return newImport;
|
982
|
+
}
|
983
|
+
if (!newImport) {
|
984
|
+
return bestImportSoFar;
|
985
|
+
}
|
986
|
+
if (newImport.isImportFound) {
|
987
|
+
// Prefer found over not found.
|
988
|
+
if (!bestImportSoFar.isImportFound) {
|
989
|
+
return newImport;
|
990
|
+
}
|
991
|
+
// Prefer traditional over namespace imports.
|
992
|
+
if (bestImportSoFar.isNamespacePackage && !newImport.isNamespacePackage) {
|
993
|
+
return newImport;
|
994
|
+
}
|
995
|
+
// Prefer local packages.
|
996
|
+
if (bestImportSoFar.importType === 2 /* Local */ && !bestImportSoFar.isNamespacePackage) {
|
997
|
+
return bestImportSoFar;
|
998
|
+
}
|
999
|
+
// If both are namespace imports, select the one that resolves the symbols.
|
1000
|
+
if (bestImportSoFar.isNamespacePackage &&
|
1001
|
+
newImport.isNamespacePackage &&
|
1002
|
+
moduleDescriptor.importedSymbols) {
|
1003
|
+
if (!this._isNamespacePackageResolved(moduleDescriptor, bestImportSoFar.implicitImports) &&
|
1004
|
+
this._isNamespacePackageResolved(moduleDescriptor, newImport.implicitImports)) {
|
1005
|
+
return newImport;
|
1006
|
+
}
|
1007
|
+
}
|
1008
|
+
// Prefer py.typed over non-py.typed.
|
1009
|
+
if (bestImportSoFar.pyTypedInfo && !newImport.pyTypedInfo) {
|
1010
|
+
return bestImportSoFar;
|
1011
|
+
}
|
1012
|
+
else if (!bestImportSoFar.pyTypedInfo && newImport.pyTypedInfo) {
|
1013
|
+
return newImport;
|
1014
|
+
}
|
1015
|
+
// Prefer pyi over py.
|
1016
|
+
if (bestImportSoFar.isStubFile && !newImport.isStubFile) {
|
1017
|
+
return bestImportSoFar;
|
1018
|
+
}
|
1019
|
+
else if (!bestImportSoFar.isStubFile && newImport.isStubFile) {
|
1020
|
+
return newImport;
|
1021
|
+
}
|
1022
|
+
// All else equal, prefer shorter resolution paths.
|
1023
|
+
if (bestImportSoFar.resolvedPaths.length > newImport.resolvedPaths.length) {
|
1024
|
+
return newImport;
|
1025
|
+
}
|
1026
|
+
}
|
1027
|
+
else if (newImport.isPartlyResolved && bestImportSoFar.isNamespacePackage && !newImport.isNamespacePackage) {
|
1028
|
+
// Always prefer a traditional over namespace import even
|
1029
|
+
// if the traditional import is only partly resolved.
|
1030
|
+
return newImport;
|
1031
|
+
}
|
1032
|
+
return bestImportSoFar;
|
1033
|
+
}
|
1034
|
+
_isIdentifier(value) {
|
1035
|
+
for (let i = 0; i < value.length; i++) {
|
1036
|
+
if (i === 0 ? !(0, characters_1.isIdentifierStartChar)(value.charCodeAt(i)) : !(0, characters_1.isIdentifierChar)(value.charCodeAt(i))) {
|
1037
|
+
return false;
|
1038
|
+
}
|
1039
|
+
}
|
1040
|
+
return true;
|
1041
|
+
}
|
1042
|
+
getPythonSearchPaths(importFailureInfo) {
|
1043
|
+
// Find the site packages for the configured virtual environment.
|
1044
|
+
if (!this._cachedPythonSearchPaths) {
|
1045
|
+
const paths = (PythonPathUtils.findPythonSearchPaths(this.fileSystem, this._configOptions, this.host, importFailureInfo) || []).map((p) => this.fileSystem.realCasePath(p));
|
1046
|
+
// Remove duplicates (yes, it happens).
|
1047
|
+
this._cachedPythonSearchPaths = [...new Set(paths)];
|
1048
|
+
}
|
1049
|
+
return this._cachedPythonSearchPaths;
|
1050
|
+
}
|
1051
|
+
_findTypeshedPath(execEnv, moduleDescriptor, importName, isStdLib, importFailureInfo) {
|
1052
|
+
importFailureInfo.push(`Looking for typeshed ${isStdLib ? PythonPathUtils.stdLibFolderName : PythonPathUtils.thirdPartyFolderName} path`);
|
1053
|
+
let typeshedPaths;
|
1054
|
+
if (isStdLib) {
|
1055
|
+
const path = this._getStdlibTypeshedPath(execEnv, importFailureInfo, moduleDescriptor);
|
1056
|
+
if (path) {
|
1057
|
+
typeshedPaths = [path];
|
1058
|
+
}
|
1059
|
+
}
|
1060
|
+
else {
|
1061
|
+
typeshedPaths = this._getThirdPartyTypeshedPackagePaths(moduleDescriptor, execEnv, importFailureInfo);
|
1062
|
+
}
|
1063
|
+
if (typeshedPaths) {
|
1064
|
+
for (const typeshedPath of typeshedPaths) {
|
1065
|
+
if (this.dirExistsCached(typeshedPath)) {
|
1066
|
+
const importInfo = this.resolveAbsoluteImport(typeshedPath, execEnv, moduleDescriptor, importName, importFailureInfo);
|
1067
|
+
if (importInfo.isImportFound) {
|
1068
|
+
importInfo.importType = isStdLib ? 0 /* BuiltIn */ : 1 /* ThirdParty */;
|
1069
|
+
return importInfo;
|
1070
|
+
}
|
1071
|
+
}
|
1072
|
+
}
|
1073
|
+
}
|
1074
|
+
importFailureInfo.push(`Typeshed path not found`);
|
1075
|
+
return undefined;
|
1076
|
+
}
|
1077
|
+
// Populates a cache of third-party packages found within the typeshed
|
1078
|
+
// directory. They are organized such that top-level directories contain
|
1079
|
+
// the pypi-registered name of the package and an inner directory contains
|
1080
|
+
// the name of the package as it is referenced by import statements. These
|
1081
|
+
// don't always match.
|
1082
|
+
_buildTypeshedThirdPartyPackageMap(thirdPartyDir) {
|
1083
|
+
this._cachedTypeshedThirdPartyPackagePaths = new Map();
|
1084
|
+
if (thirdPartyDir) {
|
1085
|
+
this.readdirEntriesCached(thirdPartyDir).forEach((outerEntry) => {
|
1086
|
+
if (outerEntry.isDirectory()) {
|
1087
|
+
const innerDirPath = (0, pathUtils_1.combinePaths)(thirdPartyDir, outerEntry.name);
|
1088
|
+
this.readdirEntriesCached(innerDirPath).forEach((innerEntry) => {
|
1089
|
+
if (innerEntry.name === '@python2') {
|
1090
|
+
return;
|
1091
|
+
}
|
1092
|
+
if (innerEntry.isDirectory()) {
|
1093
|
+
const pathList = this._cachedTypeshedThirdPartyPackagePaths.get(innerEntry.name);
|
1094
|
+
if (pathList) {
|
1095
|
+
pathList.push(innerDirPath);
|
1096
|
+
}
|
1097
|
+
else {
|
1098
|
+
this._cachedTypeshedThirdPartyPackagePaths.set(innerEntry.name, [innerDirPath]);
|
1099
|
+
}
|
1100
|
+
}
|
1101
|
+
else if (innerEntry.isFile()) {
|
1102
|
+
if (innerEntry.name.endsWith('.pyi')) {
|
1103
|
+
const strippedFileName = (0, pathUtils_1.stripFileExtension)(innerEntry.name);
|
1104
|
+
const pathList = this._cachedTypeshedThirdPartyPackagePaths.get(strippedFileName);
|
1105
|
+
if (pathList) {
|
1106
|
+
pathList.push(innerDirPath);
|
1107
|
+
}
|
1108
|
+
else {
|
1109
|
+
this._cachedTypeshedThirdPartyPackagePaths.set(strippedFileName, [innerDirPath]);
|
1110
|
+
}
|
1111
|
+
}
|
1112
|
+
}
|
1113
|
+
});
|
1114
|
+
}
|
1115
|
+
});
|
1116
|
+
}
|
1117
|
+
const flattenPaths = [...this._cachedTypeshedThirdPartyPackagePaths.values()].flatMap((v) => v);
|
1118
|
+
this._cachedTypeshedThirdPartyPackageRoots = [...new Set(flattenPaths)].sort();
|
1119
|
+
}
|
1120
|
+
_getCompletionSuggestionsTypeshedPath(sourceFilePath, execEnv, moduleDescriptor, isStdLib, suggestions) {
|
1121
|
+
const importFailureInfo = [];
|
1122
|
+
let typeshedPaths;
|
1123
|
+
if (isStdLib) {
|
1124
|
+
const path = this._getStdlibTypeshedPath(execEnv, importFailureInfo, moduleDescriptor);
|
1125
|
+
if (path) {
|
1126
|
+
typeshedPaths = [path];
|
1127
|
+
}
|
1128
|
+
}
|
1129
|
+
else {
|
1130
|
+
typeshedPaths = this._getThirdPartyTypeshedPackagePaths(moduleDescriptor, execEnv, importFailureInfo,
|
1131
|
+
/* includeMatchOnly */ false);
|
1132
|
+
const typeshedPathEx = this.getTypeshedPathEx(execEnv, importFailureInfo);
|
1133
|
+
if (typeshedPathEx) {
|
1134
|
+
typeshedPaths = typeshedPaths !== null && typeshedPaths !== void 0 ? typeshedPaths : [];
|
1135
|
+
typeshedPaths.push(typeshedPathEx);
|
1136
|
+
}
|
1137
|
+
}
|
1138
|
+
if (!typeshedPaths) {
|
1139
|
+
return;
|
1140
|
+
}
|
1141
|
+
typeshedPaths.forEach((typeshedPath) => {
|
1142
|
+
if (this.dirExistsCached(typeshedPath)) {
|
1143
|
+
this._getCompletionSuggestionsAbsolute(sourceFilePath, execEnv, typeshedPath, moduleDescriptor, suggestions);
|
1144
|
+
}
|
1145
|
+
});
|
1146
|
+
}
|
1147
|
+
// Returns the directory for a module within the stdlib typeshed directory.
|
1148
|
+
// If moduleDescriptor is provided, it is filtered based on the VERSIONS
|
1149
|
+
// file in the typeshed stubs.
|
1150
|
+
_getStdlibTypeshedPath(execEnv, importFailureInfo, moduleDescriptor) {
|
1151
|
+
const subdirectory = this._getTypeshedSubdirectory(/* isStdLib */ true, execEnv, importFailureInfo);
|
1152
|
+
if (subdirectory &&
|
1153
|
+
moduleDescriptor &&
|
1154
|
+
!this._isStdlibTypeshedStubValidForVersion(moduleDescriptor, execEnv, importFailureInfo)) {
|
1155
|
+
return undefined;
|
1156
|
+
}
|
1157
|
+
return subdirectory;
|
1158
|
+
}
|
1159
|
+
_getThirdPartyTypeshedPath(execEnv, importFailureInfo) {
|
1160
|
+
return this._getTypeshedSubdirectory(/* isStdLib */ false, execEnv, importFailureInfo);
|
1161
|
+
}
|
1162
|
+
_isStdlibTypeshedStubValidForVersion(moduleDescriptor, execEnv, importFailureInfo) {
|
1163
|
+
if (!this._cachedTypeshedStdLibModuleVersions) {
|
1164
|
+
this._cachedTypeshedStdLibModuleVersions = this._readTypeshedStdLibVersions(execEnv, importFailureInfo);
|
1165
|
+
}
|
1166
|
+
// Loop through the name parts to make sure the module and submodules
|
1167
|
+
// referenced in the import statement are valid for this version of Python.
|
1168
|
+
for (let namePartCount = 1; namePartCount <= moduleDescriptor.nameParts.length; namePartCount++) {
|
1169
|
+
const namePartsToConsider = moduleDescriptor.nameParts.slice(0, namePartCount);
|
1170
|
+
const versionRange = this._cachedTypeshedStdLibModuleVersions.get(namePartsToConsider.join('.'));
|
1171
|
+
if (versionRange) {
|
1172
|
+
if (execEnv.pythonVersion < versionRange.min) {
|
1173
|
+
return false;
|
1174
|
+
}
|
1175
|
+
if (versionRange.max !== undefined && execEnv.pythonVersion > versionRange.max) {
|
1176
|
+
return false;
|
1177
|
+
}
|
1178
|
+
}
|
1179
|
+
}
|
1180
|
+
return true;
|
1181
|
+
}
|
1182
|
+
_readTypeshedStdLibVersions(execEnv, importFailureInfo) {
|
1183
|
+
const versionRangeMap = new Map();
|
1184
|
+
// Read the VERSIONS file from typeshed.
|
1185
|
+
const typeshedStdLibPath = this._getTypeshedSubdirectory(/* isStdLib */ true, execEnv, importFailureInfo);
|
1186
|
+
if (typeshedStdLibPath) {
|
1187
|
+
const versionsFilePath = (0, pathUtils_1.combinePaths)(typeshedStdLibPath, 'VERSIONS');
|
1188
|
+
try {
|
1189
|
+
const fileStats = this.fileSystem.statSync(versionsFilePath);
|
1190
|
+
if (fileStats.size > 0 && fileStats.size < 256 * 1024) {
|
1191
|
+
const fileContents = this.fileSystem.readFileSync(versionsFilePath, 'utf8');
|
1192
|
+
fileContents.split(/\r?\n/).forEach((line) => {
|
1193
|
+
const commentSplit = line.split('#');
|
1194
|
+
const colonSplit = commentSplit[0].split(':');
|
1195
|
+
if (colonSplit.length !== 2) {
|
1196
|
+
return;
|
1197
|
+
}
|
1198
|
+
const versionSplit = colonSplit[1].split('-');
|
1199
|
+
if (versionSplit.length > 2) {
|
1200
|
+
return;
|
1201
|
+
}
|
1202
|
+
const moduleName = colonSplit[0].trim();
|
1203
|
+
if (!moduleName) {
|
1204
|
+
return;
|
1205
|
+
}
|
1206
|
+
let minVersionString = versionSplit[0].trim();
|
1207
|
+
if (minVersionString.endsWith('+')) {
|
1208
|
+
// If the version ends in "+", strip it off.
|
1209
|
+
minVersionString = minVersionString.substr(0, minVersionString.length - 1);
|
1210
|
+
}
|
1211
|
+
let minVersion = (0, pythonVersion_1.versionFromString)(minVersionString);
|
1212
|
+
if (!minVersion) {
|
1213
|
+
minVersion = pythonVersion_1.PythonVersion.V3_0;
|
1214
|
+
}
|
1215
|
+
let maxVersion;
|
1216
|
+
if (versionSplit.length > 1) {
|
1217
|
+
maxVersion = (0, pythonVersion_1.versionFromString)(versionSplit[1].trim());
|
1218
|
+
}
|
1219
|
+
versionRangeMap.set(moduleName, { min: minVersion, max: maxVersion });
|
1220
|
+
});
|
1221
|
+
}
|
1222
|
+
else {
|
1223
|
+
importFailureInfo.push(`Typeshed stdlib VERSIONS file is unexpectedly large`);
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
catch (e) {
|
1227
|
+
importFailureInfo.push(`Could not read typeshed stdlib VERSIONS file: '${JSON.stringify(e)}'`);
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
return versionRangeMap;
|
1231
|
+
}
|
1232
|
+
_getThirdPartyTypeshedPackagePaths(moduleDescriptor, execEnv, importFailureInfo, includeMatchOnly = true) {
|
1233
|
+
const typeshedPath = this._getThirdPartyTypeshedPath(execEnv, importFailureInfo);
|
1234
|
+
if (!this._cachedTypeshedThirdPartyPackagePaths) {
|
1235
|
+
this._buildTypeshedThirdPartyPackageMap(typeshedPath);
|
1236
|
+
}
|
1237
|
+
const firstNamePart = moduleDescriptor.nameParts.length > 0 ? moduleDescriptor.nameParts[0] : '';
|
1238
|
+
if (includeMatchOnly) {
|
1239
|
+
return this._cachedTypeshedThirdPartyPackagePaths.get(firstNamePart);
|
1240
|
+
}
|
1241
|
+
if (firstNamePart) {
|
1242
|
+
return (0, collectionUtils_1.flatten)((0, collectionUtils_1.getMapValues)(this._cachedTypeshedThirdPartyPackagePaths, (k) => k.startsWith(firstNamePart)));
|
1243
|
+
}
|
1244
|
+
return [];
|
1245
|
+
}
|
1246
|
+
_getThirdPartyTypeshedPackageRoots(execEnv, importFailureInfo) {
|
1247
|
+
const typeshedPath = this._getThirdPartyTypeshedPath(execEnv, importFailureInfo);
|
1248
|
+
if (!this._cachedTypeshedThirdPartyPackagePaths) {
|
1249
|
+
this._buildTypeshedThirdPartyPackageMap(typeshedPath);
|
1250
|
+
}
|
1251
|
+
return this._cachedTypeshedThirdPartyPackageRoots;
|
1252
|
+
}
|
1253
|
+
_getTypeshedRoot(execEnv, importFailureInfo) {
|
1254
|
+
if (this._cachedTypeshedRoot !== undefined) {
|
1255
|
+
return this._cachedTypeshedRoot;
|
1256
|
+
}
|
1257
|
+
let typeshedPath = '';
|
1258
|
+
// Did the user specify a typeshed path? If not, we'll look in the
|
1259
|
+
// python search paths, then in the typeshed-fallback directory.
|
1260
|
+
if (this._configOptions.typeshedPath) {
|
1261
|
+
const possibleTypeshedPath = this._configOptions.typeshedPath;
|
1262
|
+
if (this.dirExistsCached(possibleTypeshedPath)) {
|
1263
|
+
typeshedPath = possibleTypeshedPath;
|
1264
|
+
}
|
1265
|
+
}
|
1266
|
+
else {
|
1267
|
+
const pythonSearchPaths = this.getPythonSearchPaths(importFailureInfo);
|
1268
|
+
for (const searchPath of pythonSearchPaths) {
|
1269
|
+
const possibleTypeshedPath = (0, pathUtils_1.combinePaths)(searchPath, 'typeshed');
|
1270
|
+
if (this.dirExistsCached(possibleTypeshedPath)) {
|
1271
|
+
typeshedPath = possibleTypeshedPath;
|
1272
|
+
break;
|
1273
|
+
}
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
// If typeshed directory wasn't found in other locations, use the fallback.
|
1277
|
+
if (!typeshedPath) {
|
1278
|
+
typeshedPath = PythonPathUtils.getTypeShedFallbackPath(this.fileSystem) || '';
|
1279
|
+
}
|
1280
|
+
this._cachedTypeshedRoot = typeshedPath;
|
1281
|
+
return typeshedPath;
|
1282
|
+
}
|
1283
|
+
_getTypeshedSubdirectory(isStdLib, execEnv, importFailureInfo) {
|
1284
|
+
// See if we have it cached.
|
1285
|
+
if (isStdLib) {
|
1286
|
+
if (this._cachedTypeshedStdLibPath !== undefined) {
|
1287
|
+
return this._cachedTypeshedStdLibPath;
|
1288
|
+
}
|
1289
|
+
}
|
1290
|
+
else {
|
1291
|
+
if (this._cachedTypeshedThirdPartyPath !== undefined) {
|
1292
|
+
return this._cachedTypeshedThirdPartyPath;
|
1293
|
+
}
|
1294
|
+
}
|
1295
|
+
let typeshedPath = this._getTypeshedRoot(execEnv, importFailureInfo);
|
1296
|
+
typeshedPath = PythonPathUtils.getTypeshedSubdirectory(typeshedPath, isStdLib);
|
1297
|
+
if (!this.dirExistsCached(typeshedPath)) {
|
1298
|
+
return undefined;
|
1299
|
+
}
|
1300
|
+
// Cache the results.
|
1301
|
+
if (isStdLib) {
|
1302
|
+
this._cachedTypeshedStdLibPath = typeshedPath;
|
1303
|
+
}
|
1304
|
+
else {
|
1305
|
+
this._cachedTypeshedThirdPartyPath = typeshedPath;
|
1306
|
+
}
|
1307
|
+
return typeshedPath;
|
1308
|
+
}
|
1309
|
+
_resolveRelativeImport(sourceFilePath, execEnv, moduleDescriptor, importName, importFailureInfo) {
|
1310
|
+
importFailureInfo.push('Attempting to resolve relative import');
|
1311
|
+
// Determine which search path this file is part of.
|
1312
|
+
const directory = (0, importStatementUtils_1.getDirectoryLeadingDotsPointsTo)((0, pathUtils_1.getDirectoryPath)(sourceFilePath), moduleDescriptor.leadingDots);
|
1313
|
+
if (!directory) {
|
1314
|
+
importFailureInfo.push(`Invalid relative path '${importName}'`);
|
1315
|
+
return undefined;
|
1316
|
+
}
|
1317
|
+
// Now try to match the module parts from the current directory location.
|
1318
|
+
const absImport = this.resolveAbsoluteImport(directory, execEnv, moduleDescriptor, importName, importFailureInfo,
|
1319
|
+
/* allowPartial */ false,
|
1320
|
+
/* allowNativeLib */ true);
|
1321
|
+
if (absImport && absImport.isStubFile) {
|
1322
|
+
// If we found a stub for a relative import, only search
|
1323
|
+
// the same folder for the real module. Otherwise, it will
|
1324
|
+
// error out on runtime.
|
1325
|
+
absImport.nonStubImportResult = this.resolveAbsoluteImport(directory, execEnv, moduleDescriptor, importName, importFailureInfo,
|
1326
|
+
/* allowPartial */ false,
|
1327
|
+
/* allowNativeLib */ true,
|
1328
|
+
/* useStubPackage */ false,
|
1329
|
+
/* allowPyi */ false) || {
|
1330
|
+
importName,
|
1331
|
+
isRelative: true,
|
1332
|
+
isImportFound: false,
|
1333
|
+
isPartlyResolved: false,
|
1334
|
+
isNamespacePackage: false,
|
1335
|
+
isStubPackage: false,
|
1336
|
+
importFailureInfo,
|
1337
|
+
resolvedPaths: [],
|
1338
|
+
importType: 2 /* Local */,
|
1339
|
+
isStubFile: false,
|
1340
|
+
isNativeLib: false,
|
1341
|
+
implicitImports: [],
|
1342
|
+
filteredImplicitImports: [],
|
1343
|
+
nonStubImportResult: undefined,
|
1344
|
+
};
|
1345
|
+
}
|
1346
|
+
return this.filterImplicitImports(absImport, moduleDescriptor.importedSymbols);
|
1347
|
+
}
|
1348
|
+
_getCompletionSuggestionsRelative(sourceFilePath, execEnv, moduleDescriptor, suggestions) {
|
1349
|
+
// Determine which search path this file is part of.
|
1350
|
+
const directory = (0, importStatementUtils_1.getDirectoryLeadingDotsPointsTo)((0, pathUtils_1.getDirectoryPath)(sourceFilePath), moduleDescriptor.leadingDots);
|
1351
|
+
if (!directory) {
|
1352
|
+
return;
|
1353
|
+
}
|
1354
|
+
// Now try to match the module parts from the current directory location.
|
1355
|
+
this._getCompletionSuggestionsAbsolute(sourceFilePath, execEnv, directory, moduleDescriptor, suggestions);
|
1356
|
+
}
|
1357
|
+
_getFilesInDirectory(dirPath) {
|
1358
|
+
const entriesInDir = this.readdirEntriesCached(dirPath);
|
1359
|
+
const filesInDir = entriesInDir.filter((f) => f.isFile()).map((f) => f.name);
|
1360
|
+
// Add any symbolic links that point to files.
|
1361
|
+
entriesInDir.forEach((f) => {
|
1362
|
+
var _a;
|
1363
|
+
const linkPath = (0, pathUtils_1.combinePaths)(dirPath, f.name);
|
1364
|
+
if (f.isSymbolicLink() && ((_a = (0, pathUtils_1.tryStat)(this.fileSystem, linkPath)) === null || _a === void 0 ? void 0 : _a.isFile())) {
|
1365
|
+
filesInDir.push(f.name);
|
1366
|
+
}
|
1367
|
+
});
|
1368
|
+
return filesInDir;
|
1369
|
+
}
|
1370
|
+
_getCompletionSuggestionsAbsolute(sourceFilePath, execEnv, rootPath, moduleDescriptor, suggestions, strictOnly = true) {
|
1371
|
+
// Starting at the specified path, walk the file system to find the
|
1372
|
+
// specified module.
|
1373
|
+
let dirPath = rootPath;
|
1374
|
+
// Copy the nameParts into a new directory and add an extra empty
|
1375
|
+
// part if there is a trailing dot.
|
1376
|
+
const nameParts = moduleDescriptor.nameParts.map((name) => name);
|
1377
|
+
if (moduleDescriptor.hasTrailingDot) {
|
1378
|
+
nameParts.push('');
|
1379
|
+
}
|
1380
|
+
// We need to track this since a module might be resolvable using relative path
|
1381
|
+
// but can't resolved by absolute path.
|
1382
|
+
const leadingDots = moduleDescriptor.leadingDots;
|
1383
|
+
const parentNameParts = nameParts.slice(0, -1);
|
1384
|
+
// Handle the case where the user has typed the first
|
1385
|
+
// dot (or multiple) in a relative path.
|
1386
|
+
if (nameParts.length === 0) {
|
1387
|
+
this._addFilteredSuggestionsAbsolute(sourceFilePath, execEnv, dirPath, '', suggestions, leadingDots, parentNameParts, strictOnly);
|
1388
|
+
}
|
1389
|
+
else {
|
1390
|
+
for (let i = 0; i < nameParts.length; i++) {
|
1391
|
+
// Provide completions only if we're on the last part
|
1392
|
+
// of the name.
|
1393
|
+
if (i === nameParts.length - 1) {
|
1394
|
+
this._addFilteredSuggestionsAbsolute(sourceFilePath, execEnv, dirPath, nameParts[i], suggestions, leadingDots, parentNameParts, strictOnly);
|
1395
|
+
}
|
1396
|
+
dirPath = (0, pathUtils_1.combinePaths)(dirPath, nameParts[i]);
|
1397
|
+
if (!this.dirExistsCached(dirPath)) {
|
1398
|
+
break;
|
1399
|
+
}
|
1400
|
+
}
|
1401
|
+
}
|
1402
|
+
}
|
1403
|
+
_addFilteredSuggestionsAbsolute(sourceFilePath, execEnv, currentPath, filter, suggestions, leadingDots, parentNameParts, strictOnly) {
|
1404
|
+
// Enumerate all of the files and directories in the path, expanding links.
|
1405
|
+
const entries = (0, pathUtils_1.getFileSystemEntriesFromDirEntries)(this.readdirEntriesCached(currentPath), this.fileSystem, currentPath);
|
1406
|
+
entries.files.forEach((file) => {
|
1407
|
+
// Strip multi-dot extensions to handle file names like "foo.cpython-32m.so". We want
|
1408
|
+
// to detect the ".so" but strip off the entire ".cpython-32m.so" extension.
|
1409
|
+
const fileExtension = (0, pathUtils_1.getFileExtension)(file, /* multiDotExtension */ false).toLowerCase();
|
1410
|
+
const fileWithoutExtension = (0, pathUtils_1.stripFileExtension)(file, /* multiDotExtension */ true);
|
1411
|
+
if (exports.supportedFileExtensions.some((ext) => ext === fileExtension)) {
|
1412
|
+
if (fileWithoutExtension === '__init__') {
|
1413
|
+
return;
|
1414
|
+
}
|
1415
|
+
if (filter && !StringUtils.isPatternInSymbol(filter, fileWithoutExtension)) {
|
1416
|
+
return;
|
1417
|
+
}
|
1418
|
+
if (!this._isUniqueValidSuggestion(fileWithoutExtension, suggestions) ||
|
1419
|
+
!this._isResolvableSuggestion(fileWithoutExtension, leadingDots, parentNameParts, sourceFilePath, execEnv, strictOnly)) {
|
1420
|
+
return;
|
1421
|
+
}
|
1422
|
+
suggestions.add(fileWithoutExtension);
|
1423
|
+
}
|
1424
|
+
});
|
1425
|
+
entries.directories.forEach((dir) => {
|
1426
|
+
if (filter && !dir.startsWith(filter)) {
|
1427
|
+
return;
|
1428
|
+
}
|
1429
|
+
if (!this._isUniqueValidSuggestion(dir, suggestions) ||
|
1430
|
+
!this._isResolvableSuggestion(dir, leadingDots, parentNameParts, sourceFilePath, execEnv, strictOnly)) {
|
1431
|
+
return;
|
1432
|
+
}
|
1433
|
+
suggestions.add(dir);
|
1434
|
+
});
|
1435
|
+
}
|
1436
|
+
// Fix for editable installed submodules where the suggested directory was a namespace directory that wouldn't resolve.
|
1437
|
+
// only used for absolute imports
|
1438
|
+
_isResolvableSuggestion(name, leadingDots, parentNameParts, sourceFilePath, execEnv, strictOnly) {
|
1439
|
+
// We always resolve names based on sourceFilePath.
|
1440
|
+
const moduleDescriptor = {
|
1441
|
+
leadingDots: leadingDots,
|
1442
|
+
nameParts: [...parentNameParts, name],
|
1443
|
+
importedSymbols: [],
|
1444
|
+
};
|
1445
|
+
// Make sure we don't use parent folder resolution when checking whether the given name is resolvable.
|
1446
|
+
if (strictOnly) {
|
1447
|
+
const importName = this.formatImportName(moduleDescriptor);
|
1448
|
+
const importFailureInfo = [];
|
1449
|
+
return this._resolveImportStrict(importName, sourceFilePath, execEnv, moduleDescriptor, importFailureInfo)
|
1450
|
+
.isImportFound;
|
1451
|
+
}
|
1452
|
+
return this._resolveImport(sourceFilePath, execEnv, moduleDescriptor).isImportFound;
|
1453
|
+
}
|
1454
|
+
_isUniqueValidSuggestion(suggestionToAdd, suggestions) {
|
1455
|
+
if (suggestions.has(suggestionToAdd)) {
|
1456
|
+
return false;
|
1457
|
+
}
|
1458
|
+
// Don't add directories with illegal module names.
|
1459
|
+
if (/[.-]/.test(suggestionToAdd)) {
|
1460
|
+
return false;
|
1461
|
+
}
|
1462
|
+
// Don't add directories with dunder names like "__pycache__".
|
1463
|
+
if ((0, symbolNameUtils_1.isDunderName)(suggestionToAdd) && suggestionToAdd !== '__future__') {
|
1464
|
+
return false;
|
1465
|
+
}
|
1466
|
+
return true;
|
1467
|
+
}
|
1468
|
+
// Potentially modifies the ImportResult by removing some or all of the
|
1469
|
+
// implicit import entries. Only the imported symbols should be included.
|
1470
|
+
filterImplicitImports(importResult, importedSymbols) {
|
1471
|
+
if (importedSymbols === undefined) {
|
1472
|
+
const newImportResult = Object.assign({}, importResult);
|
1473
|
+
newImportResult.filteredImplicitImports = [];
|
1474
|
+
return newImportResult;
|
1475
|
+
}
|
1476
|
+
if (importedSymbols.length === 0) {
|
1477
|
+
return importResult;
|
1478
|
+
}
|
1479
|
+
if (importResult.implicitImports.length === 0) {
|
1480
|
+
return importResult;
|
1481
|
+
}
|
1482
|
+
const filteredImplicitImports = importResult.implicitImports.filter((implicitImport) => {
|
1483
|
+
return importedSymbols.some((sym) => sym === implicitImport.name);
|
1484
|
+
});
|
1485
|
+
if (filteredImplicitImports.length === importResult.implicitImports.length) {
|
1486
|
+
return importResult;
|
1487
|
+
}
|
1488
|
+
const newImportResult = Object.assign({}, importResult);
|
1489
|
+
newImportResult.filteredImplicitImports = filteredImplicitImports;
|
1490
|
+
return newImportResult;
|
1491
|
+
}
|
1492
|
+
_findImplicitImports(importingModuleName, dirPath, exclusions) {
|
1493
|
+
const implicitImportMap = new Map();
|
1494
|
+
// Enumerate all of the files and directories in the path, expanding links.
|
1495
|
+
const entries = (0, pathUtils_1.getFileSystemEntriesFromDirEntries)(this.readdirEntriesCached(dirPath), this.fileSystem, dirPath);
|
1496
|
+
// Add implicit file-based modules.
|
1497
|
+
for (const fileName of entries.files) {
|
1498
|
+
const fileExt = (0, pathUtils_1.getFileExtension)(fileName);
|
1499
|
+
let strippedFileName;
|
1500
|
+
let isNativeLib = false;
|
1501
|
+
if (fileExt === '.py' || fileExt === '.pyi') {
|
1502
|
+
strippedFileName = (0, pathUtils_1.stripFileExtension)(fileName);
|
1503
|
+
}
|
1504
|
+
else if (this._isNativeModuleFileExtension(fileExt) &&
|
1505
|
+
!this.fileExistsCached(`${fileName}.py`) &&
|
1506
|
+
!this.fileExistsCached(`${fileName}.pyi`)) {
|
1507
|
+
// Native module.
|
1508
|
+
strippedFileName = fileName.substr(0, fileName.indexOf('.'));
|
1509
|
+
isNativeLib = true;
|
1510
|
+
}
|
1511
|
+
else {
|
1512
|
+
continue;
|
1513
|
+
}
|
1514
|
+
const filePath = (0, pathUtils_1.combinePaths)(dirPath, fileName);
|
1515
|
+
if (!exclusions.find((exclusion) => exclusion === filePath)) {
|
1516
|
+
const implicitImport = {
|
1517
|
+
isStubFile: fileName.endsWith('.pyi'),
|
1518
|
+
isNativeLib,
|
1519
|
+
name: strippedFileName,
|
1520
|
+
path: filePath,
|
1521
|
+
};
|
1522
|
+
// Always prefer stub files over non-stub files.
|
1523
|
+
const entry = implicitImportMap.get(implicitImport.name);
|
1524
|
+
if (!entry || !entry.isStubFile) {
|
1525
|
+
// Try resolving resolving native lib to a custom stub.
|
1526
|
+
if (isNativeLib) {
|
1527
|
+
const nativeLibPath = (0, pathUtils_1.combinePaths)(dirPath, fileName);
|
1528
|
+
const nativeStubPath = this.resolveNativeImportEx(nativeLibPath, `${importingModuleName}.${strippedFileName}`, []);
|
1529
|
+
if (nativeStubPath) {
|
1530
|
+
implicitImport.path = nativeStubPath;
|
1531
|
+
implicitImport.isNativeLib = false;
|
1532
|
+
}
|
1533
|
+
}
|
1534
|
+
implicitImportMap.set(implicitImport.name, implicitImport);
|
1535
|
+
}
|
1536
|
+
}
|
1537
|
+
}
|
1538
|
+
// Add implicit directory-based modules.
|
1539
|
+
for (const dirName of entries.directories) {
|
1540
|
+
const pyFilePath = (0, pathUtils_1.combinePaths)(dirPath, dirName, '__init__.py');
|
1541
|
+
const pyiFilePath = pyFilePath + 'i';
|
1542
|
+
let isStubFile = false;
|
1543
|
+
let path = '';
|
1544
|
+
if (this.fileExistsCached(pyiFilePath)) {
|
1545
|
+
isStubFile = true;
|
1546
|
+
path = pyiFilePath;
|
1547
|
+
}
|
1548
|
+
else if (this.fileExistsCached(pyFilePath)) {
|
1549
|
+
path = pyFilePath;
|
1550
|
+
}
|
1551
|
+
if (path) {
|
1552
|
+
if (!exclusions.find((exclusion) => exclusion === path)) {
|
1553
|
+
const implicitImport = {
|
1554
|
+
isStubFile,
|
1555
|
+
isNativeLib: false,
|
1556
|
+
name: dirName,
|
1557
|
+
path,
|
1558
|
+
};
|
1559
|
+
implicitImportMap.set(implicitImport.name, implicitImport);
|
1560
|
+
}
|
1561
|
+
}
|
1562
|
+
}
|
1563
|
+
return [...implicitImportMap.values()];
|
1564
|
+
}
|
1565
|
+
formatImportName(moduleDescriptor) {
|
1566
|
+
return '.'.repeat(moduleDescriptor.leadingDots) + moduleDescriptor.nameParts.join('.');
|
1567
|
+
}
|
1568
|
+
_resolveNativeModuleStub(nativeLibPath, execEnv, importName, moduleDescriptor, importFailureInfo, resolvedPaths) {
|
1569
|
+
let moduleFullName = importName;
|
1570
|
+
if (moduleDescriptor.leadingDots > 0) {
|
1571
|
+
// Relative path. Convert `.mtrand` to `numpy.random.mtrand` based on search path.
|
1572
|
+
const info = this.getModuleNameForImport(nativeLibPath, execEnv);
|
1573
|
+
moduleFullName = info.moduleName.length > 0 ? info.moduleName : moduleFullName;
|
1574
|
+
}
|
1575
|
+
const compiledStubPath = this.resolveNativeImportEx(nativeLibPath, moduleFullName, importFailureInfo);
|
1576
|
+
if (compiledStubPath) {
|
1577
|
+
importFailureInfo.push(`Resolved native import ${importName} with stub '${compiledStubPath}'`);
|
1578
|
+
resolvedPaths.push(compiledStubPath);
|
1579
|
+
return false; // Resolved to a stub.
|
1580
|
+
}
|
1581
|
+
importFailureInfo.push(`Resolved import with file '${nativeLibPath}'`);
|
1582
|
+
resolvedPaths.push(nativeLibPath);
|
1583
|
+
return true;
|
1584
|
+
}
|
1585
|
+
_isNativeModuleFileName(moduleName, fileName) {
|
1586
|
+
// Strip off the final file extension and the part of the file name
|
1587
|
+
// that excludes all (multi-part) file extensions. This allows us to
|
1588
|
+
// handle file names like "foo.cpython-32m.so".
|
1589
|
+
const fileExtension = (0, pathUtils_1.getFileExtension)(fileName, /* multiDotExtension */ false).toLowerCase();
|
1590
|
+
const withoutExtension = (0, pathUtils_1.stripFileExtension)(fileName, /* multiDotExtension */ true);
|
1591
|
+
return (this._isNativeModuleFileExtension(fileExtension) &&
|
1592
|
+
(0, stringUtils_1.equateStringsCaseInsensitive)(moduleName, withoutExtension));
|
1593
|
+
}
|
1594
|
+
_isNativeModuleFileExtension(fileExtension) {
|
1595
|
+
return supportedNativeLibExtensions.some((ext) => ext === fileExtension);
|
1596
|
+
}
|
1597
|
+
_tryWalkUp(current) {
|
1598
|
+
if ((0, pathUtils_1.isDiskPathRoot)(current)) {
|
1599
|
+
return [false, ''];
|
1600
|
+
}
|
1601
|
+
return [
|
1602
|
+
true,
|
1603
|
+
(0, pathUtils_1.ensureTrailingDirectorySeparator)((0, pathUtils_1.normalizePathCase)(this.fileSystem, (0, pathUtils_1.normalizePath)((0, pathUtils_1.combinePaths)(current, '..')))),
|
1604
|
+
];
|
1605
|
+
}
|
1606
|
+
_shouldWalkUp(current, root, execEnv) {
|
1607
|
+
return current.length > root.length || (current === root && !execEnv.root);
|
1608
|
+
}
|
1609
|
+
getParentImportResolutionRoot(sourceFilePath, executionRoot) {
|
1610
|
+
if (executionRoot) {
|
1611
|
+
return (0, pathUtils_1.ensureTrailingDirectorySeparator)((0, pathUtils_1.normalizePathCase)(this.fileSystem, (0, pathUtils_1.normalizePath)(executionRoot)));
|
1612
|
+
}
|
1613
|
+
return (0, pathUtils_1.ensureTrailingDirectorySeparator)((0, pathUtils_1.getDirectoryPath)(sourceFilePath));
|
1614
|
+
}
|
1615
|
+
}
|
1616
|
+
exports.ImportResolver = ImportResolver;
|
1617
|
+
//# sourceMappingURL=importResolver.js.map
|