boolean (@NotNull PyExpression expression) { final PyCallExpression call = as(expression, PyCallExpression.class); if (call != null) { final PyReferenceExpression callee = as(call.getCallee(), PyReferenceExpression.class); return callee != null && ("TypeVar".equals(callee.getReferencedName()) || "TypeVarTuple".equals(callee.getReferencedName()) || "ParamSpec".equals(callee.getReferencedName())); } final PyStringLiteralExpression pyString = as(expression, PyStringLiteralExpression.class); if (pyString != null) { if (pyString.getStringNodes().size() != 1 || pyString.getTextLength() > STRING_LITERAL_LENGTH_THRESHOLD) { return false; } final String content = pyString.getStringValue(); return TYPE_ANNOTATION_LIKE.matcher(content).matches(); } if (expression instanceof PyReferenceExpression || expression instanceof PySubscriptionExpression) { return isSyntacticallyValidAnnotation(expression); } return false; }