Collection<PyCustomMember> (@NotNull PyClass cls, boolean isDefinition) { final List<PyCustomMember> result = new ArrayList<>(); for (PyFunction function : cls.getMethods()) { final String name = function.getName(); final PyUtil.MethodFlags methodFlags = PyUtil.MethodFlags.of(function); final boolean instanceMethod = methodFlags == null || methodFlags.isInstanceMethod(); if (name != null && (isDefinition ^ instanceMethod)) { result.add(new PyCustomMember(name, function)); } } if (!isDefinition) { for (PyTargetExpression attribute : cls.getInstanceAttributes()) { final String name = attribute.getName(); if (name != null) { result.add(new PyCustomMember(name, attribute)); } } } for (PyTargetExpression attribute : cls.getClassAttributes()) { final String name = attribute.getName(); if (name != null) { result.add(new PyCustomMember(name, attribute)); } } return result; }