PyExpression (@NotNull PyAnnotationOwner owner, @NotNull TypeEvalContext context) { if (context.maySwitchToAST(owner)) { final PyAnnotation annotation = owner.getAnnotation(); if (annotation != null) { return annotation.getValue(); } } else { final String annotationText = owner.getAnnotationValue(); if (annotationText != null) { return toExpression(annotationText, owner); } } return null; }