List<String> (@NotNull PyImportStatementBase importStatement) { final List<String> result = new ArrayList<>(); final PyFromImportStatement fromImport = as(importStatement, PyFromImportStatement.class); if (fromImport != null) { // because of that relative imports go to the end of an import block result.add(StringUtil.repeatSymbol('.', fromImport.getRelativeLevel())); final QualifiedName source = fromImport.getImportSourceQName(); result.add(Objects.toString(source, "")); if (fromImport.isStarImport()) { result.add("*"); } } else { // fake relative level result.add(""); } for (PyImportElement importElement : importStatement.getImportElements()) { final QualifiedName qualifiedName = importElement.getImportedQName(); result.add(Objects.toString(qualifiedName, "")); result.add(StringUtil.notNullize(importElement.getAsName())); } return result; }