prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Arbitrary equality in pip freeze causes crash
  <!--
    Hi there! Thank you for discovering and submitting an issue.
  
    Before you submit this; let's make sure of a few things.
    Please make sure the following boxes are ticked if they are correct.
    If not, please try and fulfill these first.
  -->
  
  <!-- Checked checkbox should look like this: [x] -->
  - [ x] I am on the [latest](https://github.com/sdispater/poetry/releases/latest) Poetry version.
  - [x ] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.
  - [x ] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).
  
  <!--
    Once those are done, if you're able to fill in the following list with your information,
    it'd be very helpful to whoever handles the issue.
  -->
  
  - **MacOS High Sierra 10.13.6**: <!-- Replace with version + name -->
  - **Poetry 0.11.5**: <!-- Replace with version -->
  
  ## Issue
  <!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤️ -->
  Running `poetry install` when a package is installed such that pip freeze lists it with an arbitrary equality operator (ex. `package===1.6.1-642-g1e03d5e853`) causes an exception
  
  ```
  [ValueError]
  Unable to parse "=1.6.1-642-g1e03d5e853".
  ```
  
  Looks like the issue is the strict splitting on `==` in `poetry/repositories/installed_repository.py`.
  
  
  </issue>
  <code>
  [start of poetry/repositories/installed_repository.py]
  1 from poetry.packages import Package
  2 from poetry.utils.env import Env
  3 
  4 from .repository import Repository
  5 
  6 
  7 class InstalledRepository(Repository):
  8     @classmethod
  9     def load(cls, env):  # type: (Env) -> InstalledRepository
  10         """
  11         Load installed packages.
  12 
  13         For now, it uses the pip "freeze" command.
  14         """
  15         repo = cls()
  16 
  17         freeze_output = env.run("pip", "freeze")
  18         for line in freeze_output.split("\n"):
  19             if "==" in line:
  20                 name, version = line.split("==")
  21                 repo.add_package(Package(name, version, version))
  22             elif line.startswith("-e "):
  23                 line = line[3:].strip()
  24                 if line.startswith("git+"):
  25                     url = line.lstrip("git+")
  26                     if "@" in url:
  27                         url, rev = url.rsplit("@", 1)
  28                     else:
  29                         rev = "master"
  30 
  31                     name = url.split("/")[-1].rstrip(".git")
  32                     if "#egg=" in rev:
  33                         rev, name = rev.split("#egg=")
  34 
  35                     package = Package(name, "0.0.0")
  36                     package.source_type = "git"
  37                     package.source_url = url
  38                     package.source_reference = rev
  39 
  40                     repo.add_package(package)
  41 
  42         return repo
  43
  [end of poetry/repositories/installed_repository.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/poetry/repositories/installed_repository.py b/poetry/repositories/installed_repository.py
  --- a/poetry/repositories/installed_repository.py
  +++ b/poetry/repositories/installed_repository.py
  @@ -1,3 +1,5 @@
  +import re
  +
   from poetry.packages import Package
   from poetry.utils.env import Env
   
  @@ -17,7 +19,7 @@
           freeze_output = env.run("pip", "freeze")
           for line in freeze_output.split("\n"):
               if "==" in line:
  -                name, version = line.split("==")
  +                name, version = re.split("={2,3}", line)
                   repo.add_package(Package(name, version, version))
               elif line.startswith("-e "):
                   line = line[3:].strip()
  
verification_info: {"golden_diff": "diff --git a/poetry/repositories/installed_repository.py b/poetry/repositories/installed_repository.py\n--- a/poetry/repositories/installed_repository.py\n+++ b/poetry/repositories/installed_repository.py\n@@ -1,3 +1,5 @@\n+import re\n+\n from poetry.packages import Package\n from poetry.utils.env import Env\n \n@@ -17,7 +19,7 @@\n         freeze_output = env.run(\"pip\", \"freeze\")\n         for line in freeze_output.split(\"\\n\"):\n             if \"==\" in line:\n-                name, version = line.split(\"==\")\n+                name, version = re.split(\"={2,3}\", line)\n                 repo.add_package(Package(name, version, version))\n             elif line.startswith(\"-e \"):\n                 line = line[3:].strip()\n", "issue": "Arbitrary equality in pip freeze causes crash\n<!--\r\n  Hi there! Thank you for discovering and submitting an issue.\r\n\r\n  Before you submit this; let's make sure of a few things.\r\n  Please make sure the following boxes are ticked if they are correct.\r\n  If not, please try and fulfill these first.\r\n-->\r\n\r\n<!-- Checked checkbox should look like this: [x] -->\r\n- [ x] I am on the [latest](https://github.com/sdispater/poetry/releases/latest) Poetry version.\r\n- [x ] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.\r\n- [x ] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).\r\n\r\n<!--\r\n  Once those are done, if you're able to fill in the following list with your information,\r\n  it'd be very helpful to whoever handles the issue.\r\n-->\r\n\r\n- **MacOS High Sierra 10.13.6**: <!-- Replace with version + name -->\r\n- **Poetry 0.11.5**: <!-- Replace with version -->\r\n\r\n## Issue\r\n<!-- Now feel free to write your issue, but please be descriptive! Thanks again \ud83d\ude4c \u2764\ufe0f -->\r\nRunning `poetry install` when a package is installed such that pip freeze lists it with an arbitrary equality operator (ex. `package===1.6.1-642-g1e03d5e853`) causes an exception\r\n\r\n```\r\n[ValueError]\r\nUnable to parse \"=1.6.1-642-g1e03d5e853\".\r\n```\r\n\r\nLooks like the issue is the strict splitting on `==` in `poetry/repositories/installed_repository.py`.\r\n\n", "before_files": [{"content": "from poetry.packages import Package\nfrom poetry.utils.env import Env\n\nfrom .repository import Repository\n\n\nclass InstalledRepository(Repository):\n    @classmethod\n    def load(cls, env):  # type: (Env) -> InstalledRepository\n        \"\"\"\n        Load installed packages.\n\n        For now, it uses the pip \"freeze\" command.\n        \"\"\"\n        repo = cls()\n\n        freeze_output = env.run(\"pip\", \"freeze\")\n        for line in freeze_output.split(\"\\n\"):\n            if \"==\" in line:\n                name, version = line.split(\"==\")\n                repo.add_package(Package(name, version, version))\n            elif line.startswith(\"-e \"):\n                line = line[3:].strip()\n                if line.startswith(\"git+\"):\n                    url = line.lstrip(\"git+\")\n                    if \"@\" in url:\n                        url, rev = url.rsplit(\"@\", 1)\n                    else:\n                        rev = \"master\"\n\n                    name = url.split(\"/\")[-1].rstrip(\".git\")\n                    if \"#egg=\" in rev:\n                        rev, name = rev.split(\"#egg=\")\n\n                    package = Package(name, \"0.0.0\")\n                    package.source_type = \"git\"\n                    package.source_url = url\n                    package.source_reference = rev\n\n                    repo.add_package(package)\n\n        return repo\n", "path": "poetry/repositories/installed_repository.py"}]}