prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  flush_endpoint capability added if flush_enabled (fixes #496)
  
  
  </issue>
  <code>
  [start of kinto/__init__.py]
  1 import pkg_resources
  2 import logging
  3 
  4 import cliquet
  5 from pyramid.config import Configurator
  6 from pyramid.settings import asbool
  7 from pyramid.security import Authenticated
  8 
  9 from kinto.authorization import RouteFactory
  10 
  11 # Module version, as defined in PEP-0396.
  12 __version__ = pkg_resources.get_distribution(__package__).version
  13 
  14 # Implemented HTTP API Version
  15 HTTP_API_VERSION = '1.4'
  16 
  17 # Main kinto logger
  18 logger = logging.getLogger(__name__)
  19 
  20 
  21 DEFAULT_SETTINGS = {
  22     'retry_after_seconds': 3,
  23     'cache_backend': 'cliquet.cache.memory',
  24     'permission_backend': 'cliquet.permission.memory',
  25     'storage_backend': 'cliquet.storage.memory',
  26     'project_docs': 'https://kinto.readthedocs.org/',
  27     'bucket_create_principals': Authenticated,
  28     'multiauth.authorization_policy': (
  29         'kinto.authorization.AuthorizationPolicy'),
  30     'experimental_collection_schema_validation': 'False',
  31     'http_api_version': HTTP_API_VERSION
  32 }
  33 
  34 
  35 def main(global_config, config=None, **settings):
  36     if not config:
  37         config = Configurator(settings=settings, root_factory=RouteFactory)
  38 
  39     # Force project name, since it determines settings prefix.
  40     config.add_settings({'cliquet.project_name': 'kinto'})
  41 
  42     cliquet.initialize(config,
  43                        version=__version__,
  44                        default_settings=DEFAULT_SETTINGS)
  45 
  46     settings = config.get_settings()
  47 
  48     # In Kinto API 1.x, a default bucket is available.
  49     # Force its inclusion if not specified in settings.
  50     if 'kinto.plugins.default_bucket' not in settings['includes']:
  51         config.include('kinto.plugins.default_bucket')
  52 
  53     # Retro-compatibility with first Kinto clients.
  54     config.registry.public_settings.add('cliquet.batch_max_requests')
  55 
  56     # Expose capability
  57     schema_enabled = asbool(
  58         settings['experimental_collection_schema_validation']
  59     )
  60     if schema_enabled:
  61         config.add_api_capability(
  62             "schema",
  63             description="Validates collection records with JSON schemas.",
  64             url="http://kinto.readthedocs.org/en/latest/api/1.x/"
  65                 "collections.html#collection-json-schema")
  66 
  67     # Scan Kinto views.
  68     kwargs = {}
  69     flush_enabled = asbool(settings.get('flush_endpoint_enabled'))
  70     if not flush_enabled:
  71         kwargs['ignore'] = 'kinto.views.flush'
  72     config.scan("kinto.views", **kwargs)
  73 
  74     app = config.make_wsgi_app()
  75 
  76     # Install middleware (idempotent if disabled)
  77     return cliquet.install_middlewares(app, settings)
  78
  [end of kinto/__init__.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/kinto/__init__.py b/kinto/__init__.py
  --- a/kinto/__init__.py
  +++ b/kinto/__init__.py
  @@ -67,7 +67,16 @@
       # Scan Kinto views.
       kwargs = {}
       flush_enabled = asbool(settings.get('flush_endpoint_enabled'))
  -    if not flush_enabled:
  +
  +    if flush_enabled:
  +        config.add_api_capability(
  +            "flush_endpoint",
  +            description="The __flush__ endpoint can be used to remove all "
  +                        "data from all backends.",
  +            url="http://kinto.readthedocs.org/en/latest/configuration/"
  +                "settings.html#activating-the-flush-endpoint"
  +        )
  +    else:
           kwargs['ignore'] = 'kinto.views.flush'
       config.scan("kinto.views", **kwargs)
  
verification_info: {"golden_diff": "diff --git a/kinto/__init__.py b/kinto/__init__.py\n--- a/kinto/__init__.py\n+++ b/kinto/__init__.py\n@@ -67,7 +67,16 @@\n     # Scan Kinto views.\n     kwargs = {}\n     flush_enabled = asbool(settings.get('flush_endpoint_enabled'))\n-    if not flush_enabled:\n+\n+    if flush_enabled:\n+        config.add_api_capability(\n+            \"flush_endpoint\",\n+            description=\"The __flush__ endpoint can be used to remove all \"\n+                        \"data from all backends.\",\n+            url=\"http://kinto.readthedocs.org/en/latest/configuration/\"\n+                \"settings.html#activating-the-flush-endpoint\"\n+        )\n+    else:\n         kwargs['ignore'] = 'kinto.views.flush'\n     config.scan(\"kinto.views\", **kwargs)\n", "issue": "flush_endpoint capability added if flush_enabled (fixes #496)\n\n", "before_files": [{"content": "import pkg_resources\nimport logging\n\nimport cliquet\nfrom pyramid.config import Configurator\nfrom pyramid.settings import asbool\nfrom pyramid.security import Authenticated\n\nfrom kinto.authorization import RouteFactory\n\n# Module version, as defined in PEP-0396.\n__version__ = pkg_resources.get_distribution(__package__).version\n\n# Implemented HTTP API Version\nHTTP_API_VERSION = '1.4'\n\n# Main kinto logger\nlogger = logging.getLogger(__name__)\n\n\nDEFAULT_SETTINGS = {\n    'retry_after_seconds': 3,\n    'cache_backend': 'cliquet.cache.memory',\n    'permission_backend': 'cliquet.permission.memory',\n    'storage_backend': 'cliquet.storage.memory',\n    'project_docs': 'https://kinto.readthedocs.org/',\n    'bucket_create_principals': Authenticated,\n    'multiauth.authorization_policy': (\n        'kinto.authorization.AuthorizationPolicy'),\n    'experimental_collection_schema_validation': 'False',\n    'http_api_version': HTTP_API_VERSION\n}\n\n\ndef main(global_config, config=None, **settings):\n    if not config:\n        config = Configurator(settings=settings, root_factory=RouteFactory)\n\n    # Force project name, since it determines settings prefix.\n    config.add_settings({'cliquet.project_name': 'kinto'})\n\n    cliquet.initialize(config,\n                       version=__version__,\n                       default_settings=DEFAULT_SETTINGS)\n\n    settings = config.get_settings()\n\n    # In Kinto API 1.x, a default bucket is available.\n    # Force its inclusion if not specified in settings.\n    if 'kinto.plugins.default_bucket' not in settings['includes']:\n        config.include('kinto.plugins.default_bucket')\n\n    # Retro-compatibility with first Kinto clients.\n    config.registry.public_settings.add('cliquet.batch_max_requests')\n\n    # Expose capability\n    schema_enabled = asbool(\n        settings['experimental_collection_schema_validation']\n    )\n    if schema_enabled:\n        config.add_api_capability(\n            \"schema\",\n            description=\"Validates collection records with JSON schemas.\",\n            url=\"http://kinto.readthedocs.org/en/latest/api/1.x/\"\n                \"collections.html#collection-json-schema\")\n\n    # Scan Kinto views.\n    kwargs = {}\n    flush_enabled = asbool(settings.get('flush_endpoint_enabled'))\n    if not flush_enabled:\n        kwargs['ignore'] = 'kinto.views.flush'\n    config.scan(\"kinto.views\", **kwargs)\n\n    app = config.make_wsgi_app()\n\n    # Install middleware (idempotent if disabled)\n    return cliquet.install_middlewares(app, settings)\n", "path": "kinto/__init__.py"}]}