Search in sources :

Example 1 with PyQualifiedNameResolveContext

use of com.jetbrains.python.psi.resolve.PyQualifiedNameResolveContext in project intellij-community by JetBrains.

the class NumpyModuleMembersProvider method addTestingModule.

private static void addTestingModule(PyFile module, List<PyCustomMember> members) {
    final PyQualifiedNameResolveContext context = PyResolveImportUtil.fromFoothold(module).copyWithPlainDirectories();
    final PsiElement resolved = PyResolveImportUtil.resolveQualifiedName(QualifiedName.fromDottedString("numpy.testing"), context).stream().findFirst().orElse(null);
    final PsiElement testingModule = PyUtil.turnDirIntoInit(resolved);
    members.add(new PyCustomMember("testing", testingModule));
}
Also used : PyQualifiedNameResolveContext(com.jetbrains.python.psi.resolve.PyQualifiedNameResolveContext) PyCustomMember(com.jetbrains.python.codeInsight.PyCustomMember) PsiElement(com.intellij.psi.PsiElement)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 PyCustomMember (com.jetbrains.python.codeInsight.PyCustomMember)1 PyQualifiedNameResolveContext (com.jetbrains.python.psi.resolve.PyQualifiedNameResolveContext)1