prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Docker language fails on Windows - os.getuid()
  [`docker_cmd`](https://github.com/pre-commit/pre-commit/blob/0cf2638b3b6a2cfde89cb7013e61b2d4a3e12875/pre_commit/languages/docker.py#L80) in languages/docker.py uses `os.getuid()` and `os.getgid()` that don't exist in Python on Windows.
  
  A hook that uses Docker on Windows fails to execute with
  
  ```
  An unexpected error has occurred: AttributeError: module 'os' has no attribute 'getuid'
  Traceback (most recent call last):
    File "C:\Python36\lib\site-packages\pre_commit\error_handler.py", line 46, in error_handler
      yield
    File "C:\Python36\lib\site-packages\pre_commit\main.py", line 294, in main
      return run(args.config, store, args)
    File "C:\Python36\lib\site-packages\pre_commit\commands\run.py", line 293, in run
      return _run_hooks(config, hooks, args, environ)
    File "C:\Python36\lib\site-packages\pre_commit\commands\run.py", line 214, in _run_hooks
      retval |= _run_single_hook(classifier, hook, args, skips, cols)
    File "C:\Python36\lib\site-packages\pre_commit\commands\run.py", line 124, in _run_single_hook
      tuple(filenames) if hook.pass_filenames else (),
    File "C:\Python36\lib\site-packages\pre_commit\repository.py", line 100, in run
      return lang.run_hook(self, file_args)
    File "C:\Python36\lib\site-packages\pre_commit\languages\docker.py", line 99, in run_hook
      cmd = docker_cmd() + entry_tag + cmd_rest
    File "C:\Python36\lib\site-packages\pre_commit\languages\docker.py", line 80, in docker_cmd
      '-u', '{}:{}'.format(os.getuid(), os.getgid()),
  AttributeError: module 'os' has no attribute 'getuid'
  ```
  
  The same hook works fine in Windows Subsystem for Linux.
  
  </issue>
  <code>
  [start of pre_commit/languages/docker.py]
  1 from __future__ import absolute_import
  2 from __future__ import unicode_literals
  3 
  4 import hashlib
  5 import os
  6 
  7 import pre_commit.constants as C
  8 from pre_commit import five
  9 from pre_commit.languages import helpers
  10 from pre_commit.util import CalledProcessError
  11 from pre_commit.util import clean_path_on_failure
  12 from pre_commit.util import cmd_output
  13 
  14 
  15 ENVIRONMENT_DIR = 'docker'
  16 PRE_COMMIT_LABEL = 'PRE_COMMIT'
  17 get_default_version = helpers.basic_get_default_version
  18 healthy = helpers.basic_healthy
  19 
  20 
  21 def md5(s):  # pragma: windows no cover
  22     return hashlib.md5(five.to_bytes(s)).hexdigest()
  23 
  24 
  25 def docker_tag(prefix):  # pragma: windows no cover
  26     md5sum = md5(os.path.basename(prefix.prefix_dir)).lower()
  27     return 'pre-commit-{}'.format(md5sum)
  28 
  29 
  30 def docker_is_running():  # pragma: windows no cover
  31     try:
  32         return cmd_output('docker', 'ps')[0] == 0
  33     except CalledProcessError:
  34         return False
  35 
  36 
  37 def assert_docker_available():  # pragma: windows no cover
  38     assert docker_is_running(), (
  39         'Docker is either not running or not configured in this environment'
  40     )
  41 
  42 
  43 def build_docker_image(prefix, **kwargs):  # pragma: windows no cover
  44     pull = kwargs.pop('pull')
  45     assert not kwargs, kwargs
  46     cmd = (
  47         'docker', 'build',
  48         '--tag', docker_tag(prefix),
  49         '--label', PRE_COMMIT_LABEL,
  50     )
  51     if pull:
  52         cmd += ('--pull',)
  53     # This must come last for old versions of docker.  See #477
  54     cmd += ('.',)
  55     helpers.run_setup_cmd(prefix, cmd)
  56 
  57 
  58 def install_environment(
  59         prefix, version, additional_dependencies,
  60 ):  # pragma: windows no cover
  61     helpers.assert_version_default('docker', version)
  62     helpers.assert_no_additional_deps('docker', additional_dependencies)
  63     assert_docker_available()
  64 
  65     directory = prefix.path(
  66         helpers.environment_dir(ENVIRONMENT_DIR, C.DEFAULT),
  67     )
  68 
  69     # Docker doesn't really have relevant disk environment, but pre-commit
  70     # still needs to cleanup it's state files on failure
  71     with clean_path_on_failure(directory):
  72         build_docker_image(prefix, pull=True)
  73         os.mkdir(directory)
  74 
  75 
  76 def docker_cmd():  # pragma: windows no cover
  77     return (
  78         'docker', 'run',
  79         '--rm',
  80         '-u', '{}:{}'.format(os.getuid(), os.getgid()),
  81         # https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container-volumes-from
  82         # The `Z` option tells Docker to label the content with a private
  83         # unshared label. Only the current container can use a private volume.
  84         '-v', '{}:/src:rw,Z'.format(os.getcwd()),
  85         '--workdir', '/src',
  86     )
  87 
  88 
  89 def run_hook(hook, file_args):  # pragma: windows no cover
  90     assert_docker_available()
  91     # Rebuild the docker image in case it has gone missing, as many people do
  92     # automated cleanup of docker images.
  93     build_docker_image(hook.prefix, pull=False)
  94 
  95     hook_cmd = helpers.to_cmd(hook)
  96     entry_exe, cmd_rest = hook_cmd[0], hook_cmd[1:]
  97 
  98     entry_tag = ('--entrypoint', entry_exe, docker_tag(hook.prefix))
  99     cmd = docker_cmd() + entry_tag + cmd_rest
  100     return helpers.run_xargs(hook, cmd, file_args)
  101
  [end of pre_commit/languages/docker.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/docker.py b/pre_commit/languages/docker.py
  --- a/pre_commit/languages/docker.py
  +++ b/pre_commit/languages/docker.py
  @@ -73,11 +73,18 @@
           os.mkdir(directory)
   
   
  +def get_docker_user():  # pragma: windows no cover
  +    try:
  +        return '{}:{}'.format(os.getuid(), os.getgid())
  +    except AttributeError:
  +        return '1000:1000'
  +
  +
   def docker_cmd():  # pragma: windows no cover
       return (
           'docker', 'run',
           '--rm',
  -        '-u', '{}:{}'.format(os.getuid(), os.getgid()),
  +        '-u', get_docker_user(),
           # https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container-volumes-from
           # The `Z` option tells Docker to label the content with a private
           # unshared label. Only the current container can use a private volume.
  
verification_info: {"golden_diff": "diff --git a/pre_commit/languages/docker.py b/pre_commit/languages/docker.py\n--- a/pre_commit/languages/docker.py\n+++ b/pre_commit/languages/docker.py\n@@ -73,11 +73,18 @@\n         os.mkdir(directory)\n \n \n+def get_docker_user():  # pragma: windows no cover\n+    try:\n+        return '{}:{}'.format(os.getuid(), os.getgid())\n+    except AttributeError:\n+        return '1000:1000'\n+\n+\n def docker_cmd():  # pragma: windows no cover\n     return (\n         'docker', 'run',\n         '--rm',\n-        '-u', '{}:{}'.format(os.getuid(), os.getgid()),\n+        '-u', get_docker_user(),\n         # https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container-volumes-from\n         # The `Z` option tells Docker to label the content with a private\n         # unshared label. Only the current container can use a private volume.\n", "issue": "Docker language fails on Windows - os.getuid()\n[`docker_cmd`](https://github.com/pre-commit/pre-commit/blob/0cf2638b3b6a2cfde89cb7013e61b2d4a3e12875/pre_commit/languages/docker.py#L80) in languages/docker.py uses `os.getuid()` and `os.getgid()` that don't exist in Python on Windows.\r\n\r\nA hook that uses Docker on Windows fails to execute with\r\n\r\n```\r\nAn unexpected error has occurred: AttributeError: module 'os' has no attribute 'getuid'\r\nTraceback (most recent call last):\r\n  File \"C:\\Python36\\lib\\site-packages\\pre_commit\\error_handler.py\", line 46, in error_handler\r\n    yield\r\n  File \"C:\\Python36\\lib\\site-packages\\pre_commit\\main.py\", line 294, in main\r\n    return run(args.config, store, args)\r\n  File \"C:\\Python36\\lib\\site-packages\\pre_commit\\commands\\run.py\", line 293, in run\r\n    return _run_hooks(config, hooks, args, environ)\r\n  File \"C:\\Python36\\lib\\site-packages\\pre_commit\\commands\\run.py\", line 214, in _run_hooks\r\n    retval |= _run_single_hook(classifier, hook, args, skips, cols)\r\n  File \"C:\\Python36\\lib\\site-packages\\pre_commit\\commands\\run.py\", line 124, in _run_single_hook\r\n    tuple(filenames) if hook.pass_filenames else (),\r\n  File \"C:\\Python36\\lib\\site-packages\\pre_commit\\repository.py\", line 100, in run\r\n    return lang.run_hook(self, file_args)\r\n  File \"C:\\Python36\\lib\\site-packages\\pre_commit\\languages\\docker.py\", line 99, in run_hook\r\n    cmd = docker_cmd() + entry_tag + cmd_rest\r\n  File \"C:\\Python36\\lib\\site-packages\\pre_commit\\languages\\docker.py\", line 80, in docker_cmd\r\n    '-u', '{}:{}'.format(os.getuid(), os.getgid()),\r\nAttributeError: module 'os' has no attribute 'getuid'\r\n```\r\n\r\nThe same hook works fine in Windows Subsystem for Linux.\n", "before_files": [{"content": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nimport hashlib\nimport os\n\nimport pre_commit.constants as C\nfrom pre_commit import five\nfrom pre_commit.languages import helpers\nfrom pre_commit.util import CalledProcessError\nfrom pre_commit.util import clean_path_on_failure\nfrom pre_commit.util import cmd_output\n\n\nENVIRONMENT_DIR = 'docker'\nPRE_COMMIT_LABEL = 'PRE_COMMIT'\nget_default_version = helpers.basic_get_default_version\nhealthy = helpers.basic_healthy\n\n\ndef md5(s):  # pragma: windows no cover\n    return hashlib.md5(five.to_bytes(s)).hexdigest()\n\n\ndef docker_tag(prefix):  # pragma: windows no cover\n    md5sum = md5(os.path.basename(prefix.prefix_dir)).lower()\n    return 'pre-commit-{}'.format(md5sum)\n\n\ndef docker_is_running():  # pragma: windows no cover\n    try:\n        return cmd_output('docker', 'ps')[0] == 0\n    except CalledProcessError:\n        return False\n\n\ndef assert_docker_available():  # pragma: windows no cover\n    assert docker_is_running(), (\n        'Docker is either not running or not configured in this environment'\n    )\n\n\ndef build_docker_image(prefix, **kwargs):  # pragma: windows no cover\n    pull = kwargs.pop('pull')\n    assert not kwargs, kwargs\n    cmd = (\n        'docker', 'build',\n        '--tag', docker_tag(prefix),\n        '--label', PRE_COMMIT_LABEL,\n    )\n    if pull:\n        cmd += ('--pull',)\n    # This must come last for old versions of docker.  See #477\n    cmd += ('.',)\n    helpers.run_setup_cmd(prefix, cmd)\n\n\ndef install_environment(\n        prefix, version, additional_dependencies,\n):  # pragma: windows no cover\n    helpers.assert_version_default('docker', version)\n    helpers.assert_no_additional_deps('docker', additional_dependencies)\n    assert_docker_available()\n\n    directory = prefix.path(\n        helpers.environment_dir(ENVIRONMENT_DIR, C.DEFAULT),\n    )\n\n    # Docker doesn't really have relevant disk environment, but pre-commit\n    # still needs to cleanup it's state files on failure\n    with clean_path_on_failure(directory):\n        build_docker_image(prefix, pull=True)\n        os.mkdir(directory)\n\n\ndef docker_cmd():  # pragma: windows no cover\n    return (\n        'docker', 'run',\n        '--rm',\n        '-u', '{}:{}'.format(os.getuid(), os.getgid()),\n        # https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container-volumes-from\n        # The `Z` option tells Docker to label the content with a private\n        # unshared label. Only the current container can use a private volume.\n        '-v', '{}:/src:rw,Z'.format(os.getcwd()),\n        '--workdir', '/src',\n    )\n\n\ndef run_hook(hook, file_args):  # pragma: windows no cover\n    assert_docker_available()\n    # Rebuild the docker image in case it has gone missing, as many people do\n    # automated cleanup of docker images.\n    build_docker_image(hook.prefix, pull=False)\n\n    hook_cmd = helpers.to_cmd(hook)\n    entry_exe, cmd_rest = hook_cmd[0], hook_cmd[1:]\n\n    entry_tag = ('--entrypoint', entry_exe, docker_tag(hook.prefix))\n    cmd = docker_cmd() + entry_tag + cmd_rest\n    return helpers.run_xargs(hook, cmd, file_args)\n", "path": "pre_commit/languages/docker.py"}]}