prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  The clear database command should be runnable with debug disabled
  We should be able to run `cleardb` when `DEBUG=False` but we should have a `--force` flag to actually allow that action when the debug mode is turned off as it is a dangerous command.
  
  Definition of done:
  - Prints an error to stderr when `DEBUG=False` and `--force` is not passed (flagged)
  - Exits with 1 (raises `SystemExit` which allows Django to handle it and cleanup the opened connections, such as the database)
  - User can clear the database when debug mode is turned off and only when `--force` was passed
  
  </issue>
  <code>
  [start of saleor/core/management/commands/cleardb.py]
  1 """Clear the database preserving shop's configuration.
  2 
  3 This command clears the database from data such as orders, products or customer
  4 accounts. It doesn't remove shop's configuration, such as: staff accounts, service
  5 accounts, plugin configurations, site settings or navigation menus.
  6 """
  7 
  8 from django.conf import settings
  9 from django.core.management.base import BaseCommand, CommandError
  10 from django.db.models import Q
  11 
  12 from ....account.models import User
  13 from ....checkout.models import Checkout
  14 from ....discount.models import Sale, Voucher
  15 from ....giftcard.models import GiftCard
  16 from ....order.models import Order
  17 from ....page.models import Page
  18 from ....payment.models import Payment, Transaction
  19 from ....product.models import Attribute, Category, Collection, Product, ProductType
  20 from ....shipping.models import ShippingMethod, ShippingZone
  21 from ....warehouse.models import Warehouse
  22 from ....webhook.models import Webhook
  23 
  24 
  25 class Command(BaseCommand):
  26     help = "Removes data from the database preserving shop configuration."
  27 
  28     def add_arguments(self, parser):
  29         parser.add_argument(
  30             "--delete-staff",
  31             action="store_true",
  32             help="Delete staff user accounts (doesn't delete superuser accounts).",
  33         )
  34 
  35     def handle(self, **options):
  36         if not settings.DEBUG:
  37             raise CommandError("Cannot clear the database in DEBUG=True mode.")
  38 
  39         Checkout.objects.all().delete()
  40         self.stdout.write("Removed checkouts")
  41 
  42         Transaction.objects.all().delete()
  43         self.stdout.write("Removed transactions")
  44 
  45         Payment.objects.all().delete()
  46         self.stdout.write("Removed payments")
  47 
  48         Order.objects.all().delete()
  49         self.stdout.write("Removed orders")
  50 
  51         Product.objects.all().delete()
  52         self.stdout.write("Removed products")
  53 
  54         ProductType.objects.all().delete()
  55         self.stdout.write("Removed product types")
  56 
  57         Attribute.objects.all().delete()
  58         self.stdout.write("Removed attributes")
  59 
  60         Category.objects.all().delete()
  61         self.stdout.write("Removed categories")
  62 
  63         Collection.objects.all().delete()
  64         self.stdout.write("Removed collections")
  65 
  66         Sale.objects.all().delete()
  67         self.stdout.write("Removed sales")
  68 
  69         ShippingMethod.objects.all().delete()
  70         self.stdout.write("Removed shipping methods")
  71 
  72         ShippingZone.objects.all().delete()
  73         self.stdout.write("Removed shipping zones")
  74 
  75         Voucher.objects.all().delete()
  76         self.stdout.write("Removed vouchers")
  77 
  78         GiftCard.objects.all().delete()
  79         self.stdout.write("Removed gift cards")
  80 
  81         self.stdout.write("Removed warehouses")
  82         Warehouse.objects.all().delete()
  83 
  84         Page.objects.all().delete()
  85         self.stdout.write("Removed pages")
  86 
  87         Webhook.objects.all().delete()
  88         self.stdout.write("Removed webhooks")
  89 
  90         # Delete all users except for staff members.
  91         staff = User.objects.filter(Q(is_staff=True) | Q(is_superuser=True))
  92         User.objects.exclude(pk__in=staff).delete()
  93         self.stdout.write("Removed customers")
  94 
  95         should_delete_staff = options.get("delete_staff")
  96         if should_delete_staff:
  97             staff = staff.exclude(is_superuser=True)
  98             staff.delete()
  99             self.stdout.write("Removed staff users")
  100 
  101         # Remove addresses of staff members. Used to clear saved addresses of staff
  102         # accounts used on demo for testing checkout.
  103         for user in staff:
  104             user.addresses.all().delete()
  105         self.stdout.write("Removed staff addresses")
  106
  [end of saleor/core/management/commands/cleardb.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/saleor/core/management/commands/cleardb.py b/saleor/core/management/commands/cleardb.py
  --- a/saleor/core/management/commands/cleardb.py
  +++ b/saleor/core/management/commands/cleardb.py
  @@ -31,10 +31,16 @@
               action="store_true",
               help="Delete staff user accounts (doesn't delete superuser accounts).",
           )
  +        parser.add_argument(
  +            "--force",
  +            action="store_true",
  +            help="Allows running the cleardb command in DEBUG=False mode.",
  +        )
   
       def handle(self, **options):
  -        if not settings.DEBUG:
  -            raise CommandError("Cannot clear the database in DEBUG=True mode.")
  +        force = options.get("force", False)
  +        if not settings.DEBUG and not force:
  +            raise CommandError("Cannot clear the database in DEBUG=False mode.")
   
           Checkout.objects.all().delete()
           self.stdout.write("Removed checkouts")
  
verification_info: {"golden_diff": "diff --git a/saleor/core/management/commands/cleardb.py b/saleor/core/management/commands/cleardb.py\n--- a/saleor/core/management/commands/cleardb.py\n+++ b/saleor/core/management/commands/cleardb.py\n@@ -31,10 +31,16 @@\n             action=\"store_true\",\n             help=\"Delete staff user accounts (doesn't delete superuser accounts).\",\n         )\n+        parser.add_argument(\n+            \"--force\",\n+            action=\"store_true\",\n+            help=\"Allows running the cleardb command in DEBUG=False mode.\",\n+        )\n \n     def handle(self, **options):\n-        if not settings.DEBUG:\n-            raise CommandError(\"Cannot clear the database in DEBUG=True mode.\")\n+        force = options.get(\"force\", False)\n+        if not settings.DEBUG and not force:\n+            raise CommandError(\"Cannot clear the database in DEBUG=False mode.\")\n \n         Checkout.objects.all().delete()\n         self.stdout.write(\"Removed checkouts\")\n", "issue": "The clear database command should be runnable with debug disabled\nWe should be able to run `cleardb` when `DEBUG=False` but we should have a `--force` flag to actually allow that action when the debug mode is turned off as it is a dangerous command.\r\n\r\nDefinition of done:\r\n- Prints an error to stderr when `DEBUG=False` and `--force` is not passed (flagged)\r\n- Exits with 1 (raises `SystemExit` which allows Django to handle it and cleanup the opened connections, such as the database)\r\n- User can clear the database when debug mode is turned off and only when `--force` was passed\n", "before_files": [{"content": "\"\"\"Clear the database preserving shop's configuration.\n\nThis command clears the database from data such as orders, products or customer\naccounts. It doesn't remove shop's configuration, such as: staff accounts, service\naccounts, plugin configurations, site settings or navigation menus.\n\"\"\"\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.db.models import Q\n\nfrom ....account.models import User\nfrom ....checkout.models import Checkout\nfrom ....discount.models import Sale, Voucher\nfrom ....giftcard.models import GiftCard\nfrom ....order.models import Order\nfrom ....page.models import Page\nfrom ....payment.models import Payment, Transaction\nfrom ....product.models import Attribute, Category, Collection, Product, ProductType\nfrom ....shipping.models import ShippingMethod, ShippingZone\nfrom ....warehouse.models import Warehouse\nfrom ....webhook.models import Webhook\n\n\nclass Command(BaseCommand):\n    help = \"Removes data from the database preserving shop configuration.\"\n\n    def add_arguments(self, parser):\n        parser.add_argument(\n            \"--delete-staff\",\n            action=\"store_true\",\n            help=\"Delete staff user accounts (doesn't delete superuser accounts).\",\n        )\n\n    def handle(self, **options):\n        if not settings.DEBUG:\n            raise CommandError(\"Cannot clear the database in DEBUG=True mode.\")\n\n        Checkout.objects.all().delete()\n        self.stdout.write(\"Removed checkouts\")\n\n        Transaction.objects.all().delete()\n        self.stdout.write(\"Removed transactions\")\n\n        Payment.objects.all().delete()\n        self.stdout.write(\"Removed payments\")\n\n        Order.objects.all().delete()\n        self.stdout.write(\"Removed orders\")\n\n        Product.objects.all().delete()\n        self.stdout.write(\"Removed products\")\n\n        ProductType.objects.all().delete()\n        self.stdout.write(\"Removed product types\")\n\n        Attribute.objects.all().delete()\n        self.stdout.write(\"Removed attributes\")\n\n        Category.objects.all().delete()\n        self.stdout.write(\"Removed categories\")\n\n        Collection.objects.all().delete()\n        self.stdout.write(\"Removed collections\")\n\n        Sale.objects.all().delete()\n        self.stdout.write(\"Removed sales\")\n\n        ShippingMethod.objects.all().delete()\n        self.stdout.write(\"Removed shipping methods\")\n\n        ShippingZone.objects.all().delete()\n        self.stdout.write(\"Removed shipping zones\")\n\n        Voucher.objects.all().delete()\n        self.stdout.write(\"Removed vouchers\")\n\n        GiftCard.objects.all().delete()\n        self.stdout.write(\"Removed gift cards\")\n\n        self.stdout.write(\"Removed warehouses\")\n        Warehouse.objects.all().delete()\n\n        Page.objects.all().delete()\n        self.stdout.write(\"Removed pages\")\n\n        Webhook.objects.all().delete()\n        self.stdout.write(\"Removed webhooks\")\n\n        # Delete all users except for staff members.\n        staff = User.objects.filter(Q(is_staff=True) | Q(is_superuser=True))\n        User.objects.exclude(pk__in=staff).delete()\n        self.stdout.write(\"Removed customers\")\n\n        should_delete_staff = options.get(\"delete_staff\")\n        if should_delete_staff:\n            staff = staff.exclude(is_superuser=True)\n            staff.delete()\n            self.stdout.write(\"Removed staff users\")\n\n        # Remove addresses of staff members. Used to clear saved addresses of staff\n        # accounts used on demo for testing checkout.\n        for user in staff:\n            user.addresses.all().delete()\n        self.stdout.write(\"Removed staff addresses\")\n", "path": "saleor/core/management/commands/cleardb.py"}]}