prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [bug] [recycleapp_be] UnboundLocalError: local variable 'streetId' referenced before assignment
  Hello, 
  
  I have a problem with the recycleapp_be source.
  
  I have the error into the log : 
  
  ```
  Logger: waste_collection_schedule.scraper
  Source: custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py:143
  Integration: waste_collection_schedule ([documentation](https://github.com/mampfes/hacs_waste_collection_schedule#readme))
  First occurred: 15:24:43 (1 occurrences)
  Last logged: 15:24:43
  
  fetch failed for source Recycle!: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py", line 141, in fetch entries = self._source.fetch() File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py", line 66, in fetch if streetId is None: UnboundLocalError: local variable 'streetId' referenced before assignment
  ` ``
  
  
  </issue>
  <code>
  [start of custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py]
  1 import logging
  2 from datetime import datetime, timedelta
  3 
  4 import requests
  5 from waste_collection_schedule import Collection  # type: ignore[attr-defined]
  6 
  7 TITLE = "Recycle!"
  8 DESCRIPTION = "Source for RecycleApp.be"
  9 URL = "https://www.recycleapp.be"
  10 TEST_CASES = {
  11     "1140 Evere, Bazellaan 1": {
  12         "postcode": 1140,
  13         "street": "Bazellaan",
  14         "house_number": 1,
  15     },
  16     "3001, Waversebaan 276 with events": {
  17         "postcode": 3001,
  18         "street": "Waversebaan",
  19         "house_number": 276,
  20     },
  21     "3001, Waversebaan 276 without events": {
  22         "postcode": 3001,
  23         "street": "Waversebaan",
  24         "house_number": 276,
  25         "add_events": False,
  26     },
  27 }
  28 
  29 _LOGGER = logging.getLogger(__name__)
  30 
  31 
  32 class Source:
  33     def __init__(self, postcode, street, house_number, add_events=True):
  34         self._postcode = postcode
  35         self._street = street
  36         self._house_number = house_number
  37         self._add_events = add_events
  38 
  39     def fetch(self):
  40         url = "https://api.recycleapp.be/api/app/v1"
  41         headers = {
  42             "x-secret": "Crgja3EGWe8jdapyr4EEoMBgZACYYjRRcRpaMQrLDW9HJBvmgkfGQyYqLgeXPavAGvnJqkV87PBB2b8zx43q46sUgzqio4yRZbABhtKeagkVKypTEDjKfPgGycjLyJTtLHYpzwJgp4YmmCuJZN9ZmJY8CGEoFs8MKfdJpU9RjkEVfngmmk2LYD4QzFegLNKUbcCeAdEW",
  43             "x-consumer": "recycleapp.be",
  44             "User-Agent": "",
  45             "Authorization": "",
  46         }
  47         r = requests.get(f"{url}/access-token", headers=headers)
  48         headers["Authorization"] = r.json()["accessToken"]
  49 
  50         params = {"q": self._postcode}
  51         r = requests.get(f"{url}/zipcodes", params=params, headers=headers)
  52         if r.status_code != 200:
  53             _LOGGER.error("Get zip code failed")
  54             return []
  55         zipcodeId = r.json()["items"][0]["id"]
  56 
  57         params = {"q": self._street, "zipcodes": zipcodeId}
  58         r = requests.get(f"{url}/streets", params=params, headers=headers)
  59         if r.status_code != 200:
  60             _LOGGER.error("Get street id failed")
  61             return []
  62 
  63         for item in r.json()["items"]:
  64             if item["name"] == self._street:
  65                 streetId = item["id"]
  66         if streetId is None:
  67             streetId = r.json()["items"][0]["id"]
  68 
  69         now = datetime.now()
  70         fromDate = now.strftime("%Y-%m-%d")
  71         untilDate = (now + timedelta(days=365)).strftime("%Y-%m-%d")
  72         params = {
  73             "zipcodeId": zipcodeId,
  74             "streetId": streetId,
  75             "houseNumber": self._house_number,
  76             "fromDate": fromDate,
  77             "untilDate": untilDate,
  78             #            "size":100,
  79         }
  80         r = requests.get(f"{url}/collections", params=params, headers=headers)
  81         if r.status_code != 200:
  82             _LOGGER.error("Get data failed")
  83             return []
  84 
  85         entries = []
  86         for item in r.json()["items"]:
  87             if "exception" in item and "replacedBy" in item["exception"]:
  88                 continue
  89 
  90             date = datetime.strptime(item["timestamp"], "%Y-%m-%dT%H:%M:%S.000Z").date()
  91             if item["type"] == "collection":
  92                 entries.append(Collection(date, item["fraction"]["name"]["en"]))
  93             elif item["type"] == "event" and self._add_events:
  94                 entries.append(Collection(date, item["event"]["title"]["en"]))
  95 
  96         return entries
  97
  [end of custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.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/waste_collection_schedule/source/recycleapp_be.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py
  --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py
  +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py
  @@ -24,6 +24,12 @@
           "house_number": 276,
           "add_events": False,
       },
  +    "1400, Rue de namur 1 with events": {
  +        "postcode": 1400,
  +        "street": "Rue de namur",
  +        "house_number": 1,
  +        "add_events": True,
  +    },
   }
   
   _LOGGER = logging.getLogger(__name__)
  @@ -60,6 +66,7 @@
               _LOGGER.error("Get street id failed")
               return []
   
  +        streetId = None
           for item in r.json()["items"]:
               if item["name"] == self._street:
                   streetId = item["id"]
  
verification_info: {"golden_diff": "diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py\n--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py\n+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py\n@@ -24,6 +24,12 @@\n         \"house_number\": 276,\n         \"add_events\": False,\n     },\n+    \"1400, Rue de namur 1 with events\": {\n+        \"postcode\": 1400,\n+        \"street\": \"Rue de namur\",\n+        \"house_number\": 1,\n+        \"add_events\": True,\n+    },\n }\n \n _LOGGER = logging.getLogger(__name__)\n@@ -60,6 +66,7 @@\n             _LOGGER.error(\"Get street id failed\")\n             return []\n \n+        streetId = None\n         for item in r.json()[\"items\"]:\n             if item[\"name\"] == self._street:\n                 streetId = item[\"id\"]\n", "issue": "[bug] [recycleapp_be] UnboundLocalError: local variable 'streetId' referenced before assignment\nHello, \r\n\r\nI have a problem with the recycleapp_be source.\r\n\r\nI have the error into the log : \r\n\r\n```\r\nLogger: waste_collection_schedule.scraper\r\nSource: custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py:143\r\nIntegration: waste_collection_schedule ([documentation](https://github.com/mampfes/hacs_waste_collection_schedule#readme))\r\nFirst occurred: 15:24:43 (1 occurrences)\r\nLast logged: 15:24:43\r\n\r\nfetch failed for source Recycle!: Traceback (most recent call last): File \"/config/custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py\", line 141, in fetch entries = self._source.fetch() File \"/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py\", line 66, in fetch if streetId is None: UnboundLocalError: local variable 'streetId' referenced before assignment\r\n` ``\r\n\n", "before_files": [{"content": "import logging\nfrom datetime import datetime, timedelta\n\nimport requests\nfrom waste_collection_schedule import Collection  # type: ignore[attr-defined]\n\nTITLE = \"Recycle!\"\nDESCRIPTION = \"Source for RecycleApp.be\"\nURL = \"https://www.recycleapp.be\"\nTEST_CASES = {\n    \"1140 Evere, Bazellaan 1\": {\n        \"postcode\": 1140,\n        \"street\": \"Bazellaan\",\n        \"house_number\": 1,\n    },\n    \"3001, Waversebaan 276 with events\": {\n        \"postcode\": 3001,\n        \"street\": \"Waversebaan\",\n        \"house_number\": 276,\n    },\n    \"3001, Waversebaan 276 without events\": {\n        \"postcode\": 3001,\n        \"street\": \"Waversebaan\",\n        \"house_number\": 276,\n        \"add_events\": False,\n    },\n}\n\n_LOGGER = logging.getLogger(__name__)\n\n\nclass Source:\n    def __init__(self, postcode, street, house_number, add_events=True):\n        self._postcode = postcode\n        self._street = street\n        self._house_number = house_number\n        self._add_events = add_events\n\n    def fetch(self):\n        url = \"https://api.recycleapp.be/api/app/v1\"\n        headers = {\n            \"x-secret\": \"Crgja3EGWe8jdapyr4EEoMBgZACYYjRRcRpaMQrLDW9HJBvmgkfGQyYqLgeXPavAGvnJqkV87PBB2b8zx43q46sUgzqio4yRZbABhtKeagkVKypTEDjKfPgGycjLyJTtLHYpzwJgp4YmmCuJZN9ZmJY8CGEoFs8MKfdJpU9RjkEVfngmmk2LYD4QzFegLNKUbcCeAdEW\",\n            \"x-consumer\": \"recycleapp.be\",\n            \"User-Agent\": \"\",\n            \"Authorization\": \"\",\n        }\n        r = requests.get(f\"{url}/access-token\", headers=headers)\n        headers[\"Authorization\"] = r.json()[\"accessToken\"]\n\n        params = {\"q\": self._postcode}\n        r = requests.get(f\"{url}/zipcodes\", params=params, headers=headers)\n        if r.status_code != 200:\n            _LOGGER.error(\"Get zip code failed\")\n            return []\n        zipcodeId = r.json()[\"items\"][0][\"id\"]\n\n        params = {\"q\": self._street, \"zipcodes\": zipcodeId}\n        r = requests.get(f\"{url}/streets\", params=params, headers=headers)\n        if r.status_code != 200:\n            _LOGGER.error(\"Get street id failed\")\n            return []\n\n        for item in r.json()[\"items\"]:\n            if item[\"name\"] == self._street:\n                streetId = item[\"id\"]\n        if streetId is None:\n            streetId = r.json()[\"items\"][0][\"id\"]\n\n        now = datetime.now()\n        fromDate = now.strftime(\"%Y-%m-%d\")\n        untilDate = (now + timedelta(days=365)).strftime(\"%Y-%m-%d\")\n        params = {\n            \"zipcodeId\": zipcodeId,\n            \"streetId\": streetId,\n            \"houseNumber\": self._house_number,\n            \"fromDate\": fromDate,\n            \"untilDate\": untilDate,\n            #            \"size\":100,\n        }\n        r = requests.get(f\"{url}/collections\", params=params, headers=headers)\n        if r.status_code != 200:\n            _LOGGER.error(\"Get data failed\")\n            return []\n\n        entries = []\n        for item in r.json()[\"items\"]:\n            if \"exception\" in item and \"replacedBy\" in item[\"exception\"]:\n                continue\n\n            date = datetime.strptime(item[\"timestamp\"], \"%Y-%m-%dT%H:%M:%S.000Z\").date()\n            if item[\"type\"] == \"collection\":\n                entries.append(Collection(date, item[\"fraction\"][\"name\"][\"en\"]))\n            elif item[\"type\"] == \"event\" and self._add_events:\n                entries.append(Collection(date, item[\"event\"][\"title\"][\"en\"]))\n\n        return entries\n", "path": "custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py"}]}