Object (@NotNull PyReferenceExpression expression) { if (PyNames.PARDIR.equals(expression.getName())) { return ".."; } else if (PyNames.CURDIR.equals(expression.getName())) { return "."; } if (!expression.isQualified() && PyNames.FILE.equals(expression.getReferencedName())) { return FileUtil.toSystemIndependentName(myContainingFilePath); } if ("parent".equals(expression.getName()) && expression.isQualified()) { Object qualifier = evaluate(expression.getQualifier()); if (qualifier instanceof String) { return Paths.get((String)qualifier).getParent().toFile().getPath(); } } return super.evaluateReference(expression); }