boolean (PsiFileSystemItem file) { if (file.isDirectory() || file.getName().equals(PyNames.INIT_DOT_PY)) { return false; } String name = FileUtilRt.getNameWithoutExtension(file.getName()); final PsiDirectory directory = ((PsiFile)file).getContainingDirectory(); if (directory == null) { return false; } PsiDirectory packageDir = directory.findSubdirectory(name); return packageDir != null && packageDir.findFile(PyNames.INIT_DOT_PY) != null; }