prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  GitLab support is broken
  `{"error":"API V3 is no longer supported. Use API V4 instead."}`
  
  </issue>
  <code>
  [start of liberapay/elsewhere/gitlab.py]
  1 from __future__ import absolute_import, division, print_function, unicode_literals
  2 
  3 from liberapay.elsewhere._base import PlatformOAuth2
  4 from liberapay.elsewhere._extractors import key
  5 from liberapay.elsewhere._paginators import header_links_paginator
  6 
  7 
  8 class GitLab(PlatformOAuth2):
  9 
  10     # Platform attributes
  11     name = 'gitlab'
  12     display_name = 'GitLab'
  13     account_url = 'https://gitlab.com/u/{user_name}'
  14     repo_url = 'https://gitlab.com/{slug}'
  15     has_teams = True
  16 
  17     # Auth attributes
  18     # GitLab uses https://github.com/doorkeeper-gem/doorkeeper
  19     auth_url = 'https://gitlab.com/oauth/authorize'
  20     access_token_url = 'https://gitlab.com/oauth/token'
  21 
  22     # can_auth_with_client_credentials = True
  23     # https://gitlab.com/gitlab-org/gitlab-ce/issues/13795
  24 
  25     # API attributes
  26     # http://doc.gitlab.com/ce/api/
  27     api_format = 'json'
  28     api_paginator = header_links_paginator(total_header='X-Total')
  29     api_url = 'https://gitlab.com/api/v3'
  30     api_user_info_path = '/users/{user_id}'
  31     api_user_name_info_path = '/users?username={user_name}'
  32     api_user_self_info_path = '/user'
  33     api_team_members_path = '/groups/{user_name}/members'
  34     api_repos_path = '/projects?owned=true&visibility=public&order_by=last_activity_at&per_page=100'
  35     api_starred_path = '/projects?starred=true&visibility=public'
  36 
  37     # User info extractors
  38     x_user_id = key('id')
  39     x_user_name = key('username')
  40     x_display_name = key('name')
  41     x_email = key('email')
  42     x_avatar_url = key('avatar_url')
  43     x_description = key('bio')
  44 
  45     # Repo info extractors
  46     x_repo_id = key('id')
  47     x_repo_name = key('name')
  48     x_repo_slug = key('path_with_namespace')
  49     x_repo_description = key('description')
  50     x_repo_last_update = key('last_activity_at')
  51     x_repo_is_fork = key('forked_from_project', clean=bool)
  52     x_repo_stars_count = key('star_count')
  53     x_repo_owner_id = key('owner', clean=lambda d: d['id'])
  54
  [end of liberapay/elsewhere/gitlab.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/liberapay/elsewhere/gitlab.py b/liberapay/elsewhere/gitlab.py
  --- a/liberapay/elsewhere/gitlab.py
  +++ b/liberapay/elsewhere/gitlab.py
  @@ -26,7 +26,7 @@
       # http://doc.gitlab.com/ce/api/
       api_format = 'json'
       api_paginator = header_links_paginator(total_header='X-Total')
  -    api_url = 'https://gitlab.com/api/v3'
  +    api_url = 'https://gitlab.com/api/v4'
       api_user_info_path = '/users/{user_id}'
       api_user_name_info_path = '/users?username={user_name}'
       api_user_self_info_path = '/user'
  
verification_info: {"golden_diff": "diff --git a/liberapay/elsewhere/gitlab.py b/liberapay/elsewhere/gitlab.py\n--- a/liberapay/elsewhere/gitlab.py\n+++ b/liberapay/elsewhere/gitlab.py\n@@ -26,7 +26,7 @@\n     # http://doc.gitlab.com/ce/api/\n     api_format = 'json'\n     api_paginator = header_links_paginator(total_header='X-Total')\n-    api_url = 'https://gitlab.com/api/v3'\n+    api_url = 'https://gitlab.com/api/v4'\n     api_user_info_path = '/users/{user_id}'\n     api_user_name_info_path = '/users?username={user_name}'\n     api_user_self_info_path = '/user'\n", "issue": "GitLab support is broken\n`{\"error\":\"API V3 is no longer supported. Use API V4 instead.\"}`\n", "before_files": [{"content": "from __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom liberapay.elsewhere._base import PlatformOAuth2\nfrom liberapay.elsewhere._extractors import key\nfrom liberapay.elsewhere._paginators import header_links_paginator\n\n\nclass GitLab(PlatformOAuth2):\n\n    # Platform attributes\n    name = 'gitlab'\n    display_name = 'GitLab'\n    account_url = 'https://gitlab.com/u/{user_name}'\n    repo_url = 'https://gitlab.com/{slug}'\n    has_teams = True\n\n    # Auth attributes\n    # GitLab uses https://github.com/doorkeeper-gem/doorkeeper\n    auth_url = 'https://gitlab.com/oauth/authorize'\n    access_token_url = 'https://gitlab.com/oauth/token'\n\n    # can_auth_with_client_credentials = True\n    # https://gitlab.com/gitlab-org/gitlab-ce/issues/13795\n\n    # API attributes\n    # http://doc.gitlab.com/ce/api/\n    api_format = 'json'\n    api_paginator = header_links_paginator(total_header='X-Total')\n    api_url = 'https://gitlab.com/api/v3'\n    api_user_info_path = '/users/{user_id}'\n    api_user_name_info_path = '/users?username={user_name}'\n    api_user_self_info_path = '/user'\n    api_team_members_path = '/groups/{user_name}/members'\n    api_repos_path = '/projects?owned=true&visibility=public&order_by=last_activity_at&per_page=100'\n    api_starred_path = '/projects?starred=true&visibility=public'\n\n    # User info extractors\n    x_user_id = key('id')\n    x_user_name = key('username')\n    x_display_name = key('name')\n    x_email = key('email')\n    x_avatar_url = key('avatar_url')\n    x_description = key('bio')\n\n    # Repo info extractors\n    x_repo_id = key('id')\n    x_repo_name = key('name')\n    x_repo_slug = key('path_with_namespace')\n    x_repo_description = key('description')\n    x_repo_last_update = key('last_activity_at')\n    x_repo_is_fork = key('forked_from_project', clean=bool)\n    x_repo_stars_count = key('star_count')\n    x_repo_owner_id = key('owner', clean=lambda d: d['id'])\n", "path": "liberapay/elsewhere/gitlab.py"}]}