String () { PyElement elt = PsiTreeUtil.getParentOfType(PyImportElementImpl.this, PyImportStatement.class, PyFromImportStatement.class); final StringBuilder buf = new StringBuilder("| "); if (elt != null) { // always? who knows :) if (elt instanceof PyFromImportStatement) { // from ... import ... buf.append("from "); PyReferenceExpression imp_src = ((PyFromImportStatement)elt).getImportSource(); if (imp_src != null) { buf.append(PyPsiUtils.toPath(imp_src)); } else { buf.append("<?>"); } buf.append(" import "); } else { // "import ... " buf.append("import "); } buf.append(getRefName("<?>")); } else { buf.append("import?.. "); } // are we the name or the 'as'? PyTargetExpression as_part = getAsNameElement(); if (as_part != null) { buf.append(" as ").append(as_part.getName()); } return buf.toString(); }