boolean (PsiElement foothold) { if (foothold != null) { PsiFile file = foothold.getContainingFile(); if (file instanceof PyFile pyFile) { if (pyFile.getLanguageLevel().isPy3K()) { PsiElement originalFoothold = CompletionUtilCoreImpl.getOriginalOrSelf(foothold); if (foothold.getManager().isInProject(originalFoothold) && Registry.is("python.explicit.namespace.packages")) { return false; } return true; } return pyFile.hasImportFromFuture(ABSOLUTE_IMPORT); } } // if the relevant import is below the foothold, it is either legal or we've detected the offending statement already return false; }