@NotNull
 @Override
 protected List<RatedResolveResult> resolveInner() {
   List<PsiElement> targets =
       ResolveImportUtil.resolveFromImportStatementSource(
           myStatement, myElement.asQualifiedName());
   return ResolveImportUtil.rateResults(targets);
 }
 @Nullable
 @Override
 public List<? extends RatedResolveResult> resolveMember(
     @NotNull String name,
     @Nullable PyExpression location,
     @NotNull AccessDirection direction,
     @NotNull PyResolveContext resolveContext) {
   final PsiElement resolved = myImportedModule.resolve();
   if (resolved != null) {
     final PsiFile containingFile = location != null ? location.getContainingFile() : null;
     List<PsiElement> elements =
         Collections.singletonList(
             ResolveImportUtil.resolveChild(resolved, name, containingFile, false, true));
     final PyImportElement importElement = myImportedModule.getImportElement();
     final PyFile resolvedFile = PyUtil.as(resolved, PyFile.class);
     if (location != null
         && importElement != null
         && PyUtil.inSameFile(location, importElement)
         && ResolveImportUtil.getPointInImport(location) == PointInImport.NONE
         && resolved instanceof PsiFileSystemItem
         && (resolvedFile == null
             || !PyUtil.isPackage(resolvedFile)
             || resolvedFile.getElementNamed(name) == null)) {
       final List<PsiElement> importedSubmodules =
           PyModuleType.collectImportedSubmodules((PsiFileSystemItem) resolved, location);
       if (importedSubmodules != null) {
         final Set<PsiElement> imported = Sets.newHashSet(importedSubmodules);
         elements =
             ContainerUtil.filter(
                 elements,
                 new Condition<PsiElement>() {
                   @Override
                   public boolean value(PsiElement element) {
                     return imported.contains(element);
                   }
                 });
       }
     }
     return ResolveImportUtil.rateResults(elements);
   }
   return null;
 }
 @Nullable
 @Override
 public List<? extends RatedResolveResult> resolveMember(
     @NotNull String name,
     @Nullable PyExpression location,
     @NotNull AccessDirection direction,
     @NotNull PyResolveContext resolveContext) {
   final PsiElement resolved = myImportedModule.resolve();
   if (resolved instanceof PyFile) {
     final PyFile file = (PyFile) resolved;
     return new PyModuleType(file, myImportedModule)
         .resolveMember(name, location, direction, resolveContext);
   } else if (resolved instanceof PsiDirectory) {
     final List<PsiElement> elements =
         Collections.singletonList(
             ResolveImportUtil.resolveChild(resolved, name, null, true, true));
     return ResolveImportUtil.rateResults(elements);
   }
   return null;
 }
 public Object[] getCompletionVariants(
     String completionPrefix, PsiElement location, ProcessingContext context) {
   final List<LookupElement> result = new ArrayList<LookupElement>();
   final PsiElement resolved = myImportedModule.resolve();
   if (resolved instanceof PyFile) {
     final PyModuleType moduleType = new PyModuleType((PyFile) resolved, myImportedModule);
     result.addAll(
         moduleType.getCompletionVariantsAsLookupElements(location, context, false, false));
   } else if (resolved instanceof PsiDirectory) {
     final PsiDirectory dir = (PsiDirectory) resolved;
     if (PyUtil.isPackage(dir, location)) {
       if (ResolveImportUtil.getPointInImport(location) != PointInImport.NONE) {
         result.addAll(PyModuleType.getSubModuleVariants(dir, location, null));
       } else {
         result.addAll(
             PyModuleType.collectImportedSubmodulesAsLookupElements(
                 dir, location, context.get(CTX_NAMES)));
       }
     }
   }
   return ArrayUtil.toObjectArray(result);
 }