prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Split payments shares <1%
  Trying to set a payment share <1% will result in 500 INTERNAL SERVER ERROR.
  This should work as it would be very useful as a fee for hosting lnbits but 1% is too much.
  ![grafik](https://user-images.githubusercontent.com/51097237/174864872-55ed946c-ce0a-4dc6-8c90-ec2e70c29f54.png)
  
  
  </issue>
  <code>
  [start of lnbits/extensions/splitpayments/migrations.py]
  1 async def m001_initial(db):
  2     """
  3     Initial split payment table.
  4     """
  5     await db.execute(
  6         """
  7         CREATE TABLE splitpayments.targets (
  8             wallet TEXT NOT NULL,
  9             source TEXT NOT NULL,
  10             percent INTEGER NOT NULL CHECK (percent >= 0 AND percent <= 100),
  11             alias TEXT,
  12 
  13             UNIQUE (source, wallet)
  14         );
  15         """
  16     )
  17
  [end of lnbits/extensions/splitpayments/migrations.py]
  [start of lnbits/extensions/splitpayments/models.py]
  1 from typing import List, Optional
  2 
  3 from fastapi.param_functions import Query
  4 from pydantic import BaseModel
  5 
  6 
  7 class Target(BaseModel):
  8     wallet: str
  9     source: str
  10     percent: int
  11     alias: Optional[str]
  12 
  13 
  14 class TargetPutList(BaseModel):
  15     wallet: str = Query(...)
  16     alias: str = Query("")
  17     percent: int = Query(..., ge=1)
  18 
  19 
  20 class TargetPut(BaseModel):
  21     __root__: List[TargetPutList]
  22
  [end of lnbits/extensions/splitpayments/models.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/lnbits/extensions/splitpayments/migrations.py b/lnbits/extensions/splitpayments/migrations.py
  --- a/lnbits/extensions/splitpayments/migrations.py
  +++ b/lnbits/extensions/splitpayments/migrations.py
  @@ -14,3 +14,41 @@
           );
           """
       )
  +
  +
  +async def m002_float_percent(db):
  +    """
  +    Add float percent and migrates the existing data.
  +    """
  +    await db.execute("ALTER TABLE splitpayments.targets RENAME TO splitpayments_old")
  +    await db.execute(
  +        """
  +        CREATE TABLE splitpayments.targets (
  +            wallet TEXT NOT NULL,
  +            source TEXT NOT NULL,
  +            percent REAL NOT NULL CHECK (percent >= 0 AND percent <= 100),
  +            alias TEXT,
  +
  +            UNIQUE (source, wallet)
  +        );
  +    """
  +    )
  +
  +    for row in [
  +        list(row)
  +        for row in await db.fetchall("SELECT * FROM splitpayments.splitpayments_old")
  +    ]:
  +        await db.execute(
  +            """
  +            INSERT INTO splitpayments.targets (
  +                wallet,
  +                source,
  +                percent,
  +                alias
  +            )
  +            VALUES (?, ?, ?, ?)
  +            """,
  +            (row[0], row[1], row[2], row[3]),
  +        )
  +
  +    await db.execute("DROP TABLE splitpayments.splitpayments_old")
  diff --git a/lnbits/extensions/splitpayments/models.py b/lnbits/extensions/splitpayments/models.py
  --- a/lnbits/extensions/splitpayments/models.py
  +++ b/lnbits/extensions/splitpayments/models.py
  @@ -7,14 +7,14 @@
   class Target(BaseModel):
       wallet: str
       source: str
  -    percent: int
  +    percent: float
       alias: Optional[str]
   
   
   class TargetPutList(BaseModel):
       wallet: str = Query(...)
       alias: str = Query("")
  -    percent: int = Query(..., ge=1)
  +    percent: float = Query(..., ge=0.01)
   
   
   class TargetPut(BaseModel):
  
verification_info: {"golden_diff": "diff --git a/lnbits/extensions/splitpayments/migrations.py b/lnbits/extensions/splitpayments/migrations.py\n--- a/lnbits/extensions/splitpayments/migrations.py\n+++ b/lnbits/extensions/splitpayments/migrations.py\n@@ -14,3 +14,41 @@\n         );\n         \"\"\"\n     )\n+\n+\n+async def m002_float_percent(db):\n+    \"\"\"\n+    Add float percent and migrates the existing data.\n+    \"\"\"\n+    await db.execute(\"ALTER TABLE splitpayments.targets RENAME TO splitpayments_old\")\n+    await db.execute(\n+        \"\"\"\n+        CREATE TABLE splitpayments.targets (\n+            wallet TEXT NOT NULL,\n+            source TEXT NOT NULL,\n+            percent REAL NOT NULL CHECK (percent >= 0 AND percent <= 100),\n+            alias TEXT,\n+\n+            UNIQUE (source, wallet)\n+        );\n+    \"\"\"\n+    )\n+\n+    for row in [\n+        list(row)\n+        for row in await db.fetchall(\"SELECT * FROM splitpayments.splitpayments_old\")\n+    ]:\n+        await db.execute(\n+            \"\"\"\n+            INSERT INTO splitpayments.targets (\n+                wallet,\n+                source,\n+                percent,\n+                alias\n+            )\n+            VALUES (?, ?, ?, ?)\n+            \"\"\",\n+            (row[0], row[1], row[2], row[3]),\n+        )\n+\n+    await db.execute(\"DROP TABLE splitpayments.splitpayments_old\")\ndiff --git a/lnbits/extensions/splitpayments/models.py b/lnbits/extensions/splitpayments/models.py\n--- a/lnbits/extensions/splitpayments/models.py\n+++ b/lnbits/extensions/splitpayments/models.py\n@@ -7,14 +7,14 @@\n class Target(BaseModel):\n     wallet: str\n     source: str\n-    percent: int\n+    percent: float\n     alias: Optional[str]\n \n \n class TargetPutList(BaseModel):\n     wallet: str = Query(...)\n     alias: str = Query(\"\")\n-    percent: int = Query(..., ge=1)\n+    percent: float = Query(..., ge=0.01)\n \n \n class TargetPut(BaseModel):\n", "issue": "Split payments shares <1%\nTrying to set a payment share <1% will result in 500 INTERNAL SERVER ERROR.\r\nThis should work as it would be very useful as a fee for hosting lnbits but 1% is too much.\r\n![grafik](https://user-images.githubusercontent.com/51097237/174864872-55ed946c-ce0a-4dc6-8c90-ec2e70c29f54.png)\r\n\n", "before_files": [{"content": "async def m001_initial(db):\n    \"\"\"\n    Initial split payment table.\n    \"\"\"\n    await db.execute(\n        \"\"\"\n        CREATE TABLE splitpayments.targets (\n            wallet TEXT NOT NULL,\n            source TEXT NOT NULL,\n            percent INTEGER NOT NULL CHECK (percent >= 0 AND percent <= 100),\n            alias TEXT,\n\n            UNIQUE (source, wallet)\n        );\n        \"\"\"\n    )\n", "path": "lnbits/extensions/splitpayments/migrations.py"}, {"content": "from typing import List, Optional\n\nfrom fastapi.param_functions import Query\nfrom pydantic import BaseModel\n\n\nclass Target(BaseModel):\n    wallet: str\n    source: str\n    percent: int\n    alias: Optional[str]\n\n\nclass TargetPutList(BaseModel):\n    wallet: str = Query(...)\n    alias: str = Query(\"\")\n    percent: int = Query(..., ge=1)\n\n\nclass TargetPut(BaseModel):\n    __root__: List[TargetPutList]\n", "path": "lnbits/extensions/splitpayments/models.py"}]}