Repository: boto/boto3
File: boto3/docs/action.py (Python)

Code before:
        resource_actions = get_resource_public_actions(
            self._resource.__class__
        )
        self.member_map['actions'] = sorted(resource_actions)
        add_resource_type_overview(
            section=section,
            resource_type='Actions',
            description=(
                'Actions call operations on resources.  They may '
                'automatically handle the passing in of arguments set '
                'from identifiers and some attributes.'
            ),
            intro_link='actions_intro',
        )

        for action_name in sorted(resource_actions):
            # Create a new DocumentStructure for each action and add contents.
            action_doc = DocumentStructure(action_name, target='html')
            breadcrumb_section = action_doc.add_new_section('breadcrumb')
            breadcrumb_section.style.ref(self._resource_class_name, 'index')
            breadcrumb_section.write(f' / Action / {action_name}')
            action_doc.add_title_section(action_name)
            if self._resource_name == "Metric" and action_name == "put_data":
                action_doc.add_new_section("warning").write(
                    PUT_DATA_WARNING_MESSAGE
                )
            action_section = action_doc.add_new_section(
                action_name,
                context={'qualifier': f'{self.class_name}.'},
            )
            if action_name in ['load', 'reload'] and self._resource_model.load:
                document_load_reload_action(
                    section=action_section,
                    action_name=action_name,
                    resource_name=self._resource_name,
                    event_emitter=self._resource.meta.client.meta.events,
                    load_model=self._resource_model.load,
                    service_model=self._service_model,
                )
            elif action_name in modeled_actions:
                document_action(
                    section=action_section,
                    resource_name=self._resource_name,
                    event_emitter=self._resource.meta.client.meta.events,
                    action_model=modeled_actions[action_name],
                    service_model=self._service_model,
                )
            else:
                document_custom_method(
                    action_section, action_name, resource_actions[action_name]
                )

Review comment (suggestion):
```suggestion
            # Define this on line 62 outside loop
            # service_warnings = WARNING_MESSAGES.get(self._resource_name, {}) 
            warning_message = service_warnings.get(action_name)
            if warning_message is not None:
                action_doc.add_new_section("warning").write(warning_message)
```

Code after:
class ActionDocumenter(NestedDocumenter):
    def document_actions(self, section):
        modeled_actions_list = self._resource_model.actions
        modeled_actions = {}
        for modeled_action in modeled_actions_list:
            modeled_actions[modeled_action.name] = modeled_action
        resource_actions = get_resource_public_actions(
            self._resource.__class__
        )
        self.member_map['actions'] = sorted(resource_actions)
        add_resource_type_overview(
            section=section,
            resource_type='Actions',
            description=(
                'Actions call operations on resources.  They may '
                'automatically handle the passing in of arguments set '
                'from identifiers and some attributes.'
            ),
            intro_link='actions_intro',
        )
        resource_warnings = WARNING_MESSAGES.get(self._resource_name, {})
        for action_name in sorted(resource_actions):
            # Create a new DocumentStructure for each action and add contents.
            action_doc = DocumentStructure(action_name, target='html')
            breadcrumb_section = action_doc.add_new_section('breadcrumb')
            breadcrumb_section.style.ref(self._resource_class_name, 'index')
            breadcrumb_section.write(f' / Action / {action_name}')
            action_doc.add_title_section(action_name)
            warning_message = resource_warnings.get(action_name)
            if warning_message is not None:
                action_doc.add_new_section("warning").write(warning_message)
            action_section = action_doc.add_new_section(
                action_name,
                context={'qualifier': f'{self.class_name}.'},
            )
            if action_name in ['load', 'reload'] and self._resource_model.load:
                document_load_reload_action(
                    section=action_section,
                    action_name=action_name,
                    resource_name=self._resource_name,
                    event_emitter=self._resource.meta.client.meta.events,
                    load_model=self._resource_model.load,
                    service_model=self._service_model,
                )
            elif action_name in modeled_actions:
                document_action(
                    section=action_section,
                    resource_name=self._resource_name,
                    event_emitter=self._resource.meta.client.meta.events,
                    action_model=modeled_actions[action_name],
                    service_model=self._service_model,