Collection<PyTargetExpression> (@NotNull final QualifiedName qualifierQName, @NotNull final PsiElement anchor) { final Set<String> names = new HashSet<>(); final List<PyTargetExpression> results = new ArrayList<>(); for (ScopeOwner owner = ScopeUtil.getScopeOwner(anchor); owner != null; owner = ScopeUtil.getScopeOwner(owner)) { final Scope scope = ControlFlowCache.getScope(owner); for (final PyTargetExpression target : scope.getTargetExpressions()) { final QualifiedName targetQName = target.asQualifiedName(); if (targetQName != null) { if (targetQName.getComponentCount() == qualifierQName.getComponentCount() + 1 && targetQName.matchesPrefix(qualifierQName)) { final String name = target.getName(); if (!names.contains(name)) { names.add(name); results.add(target); } } } } } return results; }