def iter_annotations(self):
        """Yield a tuple for each Flask handler containing annotated methods.

        Each tuple contains a heading, routing rule, the view class associated
        with the rule, and the annotations for the methods in that class.
        """
        # Need to store a list of route, view_class, and annotations by a
        # section key so that all methods of a resource are kept together in
        # the documentation.  The key of the section will be the heading that
        # the route documentation goes under.
        section_map = defaultdict(list)
        for rule in self.app.url_map.iter_rules():
            if rule.endpoint == 'static':
                # Don't document static file endpoints.
                continue
            # This gives us the auto-generated view function.
            view_function = self.app.view_functions.get(rule.endpoint)
            if view_function is None:
                continue
            # This gives us the actual Flask resource class.
            view_class = getattr(view_function, 'view_class', None)
            if view_class is None:
                continue

            annotations = []
            for method_name in HTTP_METHODS:
                method = getattr(view_class, method_name, None)
                if not method:
                    continue
                annotation = ResourceAnnotation(
                    method, method_name, method._doctor_title)
                annotations.append(annotation)
            if annotations:
                heading = self._get_annotation_heading(view_class, str(rule))
                section_map[heading].append((rule, view_class, annotations))

        # Loop through each heading and it's items and yield the values.
        for heading in sorted(section_map.keys()):
            for item in section_map[heading]:
                rule, view_class, annotations = item
                yield (heading, rule, view_class, annotations)
Yield a tuple for each Flask handler containing annotated methods.

        Each tuple contains a heading, routing rule, the view class associated
        with the rule, and the annotations for the methods in that class.