Set<String> (@NotNull PyReferenceExpression source) { final PyResolveContext resolveContext = PyResolveContext.defaultContext(myTypeEvalContext); final List<List<String>> resolvedDunderAlls = StreamEx .of(source.getReference(resolveContext).multiResolve(false)) .map(ResolveResult::getElement) .select(PyFile.class) .map(PyFile::getDunderAll) .toList(); if (resolvedDunderAlls.isEmpty()) return null; final Set<String> result = new HashSet<>(); for (List<String> dunderAll : resolvedDunderAlls) { if (dunderAll == null) return null; result.addAll(dunderAll); } return result; }