prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add Garden waste type to Cornwall, UK source
  ### I propose a feature for:
  
  Sources
  
  ### Describe your wanted feature
  
  Can you please add Garden to the cornwall_gov_uk.py source?
  
  Change - COLLECTIONS = {"Rubbish", "Recycling"}
  to COLLECTIONS = {"Rubbish", "Recycling", "Garden"}
  
  For my house I'm getting the following html snip so I think it should work. 
  
  <div id="my-waste-collection">
          <h3 class="font-weight-bolder">Current collections</h3>
          <div class="row text-center">
                  <div class="col-12 col-md-4">
                      <div id="recycling" class="collection text-center service">
                              <span>Recycling</span>
                              <span>SAT</span>
                              <span>30 Dec</span>
                      </div>
                  </div>
                  <div class="col-12 col-md-4">
                      <div id="rubbish" class="collection text-center service">
                              <span>Rubbish</span>
                              <span>TUE</span>
                              <span>2 Jan</span>
                      </div>
                  </div>
                  <div class="col-12 col-md-4">
                      <div id="gardenhassubscription" class="collection text-cente              r service">
                              <span>Garden</span>
                              <span>FRI</span>
                              <span>22 Dec</span>
                      </div>
                  </div>
          </div>
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py`
  Content:
  ```
  1 from datetime import date, datetime
  2 
  3 import requests
  4 from bs4 import BeautifulSoup
  5 from waste_collection_schedule import Collection
  6 
  7 TITLE = "Cornwall Council"
  8 DESCRIPTION = "Source for cornwall.gov.uk services for Cornwall Council"
  9 URL = "https://cornwall.gov.uk"
  10 TEST_CASES = {
  11     "known_uprn": {"uprn": "100040118005"},
  12     "unknown_uprn": {"postcode": "TR261SP", "housenumberorname": "7"},
  13 }
  14 
  15 SEARCH_URLS = {
  16     "uprn_search": "https://www.cornwall.gov.uk/my-area/",
  17     "collection_search": "https://www.cornwall.gov.uk/umbraco/Surface/Waste/MyCollectionDays?subscribe=False",
  18 }
  19 COLLECTIONS = {"Rubbish", "Recycling"}
  20 
  21 
  22 class Source:
  23     def __init__(
  24         self, uprn=None, postcode=None, housenumberorname=None
  25     ):  # argX correspond to the args dict in the source configuration
  26         self._uprn = uprn
  27         self._postcode = postcode
  28         self._housenumberorname = housenumberorname
  29 
  30     def fetch(self):
  31         entries = []
  32         session = requests.Session()
  33 
  34         # Find the UPRN based on the postcode and the property name/number
  35         if self._uprn is None:
  36             args = {"Postcode": self._postcode}
  37             r = session.get(SEARCH_URLS["uprn_search"], params=args)
  38             r.raise_for_status()
  39             soup = BeautifulSoup(r.text, features="html.parser")
  40             propertyUprns = soup.find(id="Uprn").find_all("option")
  41             for match in propertyUprns:
  42                 if match.text.startswith(self._housenumberorname):
  43                     self._uprn = match["value"]
  44 
  45         # Get the collection days based on the UPRN (either supplied through arguments or searched for above)
  46         if self._uprn is not None:
  47             args = {"uprn": self._uprn}
  48             r = session.get(SEARCH_URLS["collection_search"], params=args)
  49             r.raise_for_status()
  50             soup = BeautifulSoup(r.text, features="html.parser")
  51             for collection in COLLECTIONS:
  52                 d = (
  53                     soup.find(id=collection.lower()).find_all("span")[-1].text
  54                     + " "
  55                     + str(date.today().year)
  56                 )
  57 
  58                 entries.append(
  59                     Collection(
  60                         datetime.strptime(d, "%d %b %Y").date(),
  61                         collection,
  62                     )
  63                 )
  64 
  65         return entries
  66
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py
  --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py
  +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py
  @@ -2,7 +2,7 @@
   
   import requests
   from bs4 import BeautifulSoup
  -from waste_collection_schedule import Collection
  +from waste_collection_schedule import Collection  # type: ignore[attr-defined]
   
   TITLE = "Cornwall Council"
   DESCRIPTION = "Source for cornwall.gov.uk services for Cornwall Council"
  @@ -10,13 +10,18 @@
   TEST_CASES = {
       "known_uprn": {"uprn": "100040118005"},
       "unknown_uprn": {"postcode": "TR261SP", "housenumberorname": "7"},
  +    "uprn_with_garden": {"uprn": "100040080721"},
   }
   
   SEARCH_URLS = {
       "uprn_search": "https://www.cornwall.gov.uk/my-area/",
       "collection_search": "https://www.cornwall.gov.uk/umbraco/Surface/Waste/MyCollectionDays?subscribe=False",
   }
  -COLLECTIONS = {"Rubbish", "Recycling"}
  +ICON_MAP = {
  +    "Rubbish": "mdi:delete",
  +    "Recycling": "mdi:recycle",
  +    "Garden": "mdi:flower",
  +}
   
   
   class Source:
  @@ -41,25 +46,29 @@
               for match in propertyUprns:
                   if match.text.startswith(self._housenumberorname):
                       self._uprn = match["value"]
  +            if self._uprn is None:
  +                raise Exception(
  +                    f"No UPRN found for {self._postcode} {self._housenumberorname}"
  +                )
   
           # Get the collection days based on the UPRN (either supplied through arguments or searched for above)
  -        if self._uprn is not None:
  -            args = {"uprn": self._uprn}
  -            r = session.get(SEARCH_URLS["collection_search"], params=args)
  -            r.raise_for_status()
  -            soup = BeautifulSoup(r.text, features="html.parser")
  -            for collection in COLLECTIONS:
  -                d = (
  -                    soup.find(id=collection.lower()).find_all("span")[-1].text
  -                    + " "
  -                    + str(date.today().year)
  -                )
  +        args = {"uprn": self._uprn}
  +        r = session.get(SEARCH_URLS["collection_search"], params=args)
  +        r.raise_for_status()
  +        soup = BeautifulSoup(r.text, features="html.parser")
  +        for collection_div in soup.find_all("div", class_="collection"):
  +            spans = collection_div.find_all("span")
  +            if not spans:
  +                continue
  +            collection = spans[0].text
  +            d = spans[-1].text + " " + str(date.today().year)
   
  -                entries.append(
  -                    Collection(
  -                        datetime.strptime(d, "%d %b %Y").date(),
  -                        collection,
  -                    )
  +            entries.append(
  +                Collection(
  +                    datetime.strptime(d, "%d %b %Y").date(),
  +                    collection,
  +                    icon=ICON_MAP.get(collection),
                   )
  +            )
   
           return entries
  
verification_info: {"golden_diff": "diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py\n--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py\n+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py\n@@ -2,7 +2,7 @@\n \n import requests\n from bs4 import BeautifulSoup\n-from waste_collection_schedule import Collection\n+from waste_collection_schedule import Collection  # type: ignore[attr-defined]\n \n TITLE = \"Cornwall Council\"\n DESCRIPTION = \"Source for cornwall.gov.uk services for Cornwall Council\"\n@@ -10,13 +10,18 @@\n TEST_CASES = {\n     \"known_uprn\": {\"uprn\": \"100040118005\"},\n     \"unknown_uprn\": {\"postcode\": \"TR261SP\", \"housenumberorname\": \"7\"},\n+    \"uprn_with_garden\": {\"uprn\": \"100040080721\"},\n }\n \n SEARCH_URLS = {\n     \"uprn_search\": \"https://www.cornwall.gov.uk/my-area/\",\n     \"collection_search\": \"https://www.cornwall.gov.uk/umbraco/Surface/Waste/MyCollectionDays?subscribe=False\",\n }\n-COLLECTIONS = {\"Rubbish\", \"Recycling\"}\n+ICON_MAP = {\n+    \"Rubbish\": \"mdi:delete\",\n+    \"Recycling\": \"mdi:recycle\",\n+    \"Garden\": \"mdi:flower\",\n+}\n \n \n class Source:\n@@ -41,25 +46,29 @@\n             for match in propertyUprns:\n                 if match.text.startswith(self._housenumberorname):\n                     self._uprn = match[\"value\"]\n+            if self._uprn is None:\n+                raise Exception(\n+                    f\"No UPRN found for {self._postcode} {self._housenumberorname}\"\n+                )\n \n         # Get the collection days based on the UPRN (either supplied through arguments or searched for above)\n-        if self._uprn is not None:\n-            args = {\"uprn\": self._uprn}\n-            r = session.get(SEARCH_URLS[\"collection_search\"], params=args)\n-            r.raise_for_status()\n-            soup = BeautifulSoup(r.text, features=\"html.parser\")\n-            for collection in COLLECTIONS:\n-                d = (\n-                    soup.find(id=collection.lower()).find_all(\"span\")[-1].text\n-                    + \" \"\n-                    + str(date.today().year)\n-                )\n+        args = {\"uprn\": self._uprn}\n+        r = session.get(SEARCH_URLS[\"collection_search\"], params=args)\n+        r.raise_for_status()\n+        soup = BeautifulSoup(r.text, features=\"html.parser\")\n+        for collection_div in soup.find_all(\"div\", class_=\"collection\"):\n+            spans = collection_div.find_all(\"span\")\n+            if not spans:\n+                continue\n+            collection = spans[0].text\n+            d = spans[-1].text + \" \" + str(date.today().year)\n \n-                entries.append(\n-                    Collection(\n-                        datetime.strptime(d, \"%d %b %Y\").date(),\n-                        collection,\n-                    )\n+            entries.append(\n+                Collection(\n+                    datetime.strptime(d, \"%d %b %Y\").date(),\n+                    collection,\n+                    icon=ICON_MAP.get(collection),\n                 )\n+            )\n \n         return entries\n", "issue": "Add Garden waste type to Cornwall, UK source\n### I propose a feature for:\n\nSources\n\n### Describe your wanted feature\n\nCan you please add Garden to the cornwall_gov_uk.py source?\r\n\r\nChange - COLLECTIONS = {\"Rubbish\", \"Recycling\"}\r\nto COLLECTIONS = {\"Rubbish\", \"Recycling\", \"Garden\"}\r\n\r\nFor my house I'm getting the following html snip so I think it should work. \r\n\r\n<div id=\"my-waste-collection\">\r\n        <h3 class=\"font-weight-bolder\">Current collections</h3>\r\n        <div class=\"row text-center\">\r\n                <div class=\"col-12 col-md-4\">\r\n                    <div id=\"recycling\" class=\"collection text-center service\">\r\n                            <span>Recycling</span>\r\n                            <span>SAT</span>\r\n                            <span>30 Dec</span>\r\n                    </div>\r\n                </div>\r\n                <div class=\"col-12 col-md-4\">\r\n                    <div id=\"rubbish\" class=\"collection text-center service\">\r\n                            <span>Rubbish</span>\r\n                            <span>TUE</span>\r\n                            <span>2 Jan</span>\r\n                    </div>\r\n                </div>\r\n                <div class=\"col-12 col-md-4\">\r\n                    <div id=\"gardenhassubscription\" class=\"collection text-cente              r service\">\r\n                            <span>Garden</span>\r\n                            <span>FRI</span>\r\n                            <span>22 Dec</span>\r\n                    </div>\r\n                </div>\r\n        </div>\n", "before_files": [{"content": "from datetime import date, datetime\n\nimport requests\nfrom bs4 import BeautifulSoup\nfrom waste_collection_schedule import Collection\n\nTITLE = \"Cornwall Council\"\nDESCRIPTION = \"Source for cornwall.gov.uk services for Cornwall Council\"\nURL = \"https://cornwall.gov.uk\"\nTEST_CASES = {\n    \"known_uprn\": {\"uprn\": \"100040118005\"},\n    \"unknown_uprn\": {\"postcode\": \"TR261SP\", \"housenumberorname\": \"7\"},\n}\n\nSEARCH_URLS = {\n    \"uprn_search\": \"https://www.cornwall.gov.uk/my-area/\",\n    \"collection_search\": \"https://www.cornwall.gov.uk/umbraco/Surface/Waste/MyCollectionDays?subscribe=False\",\n}\nCOLLECTIONS = {\"Rubbish\", \"Recycling\"}\n\n\nclass Source:\n    def __init__(\n        self, uprn=None, postcode=None, housenumberorname=None\n    ):  # argX correspond to the args dict in the source configuration\n        self._uprn = uprn\n        self._postcode = postcode\n        self._housenumberorname = housenumberorname\n\n    def fetch(self):\n        entries = []\n        session = requests.Session()\n\n        # Find the UPRN based on the postcode and the property name/number\n        if self._uprn is None:\n            args = {\"Postcode\": self._postcode}\n            r = session.get(SEARCH_URLS[\"uprn_search\"], params=args)\n            r.raise_for_status()\n            soup = BeautifulSoup(r.text, features=\"html.parser\")\n            propertyUprns = soup.find(id=\"Uprn\").find_all(\"option\")\n            for match in propertyUprns:\n                if match.text.startswith(self._housenumberorname):\n                    self._uprn = match[\"value\"]\n\n        # Get the collection days based on the UPRN (either supplied through arguments or searched for above)\n        if self._uprn is not None:\n            args = {\"uprn\": self._uprn}\n            r = session.get(SEARCH_URLS[\"collection_search\"], params=args)\n            r.raise_for_status()\n            soup = BeautifulSoup(r.text, features=\"html.parser\")\n            for collection in COLLECTIONS:\n                d = (\n                    soup.find(id=collection.lower()).find_all(\"span\")[-1].text\n                    + \" \"\n                    + str(date.today().year)\n                )\n\n                entries.append(\n                    Collection(\n                        datetime.strptime(d, \"%d %b %Y\").date(),\n                        collection,\n                    )\n                )\n\n        return entries\n", "path": "custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py"}], "after_files": [{"content": "from datetime import date, datetime\n\nimport requests\nfrom bs4 import BeautifulSoup\nfrom waste_collection_schedule import Collection  # type: ignore[attr-defined]\n\nTITLE = \"Cornwall Council\"\nDESCRIPTION = \"Source for cornwall.gov.uk services for Cornwall Council\"\nURL = \"https://cornwall.gov.uk\"\nTEST_CASES = {\n    \"known_uprn\": {\"uprn\": \"100040118005\"},\n    \"unknown_uprn\": {\"postcode\": \"TR261SP\", \"housenumberorname\": \"7\"},\n    \"uprn_with_garden\": {\"uprn\": \"100040080721\"},\n}\n\nSEARCH_URLS = {\n    \"uprn_search\": \"https://www.cornwall.gov.uk/my-area/\",\n    \"collection_search\": \"https://www.cornwall.gov.uk/umbraco/Surface/Waste/MyCollectionDays?subscribe=False\",\n}\nICON_MAP = {\n    \"Rubbish\": \"mdi:delete\",\n    \"Recycling\": \"mdi:recycle\",\n    \"Garden\": \"mdi:flower\",\n}\n\n\nclass Source:\n    def __init__(\n        self, uprn=None, postcode=None, housenumberorname=None\n    ):  # argX correspond to the args dict in the source configuration\n        self._uprn = uprn\n        self._postcode = postcode\n        self._housenumberorname = housenumberorname\n\n    def fetch(self):\n        entries = []\n        session = requests.Session()\n\n        # Find the UPRN based on the postcode and the property name/number\n        if self._uprn is None:\n            args = {\"Postcode\": self._postcode}\n            r = session.get(SEARCH_URLS[\"uprn_search\"], params=args)\n            r.raise_for_status()\n            soup = BeautifulSoup(r.text, features=\"html.parser\")\n            propertyUprns = soup.find(id=\"Uprn\").find_all(\"option\")\n            for match in propertyUprns:\n                if match.text.startswith(self._housenumberorname):\n                    self._uprn = match[\"value\"]\n            if self._uprn is None:\n                raise Exception(\n                    f\"No UPRN found for {self._postcode} {self._housenumberorname}\"\n                )\n\n        # Get the collection days based on the UPRN (either supplied through arguments or searched for above)\n        args = {\"uprn\": self._uprn}\n        r = session.get(SEARCH_URLS[\"collection_search\"], params=args)\n        r.raise_for_status()\n        soup = BeautifulSoup(r.text, features=\"html.parser\")\n        for collection_div in soup.find_all(\"div\", class_=\"collection\"):\n            spans = collection_div.find_all(\"span\")\n            if not spans:\n                continue\n            collection = spans[0].text\n            d = spans[-1].text + \" \" + str(date.today().year)\n\n            entries.append(\n                Collection(\n                    datetime.strptime(d, \"%d %b %Y\").date(),\n                    collection,\n                    icon=ICON_MAP.get(collection),\n                )\n            )\n\n        return entries\n", "path": "custom_components/waste_collection_schedule/waste_collection_schedule/source/cornwall_gov_uk.py"}]}