prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  defect_enhancement_task Taskcluster task is missing the artifact
  From the task () logs:
  ```
  [taskcluster 2019-05-21 08:37:51.436Z] === Task Finished ===
  [taskcluster 2019-05-21 08:37:51.519Z] Artifact "public/defectenhancementtaskmodel.xz" not found at "/defectenhancementtaskmodel.xz"
  [taskcluster 2019-05-21 08:37:51.927Z] Successful task run with exit code: 0 completed in 471.275 seconds
  ```
  
  </issue>
  <code>
  [start of scripts/trainer.py]
  1 # -*- coding: utf-8 -*-
  2 
  3 import argparse
  4 import lzma
  5 import os
  6 import shutil
  7 from logging import INFO, basicConfig, getLogger
  8 from urllib.request import urlretrieve
  9 
  10 from bugbug.models import get_model_class
  11 
  12 basicConfig(level=INFO)
  13 logger = getLogger(__name__)
  14 
  15 BASE_URL = "https://index.taskcluster.net/v1/task/project.relman.bugbug.data_{}.latest/artifacts/public"
  16 
  17 
  18 class Trainer(object):
  19     def decompress_file(self, path):
  20         with lzma.open(f"{path}.xz", "rb") as input_f:
  21             with open(path, "wb") as output_f:
  22                 shutil.copyfileobj(input_f, output_f)
  23 
  24     def compress_file(self, path):
  25         with open(path, "rb") as input_f:
  26             with lzma.open(f"{path}.xz", "wb") as output_f:
  27                 shutil.copyfileobj(input_f, output_f)
  28 
  29     def go(self, model_name):
  30         # Download datasets that were built by bugbug_data.
  31         os.makedirs("data", exist_ok=True)
  32 
  33         # Bugs.json
  34         logger.info("Downloading bugs database")
  35         bugs_url = BASE_URL.format("bugs")
  36         urlretrieve(f"{bugs_url}/bugs.json.xz", "data/bugs.json.xz")
  37         logger.info("Decompressing bugs database")
  38         self.decompress_file("data/bugs.json")
  39 
  40         logger.info(f"Training *{model_name}* model")
  41 
  42         model_class = get_model_class(model_name)
  43         model = model_class()
  44         model.train()
  45 
  46         model_file_name = f"{model_name}model"
  47         self.compress_file(model_file_name)
  48 
  49 
  50 def main():
  51     description = "Train the models"
  52     parser = argparse.ArgumentParser(description=description)
  53 
  54     parser.add_argument("model", help="Which model to train.")
  55 
  56     args = parser.parse_args()
  57 
  58     retriever = Trainer()
  59     retriever.go(args.model)
  60
  [end of scripts/trainer.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/scripts/trainer.py b/scripts/trainer.py
  --- a/scripts/trainer.py
  +++ b/scripts/trainer.py
  @@ -43,9 +43,14 @@
           model = model_class()
           model.train()
   
  +        logger.info(f"Training done")
  +
           model_file_name = f"{model_name}model"
  +        assert os.path.exists(model_file_name)
           self.compress_file(model_file_name)
   
  +        logger.info(f"Model compressed")
  +
   
   def main():
       description = "Train the models"
  
verification_info: {"golden_diff": "diff --git a/scripts/trainer.py b/scripts/trainer.py\n--- a/scripts/trainer.py\n+++ b/scripts/trainer.py\n@@ -43,9 +43,14 @@\n         model = model_class()\n         model.train()\n \n+        logger.info(f\"Training done\")\n+\n         model_file_name = f\"{model_name}model\"\n+        assert os.path.exists(model_file_name)\n         self.compress_file(model_file_name)\n \n+        logger.info(f\"Model compressed\")\n+\n \n def main():\n     description = \"Train the models\"\n", "issue": "defect_enhancement_task Taskcluster task is missing the artifact\nFrom the task () logs:\r\n```\r\n[taskcluster 2019-05-21 08:37:51.436Z] === Task Finished ===\r\n[taskcluster 2019-05-21 08:37:51.519Z] Artifact \"public/defectenhancementtaskmodel.xz\" not found at \"/defectenhancementtaskmodel.xz\"\r\n[taskcluster 2019-05-21 08:37:51.927Z] Successful task run with exit code: 0 completed in 471.275 seconds\r\n```\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\nimport argparse\nimport lzma\nimport os\nimport shutil\nfrom logging import INFO, basicConfig, getLogger\nfrom urllib.request import urlretrieve\n\nfrom bugbug.models import get_model_class\n\nbasicConfig(level=INFO)\nlogger = getLogger(__name__)\n\nBASE_URL = \"https://index.taskcluster.net/v1/task/project.relman.bugbug.data_{}.latest/artifacts/public\"\n\n\nclass Trainer(object):\n    def decompress_file(self, path):\n        with lzma.open(f\"{path}.xz\", \"rb\") as input_f:\n            with open(path, \"wb\") as output_f:\n                shutil.copyfileobj(input_f, output_f)\n\n    def compress_file(self, path):\n        with open(path, \"rb\") as input_f:\n            with lzma.open(f\"{path}.xz\", \"wb\") as output_f:\n                shutil.copyfileobj(input_f, output_f)\n\n    def go(self, model_name):\n        # Download datasets that were built by bugbug_data.\n        os.makedirs(\"data\", exist_ok=True)\n\n        # Bugs.json\n        logger.info(\"Downloading bugs database\")\n        bugs_url = BASE_URL.format(\"bugs\")\n        urlretrieve(f\"{bugs_url}/bugs.json.xz\", \"data/bugs.json.xz\")\n        logger.info(\"Decompressing bugs database\")\n        self.decompress_file(\"data/bugs.json\")\n\n        logger.info(f\"Training *{model_name}* model\")\n\n        model_class = get_model_class(model_name)\n        model = model_class()\n        model.train()\n\n        model_file_name = f\"{model_name}model\"\n        self.compress_file(model_file_name)\n\n\ndef main():\n    description = \"Train the models\"\n    parser = argparse.ArgumentParser(description=description)\n\n    parser.add_argument(\"model\", help=\"Which model to train.\")\n\n    args = parser.parse_args()\n\n    retriever = Trainer()\n    retriever.go(args.model)\n", "path": "scripts/trainer.py"}]}