prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Distinguish between staging & prod when sending data refresh slack updates
  ## Problem
  <!-- Describe a problem solved by this feature; or delete the section entirely. -->
  It's not easy to tell based on the slack messages produced by the ingestion server whether a given ingestion is being run in production or staging.
  
  ## Description
  <!-- Describe the feature and how it solves the problem. -->
  We should pre-pend the messages (or change the bot's name) based on which environment the data refresh is running in. 
  
  ## Alternatives
  <!-- Describe any alternative solutions or features you have considered. How is this feature better? -->
  We _could_ turn off messages altogether for staging (how it is currently) but that would make it harder for us to know when a staging data refresh is complete.
  
  ## Additional context
  <!-- Add any other context about the feature here; or delete the section entirely. -->
  
  ## Implementation
  <!-- Replace the [ ] with [x] to check the box. -->
  - [x] 🙋 I would be interested in implementing this feature.
  
  
  </issue>
  <code>
  [start of ingestion_server/ingestion_server/slack.py]
  1 import logging
  2 import os
  3 
  4 import requests
  5 
  6 
  7 log = logging.getLogger(__name__)
  8 SLACK_WEBHOOK = "SLACK_WEBHOOK"
  9 
  10 
  11 def message(text: str, summary: str = None) -> None:
  12     """
  13     Send a Slack message to a channel specified by a Slack webhook variable.
  14 
  15     A message is only sent if the SLACK_WEBHOOK environment variable is undefined.
  16     """
  17     if not (webhook := os.getenv(SLACK_WEBHOOK)):
  18         log.debug(
  19             f"{SLACK_WEBHOOK} variable not defined, skipping slack message: {text}"
  20         )
  21         return
  22     if not summary:
  23         if "\n" in text:
  24             summary = "Ingestion server message"
  25         else:
  26             summary = text
  27 
  28     data = {
  29         "blocks": [{"text": {"text": text, "type": "mrkdwn"}, "type": "section"}],
  30         "text": summary,
  31         "username": "Data Refresh Notification",
  32         "icon_emoji": "arrows_counterclockwise",
  33     }
  34     try:
  35         requests.post(webhook, json=data)
  36     except Exception as err:
  37         log.exception(f"Unable to issue slack message: {err}")
  38         pass
  39
  [end of ingestion_server/ingestion_server/slack.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/ingestion_server/ingestion_server/slack.py b/ingestion_server/ingestion_server/slack.py
  --- a/ingestion_server/ingestion_server/slack.py
  +++ b/ingestion_server/ingestion_server/slack.py
  @@ -2,6 +2,7 @@
   import os
   
   import requests
  +from decouple import config
   
   
   log = logging.getLogger(__name__)
  @@ -25,10 +26,12 @@
           else:
               summary = text
   
  +    environment = config("ENVIRONMENT", default="local")
  +
       data = {
           "blocks": [{"text": {"text": text, "type": "mrkdwn"}, "type": "section"}],
           "text": summary,
  -        "username": "Data Refresh Notification",
  +        "username": f"Data Refresh Notification | {environment.upper()}",
           "icon_emoji": "arrows_counterclockwise",
       }
       try:
  
verification_info: {"golden_diff": "diff --git a/ingestion_server/ingestion_server/slack.py b/ingestion_server/ingestion_server/slack.py\n--- a/ingestion_server/ingestion_server/slack.py\n+++ b/ingestion_server/ingestion_server/slack.py\n@@ -2,6 +2,7 @@\n import os\n \n import requests\n+from decouple import config\n \n \n log = logging.getLogger(__name__)\n@@ -25,10 +26,12 @@\n         else:\n             summary = text\n \n+    environment = config(\"ENVIRONMENT\", default=\"local\")\n+\n     data = {\n         \"blocks\": [{\"text\": {\"text\": text, \"type\": \"mrkdwn\"}, \"type\": \"section\"}],\n         \"text\": summary,\n-        \"username\": \"Data Refresh Notification\",\n+        \"username\": f\"Data Refresh Notification | {environment.upper()}\",\n         \"icon_emoji\": \"arrows_counterclockwise\",\n     }\n     try:\n", "issue": "Distinguish between staging & prod when sending data refresh slack updates\n## Problem\r\n<!-- Describe a problem solved by this feature; or delete the section entirely. -->\r\nIt's not easy to tell based on the slack messages produced by the ingestion server whether a given ingestion is being run in production or staging.\r\n\r\n## Description\r\n<!-- Describe the feature and how it solves the problem. -->\r\nWe should pre-pend the messages (or change the bot's name) based on which environment the data refresh is running in. \r\n\r\n## Alternatives\r\n<!-- Describe any alternative solutions or features you have considered. How is this feature better? -->\r\nWe _could_ turn off messages altogether for staging (how it is currently) but that would make it harder for us to know when a staging data refresh is complete.\r\n\r\n## Additional context\r\n<!-- Add any other context about the feature here; or delete the section entirely. -->\r\n\r\n## Implementation\r\n<!-- Replace the [ ] with [x] to check the box. -->\r\n- [x] \ud83d\ude4b I would be interested in implementing this feature.\r\n\n", "before_files": [{"content": "import logging\nimport os\n\nimport requests\n\n\nlog = logging.getLogger(__name__)\nSLACK_WEBHOOK = \"SLACK_WEBHOOK\"\n\n\ndef message(text: str, summary: str = None) -> None:\n    \"\"\"\n    Send a Slack message to a channel specified by a Slack webhook variable.\n\n    A message is only sent if the SLACK_WEBHOOK environment variable is undefined.\n    \"\"\"\n    if not (webhook := os.getenv(SLACK_WEBHOOK)):\n        log.debug(\n            f\"{SLACK_WEBHOOK} variable not defined, skipping slack message: {text}\"\n        )\n        return\n    if not summary:\n        if \"\\n\" in text:\n            summary = \"Ingestion server message\"\n        else:\n            summary = text\n\n    data = {\n        \"blocks\": [{\"text\": {\"text\": text, \"type\": \"mrkdwn\"}, \"type\": \"section\"}],\n        \"text\": summary,\n        \"username\": \"Data Refresh Notification\",\n        \"icon_emoji\": \"arrows_counterclockwise\",\n    }\n    try:\n        requests.post(webhook, json=data)\n    except Exception as err:\n        log.exception(f\"Unable to issue slack message: {err}\")\n        pass\n", "path": "ingestion_server/ingestion_server/slack.py"}]}