PyFile (@NotNull final String dirName, @NotNull final String fileName) { final PsiFile psiFile = getDir(dirName).findFile(fileName); assert psiFile instanceof PyFile : "Bad file " + psiFile + "name: " + fileName; return (PyFile)psiFile; }