prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  pip uses deprecated SafeConfigParser
  * Pip version: 9.0.1
  * Python version: 3.6.1
  * Operating system: Mac OS X 10.12.4
  
  ### Description:
  
  With `error::DeprecationWarning` in `PYTHONWARNINGS`:
  
  ```
  pip uninstall -y faker
  /Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/pep425tags.py:260: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp
  Exception:
  Traceback (most recent call last):
    File "/Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
      status = self.run(options, args)
    File "/Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/commands/uninstall.py", line 76, in run
      requirement_set.uninstall(auto_confirm=options.yes)
    File "/Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/req/req_set.py", line 346, in uninstall
      req.uninstall(auto_confirm=auto_confirm)
    File "/Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/req/req_install.py", line 732, in uninstall
      config = configparser.SafeConfigParser(**options)
    File "/Users/davidchudzicki/.cache/hypothesis-build-runtimes/versions/python3.6/lib/python3.6/configparser.py", line 1212, in __init__
      DeprecationWarning, stacklevel=2
  DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
  ```
  
  </issue>
  <code>
  [start of src/pip/_internal/vcs/mercurial.py]
  1 from __future__ import absolute_import
  2 
  3 import logging
  4 import os
  5 
  6 from pip._vendor.six.moves import configparser
  7 
  8 from pip._internal.download import path_to_url
  9 from pip._internal.utils.misc import display_path, make_vcs_requirement_url
  10 from pip._internal.utils.temp_dir import TempDirectory
  11 from pip._internal.vcs import VersionControl, vcs
  12 
  13 logger = logging.getLogger(__name__)
  14 
  15 
  16 class Mercurial(VersionControl):
  17     name = 'hg'
  18     dirname = '.hg'
  19     repo_name = 'clone'
  20     schemes = ('hg', 'hg+http', 'hg+https', 'hg+ssh', 'hg+static-http')
  21 
  22     def get_base_rev_args(self, rev):
  23         return [rev]
  24 
  25     def export(self, location):
  26         """Export the Hg repository at the url to the destination location"""
  27         with TempDirectory(kind="export") as temp_dir:
  28             self.unpack(temp_dir.path)
  29 
  30             self.run_command(
  31                 ['archive', location], show_stdout=False, cwd=temp_dir.path
  32             )
  33 
  34     def fetch_new(self, dest, url, rev_options):
  35         rev_display = rev_options.to_display()
  36         logger.info(
  37             'Cloning hg %s%s to %s',
  38             url,
  39             rev_display,
  40             display_path(dest),
  41         )
  42         self.run_command(['clone', '--noupdate', '-q', url, dest])
  43         cmd_args = ['update', '-q'] + rev_options.to_args()
  44         self.run_command(cmd_args, cwd=dest)
  45 
  46     def switch(self, dest, url, rev_options):
  47         repo_config = os.path.join(dest, self.dirname, 'hgrc')
  48         config = configparser.SafeConfigParser()
  49         try:
  50             config.read(repo_config)
  51             config.set('paths', 'default', url)
  52             with open(repo_config, 'w') as config_file:
  53                 config.write(config_file)
  54         except (OSError, configparser.NoSectionError) as exc:
  55             logger.warning(
  56                 'Could not switch Mercurial repository to %s: %s', url, exc,
  57             )
  58         else:
  59             cmd_args = ['update', '-q'] + rev_options.to_args()
  60             self.run_command(cmd_args, cwd=dest)
  61 
  62     def update(self, dest, url, rev_options):
  63         self.run_command(['pull', '-q'], cwd=dest)
  64         cmd_args = ['update', '-q'] + rev_options.to_args()
  65         self.run_command(cmd_args, cwd=dest)
  66 
  67     def get_url(self, location):
  68         url = self.run_command(
  69             ['showconfig', 'paths.default'],
  70             show_stdout=False, cwd=location).strip()
  71         if self._is_local_repository(url):
  72             url = path_to_url(url)
  73         return url.strip()
  74 
  75     def get_revision(self, location):
  76         current_revision = self.run_command(
  77             ['parents', '--template={rev}'],
  78             show_stdout=False, cwd=location).strip()
  79         return current_revision
  80 
  81     def get_revision_hash(self, location):
  82         current_rev_hash = self.run_command(
  83             ['parents', '--template={node}'],
  84             show_stdout=False, cwd=location).strip()
  85         return current_rev_hash
  86 
  87     def get_src_requirement(self, dist, location):
  88         repo = self.get_url(location)
  89         if not repo.lower().startswith('hg:'):
  90             repo = 'hg+' + repo
  91         current_rev_hash = self.get_revision_hash(location)
  92         egg_project_name = dist.egg_name().split('-', 1)[0]
  93         return make_vcs_requirement_url(repo, current_rev_hash,
  94                                         egg_project_name)
  95 
  96     def is_commit_id_equal(self, dest, name):
  97         """Always assume the versions don't match"""
  98         return False
  99 
  100 
  101 vcs.register(Mercurial)
  102
  [end of src/pip/_internal/vcs/mercurial.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/src/pip/_internal/vcs/mercurial.py b/src/pip/_internal/vcs/mercurial.py
  --- a/src/pip/_internal/vcs/mercurial.py
  +++ b/src/pip/_internal/vcs/mercurial.py
  @@ -45,7 +45,7 @@
   
       def switch(self, dest, url, rev_options):
           repo_config = os.path.join(dest, self.dirname, 'hgrc')
  -        config = configparser.SafeConfigParser()
  +        config = configparser.RawConfigParser()
           try:
               config.read(repo_config)
               config.set('paths', 'default', url)
  
verification_info: {"golden_diff": "diff --git a/src/pip/_internal/vcs/mercurial.py b/src/pip/_internal/vcs/mercurial.py\n--- a/src/pip/_internal/vcs/mercurial.py\n+++ b/src/pip/_internal/vcs/mercurial.py\n@@ -45,7 +45,7 @@\n \n     def switch(self, dest, url, rev_options):\n         repo_config = os.path.join(dest, self.dirname, 'hgrc')\n-        config = configparser.SafeConfigParser()\n+        config = configparser.RawConfigParser()\n         try:\n             config.read(repo_config)\n             config.set('paths', 'default', url)\n", "issue": "pip uses deprecated SafeConfigParser\n* Pip version: 9.0.1\r\n* Python version: 3.6.1\r\n* Operating system: Mac OS X 10.12.4\r\n\r\n### Description:\r\n\r\nWith `error::DeprecationWarning` in `PYTHONWARNINGS`:\r\n\r\n```\r\npip uninstall -y faker\r\n/Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/pep425tags.py:260: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\r\n  import imp\r\nException:\r\nTraceback (most recent call last):\r\n  File \"/Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/basecommand.py\", line 215, in main\r\n    status = self.run(options, args)\r\n  File \"/Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/commands/uninstall.py\", line 76, in run\r\n    requirement_set.uninstall(auto_confirm=options.yes)\r\n  File \"/Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/req/req_set.py\", line 346, in uninstall\r\n    req.uninstall(auto_confirm=auto_confirm)\r\n  File \"/Users/davidchudzicki/.cache/hypothesis-build-runtimes/.tox/py36-full/lib/python3.6/site-packages/pip/req/req_install.py\", line 732, in uninstall\r\n    config = configparser.SafeConfigParser(**options)\r\n  File \"/Users/davidchudzicki/.cache/hypothesis-build-runtimes/versions/python3.6/lib/python3.6/configparser.py\", line 1212, in __init__\r\n    DeprecationWarning, stacklevel=2\r\nDeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.\r\n```\n", "before_files": [{"content": "from __future__ import absolute_import\n\nimport logging\nimport os\n\nfrom pip._vendor.six.moves import configparser\n\nfrom pip._internal.download import path_to_url\nfrom pip._internal.utils.misc import display_path, make_vcs_requirement_url\nfrom pip._internal.utils.temp_dir import TempDirectory\nfrom pip._internal.vcs import VersionControl, vcs\n\nlogger = logging.getLogger(__name__)\n\n\nclass Mercurial(VersionControl):\n    name = 'hg'\n    dirname = '.hg'\n    repo_name = 'clone'\n    schemes = ('hg', 'hg+http', 'hg+https', 'hg+ssh', 'hg+static-http')\n\n    def get_base_rev_args(self, rev):\n        return [rev]\n\n    def export(self, location):\n        \"\"\"Export the Hg repository at the url to the destination location\"\"\"\n        with TempDirectory(kind=\"export\") as temp_dir:\n            self.unpack(temp_dir.path)\n\n            self.run_command(\n                ['archive', location], show_stdout=False, cwd=temp_dir.path\n            )\n\n    def fetch_new(self, dest, url, rev_options):\n        rev_display = rev_options.to_display()\n        logger.info(\n            'Cloning hg %s%s to %s',\n            url,\n            rev_display,\n            display_path(dest),\n        )\n        self.run_command(['clone', '--noupdate', '-q', url, dest])\n        cmd_args = ['update', '-q'] + rev_options.to_args()\n        self.run_command(cmd_args, cwd=dest)\n\n    def switch(self, dest, url, rev_options):\n        repo_config = os.path.join(dest, self.dirname, 'hgrc')\n        config = configparser.SafeConfigParser()\n        try:\n            config.read(repo_config)\n            config.set('paths', 'default', url)\n            with open(repo_config, 'w') as config_file:\n                config.write(config_file)\n        except (OSError, configparser.NoSectionError) as exc:\n            logger.warning(\n                'Could not switch Mercurial repository to %s: %s', url, exc,\n            )\n        else:\n            cmd_args = ['update', '-q'] + rev_options.to_args()\n            self.run_command(cmd_args, cwd=dest)\n\n    def update(self, dest, url, rev_options):\n        self.run_command(['pull', '-q'], cwd=dest)\n        cmd_args = ['update', '-q'] + rev_options.to_args()\n        self.run_command(cmd_args, cwd=dest)\n\n    def get_url(self, location):\n        url = self.run_command(\n            ['showconfig', 'paths.default'],\n            show_stdout=False, cwd=location).strip()\n        if self._is_local_repository(url):\n            url = path_to_url(url)\n        return url.strip()\n\n    def get_revision(self, location):\n        current_revision = self.run_command(\n            ['parents', '--template={rev}'],\n            show_stdout=False, cwd=location).strip()\n        return current_revision\n\n    def get_revision_hash(self, location):\n        current_rev_hash = self.run_command(\n            ['parents', '--template={node}'],\n            show_stdout=False, cwd=location).strip()\n        return current_rev_hash\n\n    def get_src_requirement(self, dist, location):\n        repo = self.get_url(location)\n        if not repo.lower().startswith('hg:'):\n            repo = 'hg+' + repo\n        current_rev_hash = self.get_revision_hash(location)\n        egg_project_name = dist.egg_name().split('-', 1)[0]\n        return make_vcs_requirement_url(repo, current_rev_hash,\n                                        egg_project_name)\n\n    def is_commit_id_equal(self, dest, name):\n        \"\"\"Always assume the versions don't match\"\"\"\n        return False\n\n\nvcs.register(Mercurial)\n", "path": "src/pip/_internal/vcs/mercurial.py"}]}