PyNamedTupleStub (@NotNull PyCallExpression expression) { final PyReferenceExpression calleeReference = PyUtil.as(expression.getCallee(), PyReferenceExpression.class); if (calleeReference == null) { return null; } final Pair<QualifiedName, NamedTupleModule> calleeNameAndModule = getCalleeNameAndNTModule(calleeReference); if (calleeNameAndModule != null) { final String name = PyResolveUtil.resolveStrArgument(expression, 0, "typename"); if (name == null) { return null; } final LinkedHashMap<String, Optional<String>> fields = resolveTupleFields(expression, calleeNameAndModule.getSecond()); if (fields == null) { return null; } return new PyNamedTupleStubImpl(calleeNameAndModule.getFirst(), name, fields); } return null; }