prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Move Payment Gateways to own subtab
  On `admin/settings/` add a subtab "Payment Gateways" and move the Paypal and Stripe here.
  
  ![screenshot from 2016-08-12 01 48 01](https://cloud.githubusercontent.com/assets/1583873/17608754/ed81ed04-602e-11e6-9e1a-444a1369aba2.png)
  
  ![screenshot from 2016-08-12 01 47 33](https://cloud.githubusercontent.com/assets/1583873/17608757/f19fce4c-602e-11e6-9bd0-e42e1d9b36b8.png)
  
  
  </issue>
  <code>
  [start of app/settings/__init__.py]
  1 import stripe
  2 from flask import current_app
  3 from sqlalchemy import desc
  4 from app.models.setting import Setting
  5 from app.models.fees import TicketFees
  6 
  7 
  8 def get_settings():
  9     """
  10     Use this to get latest system settings
  11     """
  12     if 'custom_settings' in current_app.config:
  13         return current_app.config['custom_settings']
  14     s = Setting.query.order_by(desc(Setting.id)).first()
  15     if s is None:
  16         set_settings(secret='super secret key')
  17     else:
  18         current_app.config['custom_settings'] = make_dict(s)
  19     return current_app.config['custom_settings']
  20 
  21 
  22 def set_settings(**kwargs):
  23     """
  24     Update system settings
  25     """
  26 
  27     if 'service_fee' in kwargs:
  28         ticket_service_fees = kwargs.get('service_fee')
  29         ticket_maximum_fees = kwargs.get('maximum_fee')
  30         from app.helpers.data_getter import DataGetter
  31         from app.helpers.data import save_to_db
  32         currencies = DataGetter.get_payment_currencies()
  33         for i, currency in enumerate(currencies):
  34             currency = currency.split(' ')[0]
  35             ticket_fee = TicketFees(currency=currency,
  36                                     service_fee=ticket_service_fees[i],
  37                                     maximum_fee=ticket_maximum_fees[i])
  38             save_to_db(ticket_fee, "Ticket Fees settings saved")
  39     else:
  40         setting = Setting(**kwargs)
  41         from app.helpers.data import save_to_db
  42         save_to_db(setting, 'Setting saved')
  43         current_app.secret_key = setting.secret
  44         stripe.api_key = setting.stripe_secret_key
  45         current_app.config['custom_settings'] = make_dict(setting)
  46 
  47 
  48 def make_dict(s):
  49     arguments = {}
  50     for name, column in s.__mapper__.columns.items():
  51         if not (column.primary_key or column.unique):
  52             arguments[name] = getattr(s, name)
  53     return arguments
  54
  [end of app/settings/__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/app/settings/__init__.py b/app/settings/__init__.py
  --- a/app/settings/__init__.py
  +++ b/app/settings/__init__.py
  @@ -30,7 +30,7 @@
           from app.helpers.data_getter import DataGetter
           from app.helpers.data import save_to_db
           currencies = DataGetter.get_payment_currencies()
  -        for i, currency in enumerate(currencies):
  +        for i, (currency, has_paypal, has_stripe) in enumerate(currencies):
               currency = currency.split(' ')[0]
               ticket_fee = TicketFees(currency=currency,
                                       service_fee=ticket_service_fees[i],
  
verification_info: {"golden_diff": "diff --git a/app/settings/__init__.py b/app/settings/__init__.py\n--- a/app/settings/__init__.py\n+++ b/app/settings/__init__.py\n@@ -30,7 +30,7 @@\n         from app.helpers.data_getter import DataGetter\n         from app.helpers.data import save_to_db\n         currencies = DataGetter.get_payment_currencies()\n-        for i, currency in enumerate(currencies):\n+        for i, (currency, has_paypal, has_stripe) in enumerate(currencies):\n             currency = currency.split(' ')[0]\n             ticket_fee = TicketFees(currency=currency,\n                                     service_fee=ticket_service_fees[i],\n", "issue": "Move Payment Gateways to own subtab\nOn `admin/settings/` add a subtab \"Payment Gateways\" and move the Paypal and Stripe here.\n\n![screenshot from 2016-08-12 01 48 01](https://cloud.githubusercontent.com/assets/1583873/17608754/ed81ed04-602e-11e6-9e1a-444a1369aba2.png)\n\n![screenshot from 2016-08-12 01 47 33](https://cloud.githubusercontent.com/assets/1583873/17608757/f19fce4c-602e-11e6-9bd0-e42e1d9b36b8.png)\n\n", "before_files": [{"content": "import stripe\nfrom flask import current_app\nfrom sqlalchemy import desc\nfrom app.models.setting import Setting\nfrom app.models.fees import TicketFees\n\n\ndef get_settings():\n    \"\"\"\n    Use this to get latest system settings\n    \"\"\"\n    if 'custom_settings' in current_app.config:\n        return current_app.config['custom_settings']\n    s = Setting.query.order_by(desc(Setting.id)).first()\n    if s is None:\n        set_settings(secret='super secret key')\n    else:\n        current_app.config['custom_settings'] = make_dict(s)\n    return current_app.config['custom_settings']\n\n\ndef set_settings(**kwargs):\n    \"\"\"\n    Update system settings\n    \"\"\"\n\n    if 'service_fee' in kwargs:\n        ticket_service_fees = kwargs.get('service_fee')\n        ticket_maximum_fees = kwargs.get('maximum_fee')\n        from app.helpers.data_getter import DataGetter\n        from app.helpers.data import save_to_db\n        currencies = DataGetter.get_payment_currencies()\n        for i, currency in enumerate(currencies):\n            currency = currency.split(' ')[0]\n            ticket_fee = TicketFees(currency=currency,\n                                    service_fee=ticket_service_fees[i],\n                                    maximum_fee=ticket_maximum_fees[i])\n            save_to_db(ticket_fee, \"Ticket Fees settings saved\")\n    else:\n        setting = Setting(**kwargs)\n        from app.helpers.data import save_to_db\n        save_to_db(setting, 'Setting saved')\n        current_app.secret_key = setting.secret\n        stripe.api_key = setting.stripe_secret_key\n        current_app.config['custom_settings'] = make_dict(setting)\n\n\ndef make_dict(s):\n    arguments = {}\n    for name, column in s.__mapper__.columns.items():\n        if not (column.primary_key or column.unique):\n            arguments[name] = getattr(s, name)\n    return arguments\n", "path": "app/settings/__init__.py"}]}