mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 23:31:05 +07:00
[pycharm] PY-80432 Fix navigation on collections.abc in imports from Typeshed to _collections_abc.py
IJ-MR-159943 (cherry picked from commit cc83e34de632c134a81c2d285b3c445ad76d2331) IJ-MR-161809 GitOrigin-RevId: 66dca55d173d38d0a54df0c51220d0aa6bb5456d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
11f54723c8
commit
12609db31a
@@ -141,6 +141,10 @@ object PyTypeShed {
|
||||
"typing.AsyncGenerator" to "_collections_abc.AsyncGenerator"
|
||||
)
|
||||
|
||||
val typeshedModuleRedirections: Map<String, String> = mapOf(
|
||||
"collections.abc" to "_collections_abc",
|
||||
)
|
||||
|
||||
/**
|
||||
* Returns true if we allow to search typeshed for a stub for [name].
|
||||
*/
|
||||
|
||||
@@ -166,10 +166,14 @@ public final class PyiUtil {
|
||||
}
|
||||
|
||||
private static @Nullable PyFile getOriginalFile(@NotNull PyiFile file) {
|
||||
final QualifiedName name = QualifiedNameFinder.findCanonicalImportPath(file, file);
|
||||
QualifiedName name = QualifiedNameFinder.findCanonicalImportPath(file, file);
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
String moduleRedirect = PyTypeShed.INSTANCE.getTypeshedModuleRedirections().get(name.toString());
|
||||
if (moduleRedirect != null) {
|
||||
name = QualifiedName.fromDottedString(moduleRedirect);
|
||||
}
|
||||
final PyQualifiedNameResolveContext context = PyResolveImportUtil.fromFoothold(file).copyWithoutStubs();
|
||||
return PyUtil.as(PyResolveImportUtil.resolveQualifiedName(name, context)
|
||||
.stream()
|
||||
|
||||
Reference in New Issue
Block a user