prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  session_purpose_demo management command no longer needed
  ### Description
  
  When the session purpose project was in development, we added a management command `session_purpose_demo` to add a fake meeting that exercised the new features. Since the session purposes are now in active use, I think that management command can be pruned.
  
  ### Code of Conduct
  
  - [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)
  
  </issue>
  <code>
  [start of ietf/meeting/management/commands/session_purpose_demo.py]
  1 import datetime
  2 import random
  3 
  4 from django.core.management.base import BaseCommand, CommandError
  5 
  6 from ietf.group.models import Group
  7 from ietf.meeting.factories import RoomFactory, TimeSlotFactory, SessionFactory
  8 from ietf.meeting.helpers import get_meeting
  9 from ietf.meeting.models import Room, Session
  10 from ietf.name.models import SessionPurposeName
  11 
  12 
  13 class Command(BaseCommand):
  14     help = 'Set up a demo of the session purpose updates'
  15 
  16     DEMO_PREFIX='PDemo'  # used to identify things added by this command
  17 
  18     def add_arguments(self, parser):
  19         parser.add_argument('--remove', action='store_true')
  20 
  21     def handle(self, *args, **options):
  22         if options['remove']:
  23             self.remove_demo()
  24         else:
  25             self.install_demo()
  26 
  27     def remove_demo(self):
  28         self.stdout.write(f'Removing rooms with "{self.DEMO_PREFIX}" name prefix...\n')
  29         Room.objects.filter(name__startswith=self.DEMO_PREFIX).delete()
  30         self.stdout.write(f'Removing sessions with "{self.DEMO_PREFIX}" name prefix...\n')
  31         Session.objects.filter(name__startswith=self.DEMO_PREFIX).delete()
  32 
  33     def install_demo(self):
  34         # get meeting
  35         try:
  36             meeting = get_meeting(days=14)  # matches how secr app finds meetings
  37         except:
  38             raise CommandError('No upcoming meeting to modify')
  39 
  40         # create rooms
  41         self.stdout.write('Creating rooms...\n')
  42         rooms = [
  43             RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 1'),
  44             RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 2'),
  45             RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 3'),
  46         ]
  47 
  48         # get all the timeslot types used by a session purpose
  49         type_ids = set()
  50         for purpose in SessionPurposeName.objects.filter(used=True):
  51             type_ids.update(purpose.timeslot_types)
  52 
  53         # set up timeslots
  54         self.stdout.write('Creating timeslots...\n')
  55         for room in rooms:
  56             for day in range(meeting.days):
  57                 date = meeting.get_meeting_date(day)
  58                 for n, type_id in enumerate(type_ids):
  59                     TimeSlotFactory(
  60                         type_id=type_id,
  61                         meeting=meeting,
  62                         location=room,
  63                         time=datetime.datetime.combine(date, datetime.time(10, 0, 0)) + datetime.timedelta(hours=n),
  64                         duration=datetime.timedelta(hours=1),
  65                     )
  66 
  67         # set up sessions
  68         self.stdout.write('Creating sessions...')
  69         groups_for_session_purpose = {
  70             purpose.slug: list(
  71                 Group.objects.filter(
  72                     type__features__session_purposes__contains=f'"{purpose.slug}"',
  73                     state_id='active',
  74                 )
  75             )
  76             for purpose in SessionPurposeName.objects.filter(used=True)
  77         }
  78         for purpose in SessionPurposeName.objects.filter(used=True):
  79             for type_id in purpose.timeslot_types:
  80                 group=random.choice(groups_for_session_purpose[purpose.slug])
  81                 SessionFactory(
  82                     meeting=meeting,
  83                     purpose=purpose,
  84                     type_id=type_id,
  85                     group=group,
  86                     name=f'{self.DEMO_PREFIX} for {group.acronym}',
  87                     status_id='schedw',
  88                     add_to_schedule=False,
  89                 )
  90 
  91         self.stdout.write(f'\nRooms and sessions created with "{self.DEMO_PREFIX}" as name prefix\n')
  [end of ietf/meeting/management/commands/session_purpose_demo.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/ietf/meeting/management/commands/session_purpose_demo.py b/ietf/meeting/management/commands/session_purpose_demo.py
  deleted file mode 100644
  --- a/ietf/meeting/management/commands/session_purpose_demo.py
  +++ /dev/null
  @@ -1,91 +0,0 @@
  -import datetime
  -import random
  -
  -from django.core.management.base import BaseCommand, CommandError
  -
  -from ietf.group.models import Group
  -from ietf.meeting.factories import RoomFactory, TimeSlotFactory, SessionFactory
  -from ietf.meeting.helpers import get_meeting
  -from ietf.meeting.models import Room, Session
  -from ietf.name.models import SessionPurposeName
  -
  -
  -class Command(BaseCommand):
  -    help = 'Set up a demo of the session purpose updates'
  -
  -    DEMO_PREFIX='PDemo'  # used to identify things added by this command
  -
  -    def add_arguments(self, parser):
  -        parser.add_argument('--remove', action='store_true')
  -
  -    def handle(self, *args, **options):
  -        if options['remove']:
  -            self.remove_demo()
  -        else:
  -            self.install_demo()
  -
  -    def remove_demo(self):
  -        self.stdout.write(f'Removing rooms with "{self.DEMO_PREFIX}" name prefix...\n')
  -        Room.objects.filter(name__startswith=self.DEMO_PREFIX).delete()
  -        self.stdout.write(f'Removing sessions with "{self.DEMO_PREFIX}" name prefix...\n')
  -        Session.objects.filter(name__startswith=self.DEMO_PREFIX).delete()
  -
  -    def install_demo(self):
  -        # get meeting
  -        try:
  -            meeting = get_meeting(days=14)  # matches how secr app finds meetings
  -        except:
  -            raise CommandError('No upcoming meeting to modify')
  -
  -        # create rooms
  -        self.stdout.write('Creating rooms...\n')
  -        rooms = [
  -            RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 1'),
  -            RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 2'),
  -            RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 3'),
  -        ]
  -
  -        # get all the timeslot types used by a session purpose
  -        type_ids = set()
  -        for purpose in SessionPurposeName.objects.filter(used=True):
  -            type_ids.update(purpose.timeslot_types)
  -
  -        # set up timeslots
  -        self.stdout.write('Creating timeslots...\n')
  -        for room in rooms:
  -            for day in range(meeting.days):
  -                date = meeting.get_meeting_date(day)
  -                for n, type_id in enumerate(type_ids):
  -                    TimeSlotFactory(
  -                        type_id=type_id,
  -                        meeting=meeting,
  -                        location=room,
  -                        time=datetime.datetime.combine(date, datetime.time(10, 0, 0)) + datetime.timedelta(hours=n),
  -                        duration=datetime.timedelta(hours=1),
  -                    )
  -
  -        # set up sessions
  -        self.stdout.write('Creating sessions...')
  -        groups_for_session_purpose = {
  -            purpose.slug: list(
  -                Group.objects.filter(
  -                    type__features__session_purposes__contains=f'"{purpose.slug}"',
  -                    state_id='active',
  -                )
  -            )
  -            for purpose in SessionPurposeName.objects.filter(used=True)
  -        }
  -        for purpose in SessionPurposeName.objects.filter(used=True):
  -            for type_id in purpose.timeslot_types:
  -                group=random.choice(groups_for_session_purpose[purpose.slug])
  -                SessionFactory(
  -                    meeting=meeting,
  -                    purpose=purpose,
  -                    type_id=type_id,
  -                    group=group,
  -                    name=f'{self.DEMO_PREFIX} for {group.acronym}',
  -                    status_id='schedw',
  -                    add_to_schedule=False,
  -                )
  -
  -        self.stdout.write(f'\nRooms and sessions created with "{self.DEMO_PREFIX}" as name prefix\n')
  \ No newline at end of file
  
verification_info: {"golden_diff": "diff --git a/ietf/meeting/management/commands/session_purpose_demo.py b/ietf/meeting/management/commands/session_purpose_demo.py\ndeleted file mode 100644\n--- a/ietf/meeting/management/commands/session_purpose_demo.py\n+++ /dev/null\n@@ -1,91 +0,0 @@\n-import datetime\n-import random\n-\n-from django.core.management.base import BaseCommand, CommandError\n-\n-from ietf.group.models import Group\n-from ietf.meeting.factories import RoomFactory, TimeSlotFactory, SessionFactory\n-from ietf.meeting.helpers import get_meeting\n-from ietf.meeting.models import Room, Session\n-from ietf.name.models import SessionPurposeName\n-\n-\n-class Command(BaseCommand):\n-    help = 'Set up a demo of the session purpose updates'\n-\n-    DEMO_PREFIX='PDemo'  # used to identify things added by this command\n-\n-    def add_arguments(self, parser):\n-        parser.add_argument('--remove', action='store_true')\n-\n-    def handle(self, *args, **options):\n-        if options['remove']:\n-            self.remove_demo()\n-        else:\n-            self.install_demo()\n-\n-    def remove_demo(self):\n-        self.stdout.write(f'Removing rooms with \"{self.DEMO_PREFIX}\" name prefix...\\n')\n-        Room.objects.filter(name__startswith=self.DEMO_PREFIX).delete()\n-        self.stdout.write(f'Removing sessions with \"{self.DEMO_PREFIX}\" name prefix...\\n')\n-        Session.objects.filter(name__startswith=self.DEMO_PREFIX).delete()\n-\n-    def install_demo(self):\n-        # get meeting\n-        try:\n-            meeting = get_meeting(days=14)  # matches how secr app finds meetings\n-        except:\n-            raise CommandError('No upcoming meeting to modify')\n-\n-        # create rooms\n-        self.stdout.write('Creating rooms...\\n')\n-        rooms = [\n-            RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 1'),\n-            RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 2'),\n-            RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 3'),\n-        ]\n-\n-        # get all the timeslot types used by a session purpose\n-        type_ids = set()\n-        for purpose in SessionPurposeName.objects.filter(used=True):\n-            type_ids.update(purpose.timeslot_types)\n-\n-        # set up timeslots\n-        self.stdout.write('Creating timeslots...\\n')\n-        for room in rooms:\n-            for day in range(meeting.days):\n-                date = meeting.get_meeting_date(day)\n-                for n, type_id in enumerate(type_ids):\n-                    TimeSlotFactory(\n-                        type_id=type_id,\n-                        meeting=meeting,\n-                        location=room,\n-                        time=datetime.datetime.combine(date, datetime.time(10, 0, 0)) + datetime.timedelta(hours=n),\n-                        duration=datetime.timedelta(hours=1),\n-                    )\n-\n-        # set up sessions\n-        self.stdout.write('Creating sessions...')\n-        groups_for_session_purpose = {\n-            purpose.slug: list(\n-                Group.objects.filter(\n-                    type__features__session_purposes__contains=f'\"{purpose.slug}\"',\n-                    state_id='active',\n-                )\n-            )\n-            for purpose in SessionPurposeName.objects.filter(used=True)\n-        }\n-        for purpose in SessionPurposeName.objects.filter(used=True):\n-            for type_id in purpose.timeslot_types:\n-                group=random.choice(groups_for_session_purpose[purpose.slug])\n-                SessionFactory(\n-                    meeting=meeting,\n-                    purpose=purpose,\n-                    type_id=type_id,\n-                    group=group,\n-                    name=f'{self.DEMO_PREFIX} for {group.acronym}',\n-                    status_id='schedw',\n-                    add_to_schedule=False,\n-                )\n-\n-        self.stdout.write(f'\\nRooms and sessions created with \"{self.DEMO_PREFIX}\" as name prefix\\n')\n\\ No newline at end of file\n", "issue": "session_purpose_demo management command no longer needed\n### Description\n\nWhen the session purpose project was in development, we added a management command `session_purpose_demo` to add a fake meeting that exercised the new features. Since the session purposes are now in active use, I think that management command can be pruned.\n\n### Code of Conduct\n\n- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)\n", "before_files": [{"content": "import datetime\nimport random\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom ietf.group.models import Group\nfrom ietf.meeting.factories import RoomFactory, TimeSlotFactory, SessionFactory\nfrom ietf.meeting.helpers import get_meeting\nfrom ietf.meeting.models import Room, Session\nfrom ietf.name.models import SessionPurposeName\n\n\nclass Command(BaseCommand):\n    help = 'Set up a demo of the session purpose updates'\n\n    DEMO_PREFIX='PDemo'  # used to identify things added by this command\n\n    def add_arguments(self, parser):\n        parser.add_argument('--remove', action='store_true')\n\n    def handle(self, *args, **options):\n        if options['remove']:\n            self.remove_demo()\n        else:\n            self.install_demo()\n\n    def remove_demo(self):\n        self.stdout.write(f'Removing rooms with \"{self.DEMO_PREFIX}\" name prefix...\\n')\n        Room.objects.filter(name__startswith=self.DEMO_PREFIX).delete()\n        self.stdout.write(f'Removing sessions with \"{self.DEMO_PREFIX}\" name prefix...\\n')\n        Session.objects.filter(name__startswith=self.DEMO_PREFIX).delete()\n\n    def install_demo(self):\n        # get meeting\n        try:\n            meeting = get_meeting(days=14)  # matches how secr app finds meetings\n        except:\n            raise CommandError('No upcoming meeting to modify')\n\n        # create rooms\n        self.stdout.write('Creating rooms...\\n')\n        rooms = [\n            RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 1'),\n            RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 2'),\n            RoomFactory(meeting=meeting, name=f'{self.DEMO_PREFIX} 3'),\n        ]\n\n        # get all the timeslot types used by a session purpose\n        type_ids = set()\n        for purpose in SessionPurposeName.objects.filter(used=True):\n            type_ids.update(purpose.timeslot_types)\n\n        # set up timeslots\n        self.stdout.write('Creating timeslots...\\n')\n        for room in rooms:\n            for day in range(meeting.days):\n                date = meeting.get_meeting_date(day)\n                for n, type_id in enumerate(type_ids):\n                    TimeSlotFactory(\n                        type_id=type_id,\n                        meeting=meeting,\n                        location=room,\n                        time=datetime.datetime.combine(date, datetime.time(10, 0, 0)) + datetime.timedelta(hours=n),\n                        duration=datetime.timedelta(hours=1),\n                    )\n\n        # set up sessions\n        self.stdout.write('Creating sessions...')\n        groups_for_session_purpose = {\n            purpose.slug: list(\n                Group.objects.filter(\n                    type__features__session_purposes__contains=f'\"{purpose.slug}\"',\n                    state_id='active',\n                )\n            )\n            for purpose in SessionPurposeName.objects.filter(used=True)\n        }\n        for purpose in SessionPurposeName.objects.filter(used=True):\n            for type_id in purpose.timeslot_types:\n                group=random.choice(groups_for_session_purpose[purpose.slug])\n                SessionFactory(\n                    meeting=meeting,\n                    purpose=purpose,\n                    type_id=type_id,\n                    group=group,\n                    name=f'{self.DEMO_PREFIX} for {group.acronym}',\n                    status_id='schedw',\n                    add_to_schedule=False,\n                )\n\n        self.stdout.write(f'\\nRooms and sessions created with \"{self.DEMO_PREFIX}\" as name prefix\\n')", "path": "ietf/meeting/management/commands/session_purpose_demo.py"}]}