prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  "poetry remove" case-sensitivity (qol)
  ```bash
  $ poetry add pyyaml
  Using version ^3.12 for PyYAML
  
  Updating dependencies
  Resolving dependencies...
  
  
  Package operations: 1 install, 0 updates, 0 removals
  
  Writing lock file
  
    - Installing pyyaml (3.12)
  $ poetry remove pyyaml
  
  [KeyError]
  
  remove [-D|--dev] [--dry-run] [--] <packages> (<packages>)...
  
  $ poetry remove PyYAML
  Updating dependencies
  Resolving dependencies...
  
  
  Package operations: 0 installs, 0 updates, 1 removal
  
  Writing lock file
  
    - Removing pyyaml (3.12)
  ```
  
  Not urgent but sending a hint such as "Dependencies are case sensitive." would have been really helpful.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `poetry/console/commands/remove.py`
  Content:
  ```
  1 from .venv_command import VenvCommand
  2 
  3 
  4 class RemoveCommand(VenvCommand):
  5     """
  6     Removes a package from the project dependencies.
  7 
  8     remove
  9         { packages* : Packages that should be removed. }
  10         {--D|dev : Removes a package from the development dependencies. }
  11         {--dry-run : Outputs the operations but will not execute anything
  12                      (implicitly enables --verbose). }
  13     """
  14 
  15     help = """The <info>remove</info> command removes a package from the current
  16 list of installed packages
  17 
  18 <info>poetry remove</info>"""
  19 
  20     _loggers = ["poetry.repositories.pypi_repository"]
  21 
  22     def handle(self):
  23         from poetry.installation import Installer
  24 
  25         packages = self.argument("packages")
  26         is_dev = self.option("dev")
  27 
  28         original_content = self.poetry.file.read()
  29         content = self.poetry.file.read()
  30         poetry_content = content["tool"]["poetry"]
  31         section = "dependencies"
  32         if is_dev:
  33             section = "dev-dependencies"
  34 
  35         # Deleting entries
  36         requirements = {}
  37         for name in packages:
  38             found = False
  39             for key in poetry_content[section]:
  40                 if key.lower() == name.lower():
  41                     found = True
  42                     requirements[name] = poetry_content[section][name]
  43                     break
  44 
  45             if not found:
  46                 raise ValueError("Package {} not found".format(name))
  47 
  48         for key in requirements:
  49             del poetry_content[section][key]
  50 
  51         # Write the new content back
  52         self.poetry.file.write(content)
  53 
  54         # Update packages
  55         self.reset_poetry()
  56 
  57         installer = Installer(
  58             self.output,
  59             self.venv,
  60             self.poetry.package,
  61             self.poetry.locker,
  62             self.poetry.pool,
  63         )
  64 
  65         installer.dry_run(self.option("dry-run"))
  66         installer.update(True)
  67         installer.whitelist(requirements)
  68 
  69         try:
  70             status = installer.run()
  71         except Exception:
  72             self.poetry.file.write(original_content)
  73 
  74             raise
  75 
  76         if status != 0 or self.option("dry-run"):
  77             # Revert changes
  78             if not self.option("dry-run"):
  79                 self.error(
  80                     "\n"
  81                     "Removal failed, reverting pyproject.toml "
  82                     "to its original content."
  83                 )
  84 
  85             self.poetry.file.write(original_content)
  86 
  87         return status
  88
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/poetry/console/commands/remove.py b/poetry/console/commands/remove.py
  --- a/poetry/console/commands/remove.py
  +++ b/poetry/console/commands/remove.py
  @@ -39,7 +39,7 @@
               for key in poetry_content[section]:
                   if key.lower() == name.lower():
                       found = True
  -                    requirements[name] = poetry_content[section][name]
  +                    requirements[key] = poetry_content[section][key]
                       break
   
               if not found:
  
verification_info: {"golden_diff": "diff --git a/poetry/console/commands/remove.py b/poetry/console/commands/remove.py\n--- a/poetry/console/commands/remove.py\n+++ b/poetry/console/commands/remove.py\n@@ -39,7 +39,7 @@\n             for key in poetry_content[section]:\n                 if key.lower() == name.lower():\n                     found = True\n-                    requirements[name] = poetry_content[section][name]\n+                    requirements[key] = poetry_content[section][key]\n                     break\n \n             if not found:\n", "issue": "\"poetry remove\" case-sensitivity (qol)\n```bash\r\n$ poetry add pyyaml\r\nUsing version ^3.12 for PyYAML\r\n\r\nUpdating dependencies\r\nResolving dependencies...\r\n\r\n\r\nPackage operations: 1 install, 0 updates, 0 removals\r\n\r\nWriting lock file\r\n\r\n  - Installing pyyaml (3.12)\r\n$ poetry remove pyyaml\r\n\r\n[KeyError]\r\n\r\nremove [-D|--dev] [--dry-run] [--] <packages> (<packages>)...\r\n\r\n$ poetry remove PyYAML\r\nUpdating dependencies\r\nResolving dependencies...\r\n\r\n\r\nPackage operations: 0 installs, 0 updates, 1 removal\r\n\r\nWriting lock file\r\n\r\n  - Removing pyyaml (3.12)\r\n```\r\n\r\nNot urgent but sending a hint such as \"Dependencies are case sensitive.\" would have been really helpful.\n", "before_files": [{"content": "from .venv_command import VenvCommand\n\n\nclass RemoveCommand(VenvCommand):\n    \"\"\"\n    Removes a package from the project dependencies.\n\n    remove\n        { packages* : Packages that should be removed. }\n        {--D|dev : Removes a package from the development dependencies. }\n        {--dry-run : Outputs the operations but will not execute anything\n                     (implicitly enables --verbose). }\n    \"\"\"\n\n    help = \"\"\"The <info>remove</info> command removes a package from the current\nlist of installed packages\n\n<info>poetry remove</info>\"\"\"\n\n    _loggers = [\"poetry.repositories.pypi_repository\"]\n\n    def handle(self):\n        from poetry.installation import Installer\n\n        packages = self.argument(\"packages\")\n        is_dev = self.option(\"dev\")\n\n        original_content = self.poetry.file.read()\n        content = self.poetry.file.read()\n        poetry_content = content[\"tool\"][\"poetry\"]\n        section = \"dependencies\"\n        if is_dev:\n            section = \"dev-dependencies\"\n\n        # Deleting entries\n        requirements = {}\n        for name in packages:\n            found = False\n            for key in poetry_content[section]:\n                if key.lower() == name.lower():\n                    found = True\n                    requirements[name] = poetry_content[section][name]\n                    break\n\n            if not found:\n                raise ValueError(\"Package {} not found\".format(name))\n\n        for key in requirements:\n            del poetry_content[section][key]\n\n        # Write the new content back\n        self.poetry.file.write(content)\n\n        # Update packages\n        self.reset_poetry()\n\n        installer = Installer(\n            self.output,\n            self.venv,\n            self.poetry.package,\n            self.poetry.locker,\n            self.poetry.pool,\n        )\n\n        installer.dry_run(self.option(\"dry-run\"))\n        installer.update(True)\n        installer.whitelist(requirements)\n\n        try:\n            status = installer.run()\n        except Exception:\n            self.poetry.file.write(original_content)\n\n            raise\n\n        if status != 0 or self.option(\"dry-run\"):\n            # Revert changes\n            if not self.option(\"dry-run\"):\n                self.error(\n                    \"\\n\"\n                    \"Removal failed, reverting pyproject.toml \"\n                    \"to its original content.\"\n                )\n\n            self.poetry.file.write(original_content)\n\n        return status\n", "path": "poetry/console/commands/remove.py"}], "after_files": [{"content": "from .venv_command import VenvCommand\n\n\nclass RemoveCommand(VenvCommand):\n    \"\"\"\n    Removes a package from the project dependencies.\n\n    remove\n        { packages* : Packages that should be removed. }\n        {--D|dev : Removes a package from the development dependencies. }\n        {--dry-run : Outputs the operations but will not execute anything\n                     (implicitly enables --verbose). }\n    \"\"\"\n\n    help = \"\"\"The <info>remove</info> command removes a package from the current\nlist of installed packages\n\n<info>poetry remove</info>\"\"\"\n\n    _loggers = [\"poetry.repositories.pypi_repository\"]\n\n    def handle(self):\n        from poetry.installation import Installer\n\n        packages = self.argument(\"packages\")\n        is_dev = self.option(\"dev\")\n\n        original_content = self.poetry.file.read()\n        content = self.poetry.file.read()\n        poetry_content = content[\"tool\"][\"poetry\"]\n        section = \"dependencies\"\n        if is_dev:\n            section = \"dev-dependencies\"\n\n        # Deleting entries\n        requirements = {}\n        for name in packages:\n            found = False\n            for key in poetry_content[section]:\n                if key.lower() == name.lower():\n                    found = True\n                    requirements[key] = poetry_content[section][key]\n                    break\n\n            if not found:\n                raise ValueError(\"Package {} not found\".format(name))\n\n        for key in requirements:\n            del poetry_content[section][key]\n\n        # Write the new content back\n        self.poetry.file.write(content)\n\n        # Update packages\n        self.reset_poetry()\n\n        installer = Installer(\n            self.output,\n            self.venv,\n            self.poetry.package,\n            self.poetry.locker,\n            self.poetry.pool,\n        )\n\n        installer.dry_run(self.option(\"dry-run\"))\n        installer.update(True)\n        installer.whitelist(requirements)\n\n        try:\n            status = installer.run()\n        except Exception:\n            self.poetry.file.write(original_content)\n\n            raise\n\n        if status != 0 or self.option(\"dry-run\"):\n            # Revert changes\n            if not self.option(\"dry-run\"):\n                self.error(\n                    \"\\n\"\n                    \"Removal failed, reverting pyproject.toml \"\n                    \"to its original content.\"\n                )\n\n            self.poetry.file.write(original_content)\n\n        return status\n", "path": "poetry/console/commands/remove.py"}]}