prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Change PagerDuty's default summary text
  Currently PagerDuty's Alert destination default summary text uses the query id and name. We should change it to use the alert name as it's usually better explains what the alert is.
  
  While #4153 implements ability to customize the summary text, it's good to have a saner default regardless.
  
  (If #4153 is not merged before implementing, should be implemented based on its branch)
  
  </issue>
  <code>
  [start of redash/destinations/pagerduty.py]
  1 import logging
  2 from redash.destinations import *
  3 
  4 enabled = True
  5 
  6 try:
  7     import pypd
  8 except ImportError:
  9     enabled = False
  10 
  11 
  12 class PagerDuty(BaseDestination):
  13 
  14     KEY_STRING = '{alert_id}_{query_id}'
  15     DESCRIPTION_STR = u'Alert - Redash Query #{query_id}: {query_name}'
  16 
  17     @classmethod
  18     def enabled(cls):
  19         return enabled
  20 
  21     @classmethod
  22     def configuration_schema(cls):
  23         return {
  24             'type': 'object',
  25             'properties': {
  26                 'integration_key': {
  27                     'type': 'string',
  28                     'title': 'PagerDuty Service Integration Key'
  29                 },
  30                 'description': {
  31                     'type': 'string',
  32                     'title': 'Description for the event, defaults to query',
  33                 }
  34             },
  35             "required": ["integration_key"]
  36         }
  37 
  38     @classmethod
  39     def icon(cls):
  40         return 'creative-commons-pd-alt'
  41 
  42     def notify(self, alert, query, user, new_state, app, host, options):
  43 
  44         if alert.custom_subject:
  45             default_desc = alert.custom_subject
  46         elif options.get('description'):
  47             default_desc = options.get('description')
  48         else:
  49             default_desc = self.DESCRIPTION_STR.format(query_id=query.id, query_name=query.name)
  50 
  51         incident_key = self.KEY_STRING.format(alert_id=alert.id, query_id=query.id)
  52         data = {
  53             'routing_key': options.get('integration_key'),
  54             'incident_key': incident_key,
  55             'dedup_key': incident_key,
  56             'payload': {
  57                 'summary': default_desc,
  58                 'severity': 'error',
  59                 'source': 'redash',
  60             }
  61         }
  62 
  63         if alert.custom_body:
  64             data['payload']['custom_details'] = alert.custom_body
  65 
  66         if new_state == 'triggered':
  67             data['event_action'] = 'trigger'
  68         elif new_state == "unknown":
  69             logging.info('Unknown state, doing nothing')
  70             return
  71         else:
  72             data['event_action'] = 'resolve'
  73 
  74         try:
  75 
  76             ev = pypd.EventV2.create(data=data)
  77             logging.warning(ev)
  78 
  79         except Exception:
  80             logging.exception("PagerDuty trigger failed!")
  81 
  82 
  83 register(PagerDuty)
  84
  [end of redash/destinations/pagerduty.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/redash/destinations/pagerduty.py b/redash/destinations/pagerduty.py
  --- a/redash/destinations/pagerduty.py
  +++ b/redash/destinations/pagerduty.py
  @@ -12,7 +12,7 @@
   class PagerDuty(BaseDestination):
   
       KEY_STRING = '{alert_id}_{query_id}'
  -    DESCRIPTION_STR = u'Alert - Redash Query #{query_id}: {query_name}'
  +    DESCRIPTION_STR = u'Alert: {alert_name}'
   
       @classmethod
       def enabled(cls):
  @@ -29,7 +29,7 @@
                   },
                   'description': {
                       'type': 'string',
  -                    'title': 'Description for the event, defaults to query',
  +                    'title': 'Description for the event, defaults to alert name',
                   }
               },
               "required": ["integration_key"]
  @@ -46,7 +46,7 @@
           elif options.get('description'):
               default_desc = options.get('description')
           else:
  -            default_desc = self.DESCRIPTION_STR.format(query_id=query.id, query_name=query.name)
  +            default_desc = self.DESCRIPTION_STR.format(alert_name=alert.name)
   
           incident_key = self.KEY_STRING.format(alert_id=alert.id, query_id=query.id)
           data = {
  
verification_info: {"golden_diff": "diff --git a/redash/destinations/pagerduty.py b/redash/destinations/pagerduty.py\n--- a/redash/destinations/pagerduty.py\n+++ b/redash/destinations/pagerduty.py\n@@ -12,7 +12,7 @@\n class PagerDuty(BaseDestination):\n \n     KEY_STRING = '{alert_id}_{query_id}'\n-    DESCRIPTION_STR = u'Alert - Redash Query #{query_id}: {query_name}'\n+    DESCRIPTION_STR = u'Alert: {alert_name}'\n \n     @classmethod\n     def enabled(cls):\n@@ -29,7 +29,7 @@\n                 },\n                 'description': {\n                     'type': 'string',\n-                    'title': 'Description for the event, defaults to query',\n+                    'title': 'Description for the event, defaults to alert name',\n                 }\n             },\n             \"required\": [\"integration_key\"]\n@@ -46,7 +46,7 @@\n         elif options.get('description'):\n             default_desc = options.get('description')\n         else:\n-            default_desc = self.DESCRIPTION_STR.format(query_id=query.id, query_name=query.name)\n+            default_desc = self.DESCRIPTION_STR.format(alert_name=alert.name)\n \n         incident_key = self.KEY_STRING.format(alert_id=alert.id, query_id=query.id)\n         data = {\n", "issue": "Change PagerDuty's default summary text\nCurrently PagerDuty's Alert destination default summary text uses the query id and name. We should change it to use the alert name as it's usually better explains what the alert is.\r\n\r\nWhile #4153 implements ability to customize the summary text, it's good to have a saner default regardless.\r\n\r\n(If #4153 is not merged before implementing, should be implemented based on its branch)\n", "before_files": [{"content": "import logging\nfrom redash.destinations import *\n\nenabled = True\n\ntry:\n    import pypd\nexcept ImportError:\n    enabled = False\n\n\nclass PagerDuty(BaseDestination):\n\n    KEY_STRING = '{alert_id}_{query_id}'\n    DESCRIPTION_STR = u'Alert - Redash Query #{query_id}: {query_name}'\n\n    @classmethod\n    def enabled(cls):\n        return enabled\n\n    @classmethod\n    def configuration_schema(cls):\n        return {\n            'type': 'object',\n            'properties': {\n                'integration_key': {\n                    'type': 'string',\n                    'title': 'PagerDuty Service Integration Key'\n                },\n                'description': {\n                    'type': 'string',\n                    'title': 'Description for the event, defaults to query',\n                }\n            },\n            \"required\": [\"integration_key\"]\n        }\n\n    @classmethod\n    def icon(cls):\n        return 'creative-commons-pd-alt'\n\n    def notify(self, alert, query, user, new_state, app, host, options):\n\n        if alert.custom_subject:\n            default_desc = alert.custom_subject\n        elif options.get('description'):\n            default_desc = options.get('description')\n        else:\n            default_desc = self.DESCRIPTION_STR.format(query_id=query.id, query_name=query.name)\n\n        incident_key = self.KEY_STRING.format(alert_id=alert.id, query_id=query.id)\n        data = {\n            'routing_key': options.get('integration_key'),\n            'incident_key': incident_key,\n            'dedup_key': incident_key,\n            'payload': {\n                'summary': default_desc,\n                'severity': 'error',\n                'source': 'redash',\n            }\n        }\n\n        if alert.custom_body:\n            data['payload']['custom_details'] = alert.custom_body\n\n        if new_state == 'triggered':\n            data['event_action'] = 'trigger'\n        elif new_state == \"unknown\":\n            logging.info('Unknown state, doing nothing')\n            return\n        else:\n            data['event_action'] = 'resolve'\n\n        try:\n\n            ev = pypd.EventV2.create(data=data)\n            logging.warning(ev)\n\n        except Exception:\n            logging.exception(\"PagerDuty trigger failed!\")\n\n\nregister(PagerDuty)\n", "path": "redash/destinations/pagerduty.py"}]}