prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  python_venv language fails to use python3 interpreter and is using python2.7 instead
  Apparently pre-commit failed to use python3 interpreter when I tried to add a hook and thus failed because venv module was not installed on default python2.7!
  
  ```
  $ pre-commit try-repo ../python-license-check                                                                                                                                                                   [19:55:27]
  [INFO] Initializing environment for ../python-license-check.
  ===============================================================================
  Using config:
  ===============================================================================
  repos:
  -   repo: ../python-license-check
      rev: 4048cf3844dbbf45690c153a7da7f532585ec87c
      hooks:
      -   id: liccheck
  ===============================================================================
  [INFO] Installing environment for ../python-license-check.
  [INFO] Once installed this environment will be reused.
  [INFO] This may take a few minutes...
  An unexpected error has occurred: CalledProcessError: Command: ('/Users/ssbarnea/.pyenv/versions/2.7.14/bin/python2.7', '-mvenv', '/var/folders/br/99tfdvcs3vvfwdk69z7f0xmc0000gn/T/tmpayl0P5/repoHa7_qe/py_venv-python2.7')
  Return code: 1
  Expected return code: 0
  Output: (none)
  Errors:
      /Users/ssbarnea/.pyenv/versions/2.7.14/bin/python2.7: No module named venv
  
  
  Check the log at /Users/ssbarnea/.cache/pre-commit/pre-commit.log
  FAIL: 1
  ssbarnea@smac: ~/os/jira master ⚡ $ cat ../python-license-check/.pre-commit-hooks.yaml                                                                                                                                                            [19:55:34]
  -   id: liccheck
      name: Validates dependency licenses for Python packages
      description: This validator validates a pre-commit hooks manifest file
      entry: liccheck -s setup.cfg -r requirements.txt
      language: python_venv
  ```
  
  Based on the documentation I was expecting to see pre-commit using the `python3` executable for calling venv module. 
  
  </issue>
  <code>
  [start of pre_commit/languages/python_venv.py]
  1 from __future__ import unicode_literals
  2 
  3 import os.path
  4 
  5 from pre_commit.languages import python
  6 from pre_commit.util import CalledProcessError
  7 from pre_commit.util import cmd_output
  8 
  9 
  10 ENVIRONMENT_DIR = 'py_venv'
  11 
  12 
  13 def orig_py_exe(exe):  # pragma: no cover (platform specific)
  14     """A -mvenv virtualenv made from a -mvirtualenv virtualenv installs
  15     packages to the incorrect location.  Attempt to find the _original_ exe
  16     and invoke `-mvenv` from there.
  17 
  18     See:
  19     - https://github.com/pre-commit/pre-commit/issues/755
  20     - https://github.com/pypa/virtualenv/issues/1095
  21     - https://bugs.python.org/issue30811
  22     """
  23     try:
  24         prefix_script = 'import sys; print(sys.real_prefix)'
  25         _, prefix, _ = cmd_output(exe, '-c', prefix_script)
  26         prefix = prefix.strip()
  27     except CalledProcessError:
  28         # not created from -mvirtualenv
  29         return exe
  30 
  31     if os.name == 'nt':
  32         expected = os.path.join(prefix, 'python.exe')
  33     else:
  34         expected = os.path.join(prefix, 'bin', os.path.basename(exe))
  35 
  36     if os.path.exists(expected):
  37         return expected
  38     else:
  39         return exe
  40 
  41 
  42 def make_venv(envdir, python):
  43     cmd_output(orig_py_exe(python), '-mvenv', envdir, cwd='/')
  44 
  45 
  46 get_default_version = python.get_default_version
  47 _interface = python.py_interface(ENVIRONMENT_DIR, make_venv)
  48 in_env, healthy, run_hook, install_environment = _interface
  49
  [end of pre_commit/languages/python_venv.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/pre_commit/languages/python_venv.py b/pre_commit/languages/python_venv.py
  --- a/pre_commit/languages/python_venv.py
  +++ b/pre_commit/languages/python_venv.py
  @@ -1,6 +1,7 @@
   from __future__ import unicode_literals
   
   import os.path
  +import sys
   
   from pre_commit.languages import python
   from pre_commit.util import CalledProcessError
  @@ -10,6 +11,13 @@
   ENVIRONMENT_DIR = 'py_venv'
   
   
  +def get_default_version():  # pragma: no cover (version specific)
  +    if sys.version_info < (3,):
  +        return 'python3'
  +    else:
  +        return python.get_default_version()
  +
  +
   def orig_py_exe(exe):  # pragma: no cover (platform specific)
       """A -mvenv virtualenv made from a -mvirtualenv virtualenv installs
       packages to the incorrect location.  Attempt to find the _original_ exe
  @@ -43,6 +51,5 @@
       cmd_output(orig_py_exe(python), '-mvenv', envdir, cwd='/')
   
   
  -get_default_version = python.get_default_version
   _interface = python.py_interface(ENVIRONMENT_DIR, make_venv)
   in_env, healthy, run_hook, install_environment = _interface
  
verification_info: {"golden_diff": "diff --git a/pre_commit/languages/python_venv.py b/pre_commit/languages/python_venv.py\n--- a/pre_commit/languages/python_venv.py\n+++ b/pre_commit/languages/python_venv.py\n@@ -1,6 +1,7 @@\n from __future__ import unicode_literals\n \n import os.path\n+import sys\n \n from pre_commit.languages import python\n from pre_commit.util import CalledProcessError\n@@ -10,6 +11,13 @@\n ENVIRONMENT_DIR = 'py_venv'\n \n \n+def get_default_version():  # pragma: no cover (version specific)\n+    if sys.version_info < (3,):\n+        return 'python3'\n+    else:\n+        return python.get_default_version()\n+\n+\n def orig_py_exe(exe):  # pragma: no cover (platform specific)\n     \"\"\"A -mvenv virtualenv made from a -mvirtualenv virtualenv installs\n     packages to the incorrect location.  Attempt to find the _original_ exe\n@@ -43,6 +51,5 @@\n     cmd_output(orig_py_exe(python), '-mvenv', envdir, cwd='/')\n \n \n-get_default_version = python.get_default_version\n _interface = python.py_interface(ENVIRONMENT_DIR, make_venv)\n in_env, healthy, run_hook, install_environment = _interface\n", "issue": "python_venv language fails to use python3 interpreter and is using python2.7 instead\nApparently pre-commit failed to use python3 interpreter when I tried to add a hook and thus failed because venv module was not installed on default python2.7!\r\n\r\n```\r\n$ pre-commit try-repo ../python-license-check                                                                                                                                                                   [19:55:27]\r\n[INFO] Initializing environment for ../python-license-check.\r\n===============================================================================\r\nUsing config:\r\n===============================================================================\r\nrepos:\r\n-   repo: ../python-license-check\r\n    rev: 4048cf3844dbbf45690c153a7da7f532585ec87c\r\n    hooks:\r\n    -   id: liccheck\r\n===============================================================================\r\n[INFO] Installing environment for ../python-license-check.\r\n[INFO] Once installed this environment will be reused.\r\n[INFO] This may take a few minutes...\r\nAn unexpected error has occurred: CalledProcessError: Command: ('/Users/ssbarnea/.pyenv/versions/2.7.14/bin/python2.7', '-mvenv', '/var/folders/br/99tfdvcs3vvfwdk69z7f0xmc0000gn/T/tmpayl0P5/repoHa7_qe/py_venv-python2.7')\r\nReturn code: 1\r\nExpected return code: 0\r\nOutput: (none)\r\nErrors:\r\n    /Users/ssbarnea/.pyenv/versions/2.7.14/bin/python2.7: No module named venv\r\n\r\n\r\nCheck the log at /Users/ssbarnea/.cache/pre-commit/pre-commit.log\r\nFAIL: 1\r\nssbarnea@smac: ~/os/jira master \u26a1 $ cat ../python-license-check/.pre-commit-hooks.yaml                                                                                                                                                            [19:55:34]\r\n-   id: liccheck\r\n    name: Validates dependency licenses for Python packages\r\n    description: This validator validates a pre-commit hooks manifest file\r\n    entry: liccheck -s setup.cfg -r requirements.txt\r\n    language: python_venv\r\n```\r\n\r\nBased on the documentation I was expecting to see pre-commit using the `python3` executable for calling venv module. \n", "before_files": [{"content": "from __future__ import unicode_literals\n\nimport os.path\n\nfrom pre_commit.languages import python\nfrom pre_commit.util import CalledProcessError\nfrom pre_commit.util import cmd_output\n\n\nENVIRONMENT_DIR = 'py_venv'\n\n\ndef orig_py_exe(exe):  # pragma: no cover (platform specific)\n    \"\"\"A -mvenv virtualenv made from a -mvirtualenv virtualenv installs\n    packages to the incorrect location.  Attempt to find the _original_ exe\n    and invoke `-mvenv` from there.\n\n    See:\n    - https://github.com/pre-commit/pre-commit/issues/755\n    - https://github.com/pypa/virtualenv/issues/1095\n    - https://bugs.python.org/issue30811\n    \"\"\"\n    try:\n        prefix_script = 'import sys; print(sys.real_prefix)'\n        _, prefix, _ = cmd_output(exe, '-c', prefix_script)\n        prefix = prefix.strip()\n    except CalledProcessError:\n        # not created from -mvirtualenv\n        return exe\n\n    if os.name == 'nt':\n        expected = os.path.join(prefix, 'python.exe')\n    else:\n        expected = os.path.join(prefix, 'bin', os.path.basename(exe))\n\n    if os.path.exists(expected):\n        return expected\n    else:\n        return exe\n\n\ndef make_venv(envdir, python):\n    cmd_output(orig_py_exe(python), '-mvenv', envdir, cwd='/')\n\n\nget_default_version = python.get_default_version\n_interface = python.py_interface(ENVIRONMENT_DIR, make_venv)\nin_env, healthy, run_hook, install_environment = _interface\n", "path": "pre_commit/languages/python_venv.py"}]}