prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add a m.id_access_token flag to unstable_features
  For https://github.com/matrix-org/synapse/issues/5786#issuecomment-523879040
  
  </issue>
  <code>
  [start of synapse/rest/client/versions.py]
  1 # -*- coding: utf-8 -*-
  2 # Copyright 2016 OpenMarket Ltd
  3 #
  4 # Licensed under the Apache License, Version 2.0 (the "License");
  5 # you may not use this file except in compliance with the License.
  6 # You may obtain a copy of the License at
  7 #
  8 #     http://www.apache.org/licenses/LICENSE-2.0
  9 #
  10 # Unless required by applicable law or agreed to in writing, software
  11 # distributed under the License is distributed on an "AS IS" BASIS,
  12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 # See the License for the specific language governing permissions and
  14 # limitations under the License.
  15 
  16 import logging
  17 import re
  18 
  19 from synapse.http.servlet import RestServlet
  20 
  21 logger = logging.getLogger(__name__)
  22 
  23 
  24 class VersionsRestServlet(RestServlet):
  25     PATTERNS = [re.compile("^/_matrix/client/versions$")]
  26 
  27     def on_GET(self, request):
  28         return (
  29             200,
  30             {
  31                 "versions": [
  32                     # XXX: at some point we need to decide whether we need to include
  33                     # the previous version numbers, given we've defined r0.3.0 to be
  34                     # backwards compatible with r0.2.0.  But need to check how
  35                     # conscientious we've been in compatibility, and decide whether the
  36                     # middle number is the major revision when at 0.X.Y (as opposed to
  37                     # X.Y.Z).  And we need to decide whether it's fair to make clients
  38                     # parse the version string to figure out what's going on.
  39                     "r0.0.1",
  40                     "r0.1.0",
  41                     "r0.2.0",
  42                     "r0.3.0",
  43                     "r0.4.0",
  44                     "r0.5.0",
  45                 ],
  46                 # as per MSC1497:
  47                 "unstable_features": {"m.lazy_load_members": True},
  48             },
  49         )
  50 
  51 
  52 def register_servlets(http_server):
  53     VersionsRestServlet().register(http_server)
  54
  [end of synapse/rest/client/versions.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/synapse/rest/client/versions.py b/synapse/rest/client/versions.py
  --- a/synapse/rest/client/versions.py
  +++ b/synapse/rest/client/versions.py
  @@ -44,7 +44,12 @@
                       "r0.5.0",
                   ],
                   # as per MSC1497:
  -                "unstable_features": {"m.lazy_load_members": True},
  +                "unstable_features": {
  +                    "m.lazy_load_members": True,
  +                    # as per https://github.com/matrix-org/synapse/issues/5927
  +                    # to be removed in r0.6.0
  +                    "m.id_access_token": True,
  +                },
               },
           )
  
verification_info: {"golden_diff": "diff --git a/synapse/rest/client/versions.py b/synapse/rest/client/versions.py\n--- a/synapse/rest/client/versions.py\n+++ b/synapse/rest/client/versions.py\n@@ -44,7 +44,12 @@\n                     \"r0.5.0\",\n                 ],\n                 # as per MSC1497:\n-                \"unstable_features\": {\"m.lazy_load_members\": True},\n+                \"unstable_features\": {\n+                    \"m.lazy_load_members\": True,\n+                    # as per https://github.com/matrix-org/synapse/issues/5927\n+                    # to be removed in r0.6.0\n+                    \"m.id_access_token\": True,\n+                },\n             },\n         )\n", "issue": "Add a m.id_access_token flag to unstable_features\nFor https://github.com/matrix-org/synapse/issues/5786#issuecomment-523879040\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2016 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport logging\nimport re\n\nfrom synapse.http.servlet import RestServlet\n\nlogger = logging.getLogger(__name__)\n\n\nclass VersionsRestServlet(RestServlet):\n    PATTERNS = [re.compile(\"^/_matrix/client/versions$\")]\n\n    def on_GET(self, request):\n        return (\n            200,\n            {\n                \"versions\": [\n                    # XXX: at some point we need to decide whether we need to include\n                    # the previous version numbers, given we've defined r0.3.0 to be\n                    # backwards compatible with r0.2.0.  But need to check how\n                    # conscientious we've been in compatibility, and decide whether the\n                    # middle number is the major revision when at 0.X.Y (as opposed to\n                    # X.Y.Z).  And we need to decide whether it's fair to make clients\n                    # parse the version string to figure out what's going on.\n                    \"r0.0.1\",\n                    \"r0.1.0\",\n                    \"r0.2.0\",\n                    \"r0.3.0\",\n                    \"r0.4.0\",\n                    \"r0.5.0\",\n                ],\n                # as per MSC1497:\n                \"unstable_features\": {\"m.lazy_load_members\": True},\n            },\n        )\n\n\ndef register_servlets(http_server):\n    VersionsRestServlet().register(http_server)\n", "path": "synapse/rest/client/versions.py"}]}