prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  CalendarEventDevice is deprecated
  Hi there,
  
  Latest HA beta `core-2022.5.0` shows this within the logs:
  ```
  CalendarEventDevice is deprecated, modify WasteCollectionCalendar to extend CalendarEntity
  ```
  
  Just wanted to let you know 🙂
  
  More information can be found here:
  https://github.com/home-assistant/core/pull/68843
  
  And here:
  https://developers.home-assistant.io/docs/core/entity/calendar/
  
  </issue>
  <code>
  [start of custom_components/waste_collection_schedule/calendar.py]
  1 """Calendar platform support for Waste Collection Schedule."""
  2 
  3 import logging
  4 from datetime import timedelta
  5 
  6 from homeassistant.components.calendar import CalendarEventDevice
  7 
  8 _LOGGER = logging.getLogger(__name__)
  9 
  10 
  11 async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
  12     """Set up calendar platform."""
  13     # We only want this platform to be set up via discovery.
  14     if discovery_info is None:
  15         return
  16 
  17     entities = []
  18 
  19     api = discovery_info["api"]
  20 
  21     for scraper in api.scrapers:
  22         entities.append(WasteCollectionCalendar(api, scraper))
  23 
  24     async_add_entities(entities)
  25 
  26 
  27 class WasteCollectionCalendar(CalendarEventDevice):
  28     """Calendar entity class."""
  29 
  30     def __init__(self, api, scraper):
  31         self._api = api
  32         self._scraper = scraper
  33         self._attr_unique_id = scraper.unique_id + "_calendar"
  34 
  35     @property
  36     def name(self):
  37         """Return entity name."""
  38         return self._scraper.calendar_title
  39 
  40     @property
  41     def event(self):
  42         """Return next collection event."""
  43         collections = self._scraper.get_upcoming(count=1, include_today=True)
  44         if len(collections) == 0:
  45             return None
  46         else:
  47             return self._convert(collections[0])
  48 
  49     async def async_get_events(self, hass, start_date, end_date):
  50         """Return all events within specified time span."""
  51         collections = []
  52         for a in self._scraper.get_upcoming(include_today=True):
  53             if a.date >= start_date.date() and a.date <= end_date.date():
  54                 collections.append(self._convert(a))
  55         return collections
  56 
  57     def _convert(self, collection):
  58         """Convert an collection into a Home Assistant calendar event."""
  59         return {
  60             "uid": f"{self._scraper.calendar_title}-{collection.date.isoformat()}-{collection.type}",
  61             "summary": collection.type,
  62             "start": {"date": collection.date.isoformat()},
  63             "end": {"date": (collection.date + timedelta(days=1)).isoformat()},
  64             "allDay": True,
  65         }
  66
  [end of custom_components/waste_collection_schedule/calendar.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/custom_components/waste_collection_schedule/calendar.py b/custom_components/waste_collection_schedule/calendar.py
  --- a/custom_components/waste_collection_schedule/calendar.py
  +++ b/custom_components/waste_collection_schedule/calendar.py
  @@ -3,7 +3,7 @@
   import logging
   from datetime import timedelta
   
  -from homeassistant.components.calendar import CalendarEventDevice
  +from homeassistant.components.calendar import CalendarEntity, CalendarEvent
   
   _LOGGER = logging.getLogger(__name__)
   
  @@ -24,7 +24,7 @@
       async_add_entities(entities)
   
   
  -class WasteCollectionCalendar(CalendarEventDevice):
  +class WasteCollectionCalendar(CalendarEntity):
       """Calendar entity class."""
   
       def __init__(self, api, scraper):
  @@ -56,10 +56,8 @@
   
       def _convert(self, collection):
           """Convert an collection into a Home Assistant calendar event."""
  -        return {
  -            "uid": f"{self._scraper.calendar_title}-{collection.date.isoformat()}-{collection.type}",
  -            "summary": collection.type,
  -            "start": {"date": collection.date.isoformat()},
  -            "end": {"date": (collection.date + timedelta(days=1)).isoformat()},
  -            "allDay": True,
  -        }
  +        return CalendarEvent(
  +            summary=collection.type,
  +            start=collection.date,
  +            end=collection.date + timedelta(days=1),
  +        )
  
verification_info: {"golden_diff": "diff --git a/custom_components/waste_collection_schedule/calendar.py b/custom_components/waste_collection_schedule/calendar.py\n--- a/custom_components/waste_collection_schedule/calendar.py\n+++ b/custom_components/waste_collection_schedule/calendar.py\n@@ -3,7 +3,7 @@\n import logging\n from datetime import timedelta\n \n-from homeassistant.components.calendar import CalendarEventDevice\n+from homeassistant.components.calendar import CalendarEntity, CalendarEvent\n \n _LOGGER = logging.getLogger(__name__)\n \n@@ -24,7 +24,7 @@\n     async_add_entities(entities)\n \n \n-class WasteCollectionCalendar(CalendarEventDevice):\n+class WasteCollectionCalendar(CalendarEntity):\n     \"\"\"Calendar entity class.\"\"\"\n \n     def __init__(self, api, scraper):\n@@ -56,10 +56,8 @@\n \n     def _convert(self, collection):\n         \"\"\"Convert an collection into a Home Assistant calendar event.\"\"\"\n-        return {\n-            \"uid\": f\"{self._scraper.calendar_title}-{collection.date.isoformat()}-{collection.type}\",\n-            \"summary\": collection.type,\n-            \"start\": {\"date\": collection.date.isoformat()},\n-            \"end\": {\"date\": (collection.date + timedelta(days=1)).isoformat()},\n-            \"allDay\": True,\n-        }\n+        return CalendarEvent(\n+            summary=collection.type,\n+            start=collection.date,\n+            end=collection.date + timedelta(days=1),\n+        )\n", "issue": "CalendarEventDevice is deprecated\nHi there,\r\n\r\nLatest HA beta `core-2022.5.0` shows this within the logs:\r\n```\r\nCalendarEventDevice is deprecated, modify WasteCollectionCalendar to extend CalendarEntity\r\n```\r\n\r\nJust wanted to let you know \ud83d\ude42\r\n\r\nMore information can be found here:\r\nhttps://github.com/home-assistant/core/pull/68843\r\n\r\nAnd here:\r\nhttps://developers.home-assistant.io/docs/core/entity/calendar/\n", "before_files": [{"content": "\"\"\"Calendar platform support for Waste Collection Schedule.\"\"\"\n\nimport logging\nfrom datetime import timedelta\n\nfrom homeassistant.components.calendar import CalendarEventDevice\n\n_LOGGER = logging.getLogger(__name__)\n\n\nasync def async_setup_platform(hass, config, async_add_entities, discovery_info=None):\n    \"\"\"Set up calendar platform.\"\"\"\n    # We only want this platform to be set up via discovery.\n    if discovery_info is None:\n        return\n\n    entities = []\n\n    api = discovery_info[\"api\"]\n\n    for scraper in api.scrapers:\n        entities.append(WasteCollectionCalendar(api, scraper))\n\n    async_add_entities(entities)\n\n\nclass WasteCollectionCalendar(CalendarEventDevice):\n    \"\"\"Calendar entity class.\"\"\"\n\n    def __init__(self, api, scraper):\n        self._api = api\n        self._scraper = scraper\n        self._attr_unique_id = scraper.unique_id + \"_calendar\"\n\n    @property\n    def name(self):\n        \"\"\"Return entity name.\"\"\"\n        return self._scraper.calendar_title\n\n    @property\n    def event(self):\n        \"\"\"Return next collection event.\"\"\"\n        collections = self._scraper.get_upcoming(count=1, include_today=True)\n        if len(collections) == 0:\n            return None\n        else:\n            return self._convert(collections[0])\n\n    async def async_get_events(self, hass, start_date, end_date):\n        \"\"\"Return all events within specified time span.\"\"\"\n        collections = []\n        for a in self._scraper.get_upcoming(include_today=True):\n            if a.date >= start_date.date() and a.date <= end_date.date():\n                collections.append(self._convert(a))\n        return collections\n\n    def _convert(self, collection):\n        \"\"\"Convert an collection into a Home Assistant calendar event.\"\"\"\n        return {\n            \"uid\": f\"{self._scraper.calendar_title}-{collection.date.isoformat()}-{collection.type}\",\n            \"summary\": collection.type,\n            \"start\": {\"date\": collection.date.isoformat()},\n            \"end\": {\"date\": (collection.date + timedelta(days=1)).isoformat()},\n            \"allDay\": True,\n        }\n", "path": "custom_components/waste_collection_schedule/calendar.py"}]}