prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Make URLs in terminal output clickable on launch
  <img width="1028" alt="CleanShot 2022-07-15 at 10 43 57@2x" src="https://user-images.githubusercontent.com/425059/179247049-927a78f7-d6fd-414c-8d60-5732cc6393a3.png">
  
  It's annoying to have to copy and paste the URLs from the terminal output into a browesr on task launch.
  
  ```
  # change:
  
  localhost:3000/?worker_id=x&assignment_id=1
  
  # to:
  
  http://localhost:3000/?worker_id=x&assignment_id=1
  ```
  
  Adding a protocol (http: / https://) before the URL will make it easy to simply click on them to open (in some terminals). We should add this.
  
  ---
  
  Note: I'm not sure if we need to decide between http or https based on certain scenarios
  
  </issue>
  <code>
  [start of mephisto/abstractions/providers/mock/mock_unit.py]
  1 #!/usr/bin/env python3
  2 
  3 # Copyright (c) Facebook, Inc. and its affiliates.
  4 # This source code is licensed under the MIT license found in the
  5 # LICENSE file in the root directory of this source tree.
  6 
  7 from mephisto.data_model.unit import Unit
  8 from mephisto.data_model.constants.assignment_state import AssignmentState
  9 from mephisto.abstractions.blueprint import AgentState
  10 
  11 from mephisto.abstractions.providers.mock.provider_type import PROVIDER_TYPE
  12 from typing import List, Optional, Tuple, Dict, Mapping, Any, Type, TYPE_CHECKING
  13 
  14 if TYPE_CHECKING:
  15     from mephisto.abstractions.database import MephistoDB
  16     from mephisto.data_model.assignment import Assignment
  17     from mephisto.abstractions.providers.mock.mock_datastore import MockDatastore
  18 
  19 from mephisto.utils.logger_core import get_logger
  20 
  21 logger = get_logger(name=__name__)
  22 
  23 
  24 class MockUnit(Unit):
  25     """
  26     This class tracks the status of an individual worker's contribution to a
  27     higher level assignment. It is the smallest 'unit' of work to complete
  28     the assignment, and this class is only responsible for checking
  29     the status of that work itself being done.
  30 
  31     It should be extended for usage with a specific crowd provider
  32     """
  33 
  34     def __init__(
  35         self,
  36         db: "MephistoDB",
  37         db_id: str,
  38         row: Optional[Mapping[str, Any]] = None,
  39         _used_new_call: bool = False,
  40     ):
  41         super().__init__(db, db_id, row=row, _used_new_call=_used_new_call)
  42         self.datastore: "MockDatastore" = db.get_datastore_for_provider(PROVIDER_TYPE)
  43 
  44     def launch(self, task_url: str) -> None:
  45         """Mock launches do nothing right now beyond updating state"""
  46         self.set_db_status(status=AssignmentState.LAUNCHED)
  47 
  48         # TODO(OWN) get this link to the frontend
  49         port = task_url.split(":")[1].split("/")[0]
  50         print(task_url)
  51         print(
  52             f"Mock task launched: localhost:{port} for preview, "
  53             f"localhost:{port}/?worker_id=x&assignment_id={self.db_id}"
  54         )
  55         logger.info(
  56             f"Mock task launched: localhost:{port} for preview, "
  57             f"localhost:{port}/?worker_id=x&assignment_id={self.db_id} for assignment {self.assignment_id}"
  58         )
  59 
  60         return None
  61 
  62     def expire(self) -> float:
  63         """Expiration is immediate on Mocks"""
  64         if self.get_status() not in [
  65             AssignmentState.EXPIRED,
  66             AssignmentState.COMPLETED,
  67         ]:
  68             self.set_db_status(AssignmentState.EXPIRED)
  69         self.datastore.set_unit_expired(self.db_id, True)
  70         return 0.0
  71 
  72     def is_expired(self) -> bool:
  73         """Determine if this unit is expired as according to the vendor."""
  74         return self.datastore.get_unit_expired(self.db_id)
  75 
  76     @staticmethod
  77     def new(
  78         db: "MephistoDB", assignment: "Assignment", index: int, pay_amount: float
  79     ) -> "Unit":
  80         """Create a Unit for the given assignment"""
  81         return MockUnit._register_unit(db, assignment, index, pay_amount, PROVIDER_TYPE)
  82
  [end of mephisto/abstractions/providers/mock/mock_unit.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/mephisto/abstractions/providers/mock/mock_unit.py b/mephisto/abstractions/providers/mock/mock_unit.py
  --- a/mephisto/abstractions/providers/mock/mock_unit.py
  +++ b/mephisto/abstractions/providers/mock/mock_unit.py
  @@ -49,12 +49,12 @@
           port = task_url.split(":")[1].split("/")[0]
           print(task_url)
           print(
  -            f"Mock task launched: localhost:{port} for preview, "
  -            f"localhost:{port}/?worker_id=x&assignment_id={self.db_id}"
  +            f"Mock task launched: http://localhost:{port} for preview, "
  +            f"http://localhost:{port}/?worker_id=x&assignment_id={self.db_id}"
           )
           logger.info(
  -            f"Mock task launched: localhost:{port} for preview, "
  -            f"localhost:{port}/?worker_id=x&assignment_id={self.db_id} for assignment {self.assignment_id}"
  +            f"Mock task launched: http://localhost:{port} for preview, "
  +            f"http://localhost:{port}/?worker_id=x&assignment_id={self.db_id} for assignment {self.assignment_id}"
           )
   
           return None
  
verification_info: {"golden_diff": "diff --git a/mephisto/abstractions/providers/mock/mock_unit.py b/mephisto/abstractions/providers/mock/mock_unit.py\n--- a/mephisto/abstractions/providers/mock/mock_unit.py\n+++ b/mephisto/abstractions/providers/mock/mock_unit.py\n@@ -49,12 +49,12 @@\n         port = task_url.split(\":\")[1].split(\"/\")[0]\n         print(task_url)\n         print(\n-            f\"Mock task launched: localhost:{port} for preview, \"\n-            f\"localhost:{port}/?worker_id=x&assignment_id={self.db_id}\"\n+            f\"Mock task launched: http://localhost:{port} for preview, \"\n+            f\"http://localhost:{port}/?worker_id=x&assignment_id={self.db_id}\"\n         )\n         logger.info(\n-            f\"Mock task launched: localhost:{port} for preview, \"\n-            f\"localhost:{port}/?worker_id=x&assignment_id={self.db_id} for assignment {self.assignment_id}\"\n+            f\"Mock task launched: http://localhost:{port} for preview, \"\n+            f\"http://localhost:{port}/?worker_id=x&assignment_id={self.db_id} for assignment {self.assignment_id}\"\n         )\n \n         return None\n", "issue": "Make URLs in terminal output clickable on launch\n<img width=\"1028\" alt=\"CleanShot 2022-07-15 at 10 43 57@2x\" src=\"https://user-images.githubusercontent.com/425059/179247049-927a78f7-d6fd-414c-8d60-5732cc6393a3.png\">\r\n\r\nIt's annoying to have to copy and paste the URLs from the terminal output into a browesr on task launch.\r\n\r\n```\r\n# change:\r\n\r\nlocalhost:3000/?worker_id=x&assignment_id=1\r\n\r\n# to:\r\n\r\nhttp://localhost:3000/?worker_id=x&assignment_id=1\r\n```\r\n\r\nAdding a protocol (http: / https://) before the URL will make it easy to simply click on them to open (in some terminals). We should add this.\r\n\r\n---\r\n\r\nNote: I'm not sure if we need to decide between http or https based on certain scenarios\n", "before_files": [{"content": "#!/usr/bin/env python3\n\n# Copyright (c) Facebook, Inc. and its affiliates.\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\n\nfrom mephisto.data_model.unit import Unit\nfrom mephisto.data_model.constants.assignment_state import AssignmentState\nfrom mephisto.abstractions.blueprint import AgentState\n\nfrom mephisto.abstractions.providers.mock.provider_type import PROVIDER_TYPE\nfrom typing import List, Optional, Tuple, Dict, Mapping, Any, Type, TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mephisto.abstractions.database import MephistoDB\n    from mephisto.data_model.assignment import Assignment\n    from mephisto.abstractions.providers.mock.mock_datastore import MockDatastore\n\nfrom mephisto.utils.logger_core import get_logger\n\nlogger = get_logger(name=__name__)\n\n\nclass MockUnit(Unit):\n    \"\"\"\n    This class tracks the status of an individual worker's contribution to a\n    higher level assignment. It is the smallest 'unit' of work to complete\n    the assignment, and this class is only responsible for checking\n    the status of that work itself being done.\n\n    It should be extended for usage with a specific crowd provider\n    \"\"\"\n\n    def __init__(\n        self,\n        db: \"MephistoDB\",\n        db_id: str,\n        row: Optional[Mapping[str, Any]] = None,\n        _used_new_call: bool = False,\n    ):\n        super().__init__(db, db_id, row=row, _used_new_call=_used_new_call)\n        self.datastore: \"MockDatastore\" = db.get_datastore_for_provider(PROVIDER_TYPE)\n\n    def launch(self, task_url: str) -> None:\n        \"\"\"Mock launches do nothing right now beyond updating state\"\"\"\n        self.set_db_status(status=AssignmentState.LAUNCHED)\n\n        # TODO(OWN) get this link to the frontend\n        port = task_url.split(\":\")[1].split(\"/\")[0]\n        print(task_url)\n        print(\n            f\"Mock task launched: localhost:{port} for preview, \"\n            f\"localhost:{port}/?worker_id=x&assignment_id={self.db_id}\"\n        )\n        logger.info(\n            f\"Mock task launched: localhost:{port} for preview, \"\n            f\"localhost:{port}/?worker_id=x&assignment_id={self.db_id} for assignment {self.assignment_id}\"\n        )\n\n        return None\n\n    def expire(self) -> float:\n        \"\"\"Expiration is immediate on Mocks\"\"\"\n        if self.get_status() not in [\n            AssignmentState.EXPIRED,\n            AssignmentState.COMPLETED,\n        ]:\n            self.set_db_status(AssignmentState.EXPIRED)\n        self.datastore.set_unit_expired(self.db_id, True)\n        return 0.0\n\n    def is_expired(self) -> bool:\n        \"\"\"Determine if this unit is expired as according to the vendor.\"\"\"\n        return self.datastore.get_unit_expired(self.db_id)\n\n    @staticmethod\n    def new(\n        db: \"MephistoDB\", assignment: \"Assignment\", index: int, pay_amount: float\n    ) -> \"Unit\":\n        \"\"\"Create a Unit for the given assignment\"\"\"\n        return MockUnit._register_unit(db, assignment, index, pay_amount, PROVIDER_TYPE)\n", "path": "mephisto/abstractions/providers/mock/mock_unit.py"}]}