docstr: Delete an annotation.
  ---
  delete:
    summary: Delete an annotation
    parameters:
    - in: path
      schema:
        type: integer
      name: pk
      description: The annotation layer pk for this annotation
    - in: path
      schema:
        type: integer
      name: annotation_id
      description: The annotation pk for this annotation
    responses:
      200:
        description: Item deleted
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
      404:
        $ref: '#/components/responses/404'
      422:
        $ref: '#/components/responses/422'
      500:
        $ref: '#/components/responses/500'
docstr_tok: ["Delete","an","annotation",".","--","-","delete",":","summary",":","Delete","an","annotation","parameters",":","-","in",":","path","schema",":","type",":","integer","name",":","pk","description",":","The","annotation","layer","pk","for","this","annotation","-","in",":","path","schema",":","type",":","integer","name",":","annotation_id","description",":","The","annotation","pk","for","this","annotation","responses",":","200",":","description",":","Item","deleted","content",":","application\/json",":","schema",":","type",":","object","properties",":","message",":","type",":","string","404",":","$","ref",":","'","#","\/components\/responses\/404'","422",":","$","ref",":","'","#","\/components\/responses\/422'","500",":","$","ref",":","'","#","\/components\/responses\/500","'"]
code: def delete(  # pylint: disable=arguments-differ
      self, pk: int, annotation_id: int
  ) -> Response:
      """Delete an annotation.
      ---
      delete:
        summary: Delete an annotation
        parameters:
        - in: path
          schema:
            type: integer
          name: pk
          description: The annotation layer pk for this annotation
        - in: path
          schema:
            type: integer
          name: annotation_id
          description: The annotation pk for this annotation
        responses:
          200:
            description: Item deleted
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    message:
                      type: string
          404:
            $ref: '#/components/responses/404'
          422:
            $ref: '#/components/responses/422'
          500:
            $ref: '#/components/responses/500'
      """
      try:
          DeleteAnnotationCommand([annotation_id]).run()
          return self.response(200, message="OK")
      except AnnotationNotFoundError:
          return self.response_404()
      except AnnotationDeleteFailedError as ex:
          logger.error(
              "Error deleting annotation %s: %s",
              self.__class__.__name__,
              str(ex),
              exc_info=True,
          )
          return self.response_422(message=str(ex))
  
imports: import logging
  from typing import Any
  from flask import request, Response
  from flask_appbuilder.api import expose, permission_name, protect, rison, safe
  from flask_appbuilder.api.schemas import get_item_schema, get_list_schema
  from flask_appbuilder.models.sqla.interface import SQLAInterface
  from flask_babel import ngettext
  from marshmallow import ValidationError
  from superset.annotation_layers.annotations.filters import AnnotationAllTextFilter
  from superset.annotation_layers.annotations.schemas import AnnotationPostSchema, AnnotationPutSchema, get_delete_ids_schema, openapi_spec_methods_override
  from superset.commands.annotation_layer.annotation.create import CreateAnnotationCommand
  from superset.commands.annotation_layer.annotation.delete import DeleteAnnotationCommand
  from superset.commands.annotation_layer.annotation.exceptions import AnnotationCreateFailedError, AnnotationDeleteFailedError, AnnotationInvalidError, AnnotationNotFoundError, AnnotationUpdateFailedError
  from superset.commands.annotation_layer.annotation.update import UpdateAnnotationCommand
  from superset.commands.annotation_layer.exceptions import AnnotationLayerNotFoundError
  from superset.constants import MODEL_API_RW_METHOD_PERMISSION_MAP, RouteMethod
  from superset.models.annotations import Annotation
  from superset.views.base_api import BaseSupersetModelRestApi, requires_json, statsd_metrics
label_desc: Use image node_id 6 for calling the AnnotationRestApi obj's underlying member method code with example usage: obj.delete(pk, annotation_id) and returns: self, self, self