prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Spider sunoco is broken
  During the global build at 2021-07-21-14-42-39, spider **sunoco** failed with **0 features** and **1 errors**.
  
  Here's [the log](https://data.alltheplaces.xyz/runs/2021-07-21-14-42-39/logs/sunoco.txt) and [the output](https://data.alltheplaces.xyz/runs/2021-07-21-14-42-39/output/sunoco.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-07-21-14-42-39/output/sunoco.geojson))
  
  </issue>
  <code>
  [start of locations/spiders/sunoco.py]
  1 # -*- coding: utf-8 -*-
  2 import scrapy
  3 import json
  4 
  5 from locations.items import GeojsonPointItem
  6 from locations.hours import OpeningHours
  7 
  8 
  9 class SunocoSpider(scrapy.Spider):
  10     name = "sunoco"
  11     item_attributes = {'brand': "Sunoco", 'brand_wikidata': "Q1423218"}
  12     allowed_domains = ["sunoco.com"]
  13 
  14     start_urls = ['https://www.sunoco.com/js/locations.json']
  15 
  16     def parse(self, response):
  17         for location in json.loads(response.body_as_unicode()):
  18             opening_hours = OpeningHours()
  19 
  20             for key in [
  21                 'Hrs of Operation Mon-Sat Open',
  22                 'Hrs of Operation Mon-Sat Close',
  23                 'Hrs of Operation Sun Open',
  24                 'Hrs of Operation Sun Close'
  25             ]:
  26                 if location[key] >= 2400:
  27                     location[key] -= 2400
  28 
  29             for day in ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']:
  30                 opening_hours.add_range(day=day,
  31                                         open_time=f"{location['Hrs of Operation Mon-Sat Open']:04d}",
  32                                         close_time=f"{location['Hrs of Operation Mon-Sat Close']:04d}",
  33                                         time_format='%H%M')
  34 
  35             opening_hours.add_range(day='Su',
  36                                     open_time=f"{location['Hrs of Operation Sun Open']:04d}",
  37                                     close_time=f"{location['Hrs of Operation Sun Close']:04d}",
  38                                     time_format='%H%M')
  39 
  40             yield GeojsonPointItem(
  41                 ref=location['Facility ID'],
  42                 lon=location['Longitude'],
  43                 lat=location['Latitude'],
  44                 # name as shown on the Sunoco site
  45                 name=f"Sunoco #{location['Facility ID']}",
  46                 addr_full=location['Address'],
  47                 city=location['City'],
  48                 state=location['State'],
  49                 postcode=location['Zip'],
  50                 country='US',
  51                 phone=location['Phone'],
  52                 opening_hours=opening_hours.as_opening_hours(),
  53                 extras={
  54                     'amenity:fuel': True,
  55                     'atm': int(location['ATM'] or 0) == 1,
  56                     'car_wash': int(location['Car Wash'] or 0) == 1,
  57                     'fuel:diesel': int(location['Diesel'] or 0) == 1,
  58                     'fuel:kerosene': int(location['Kerosene'] or 0) == 1
  59                 }
  60             )
  61
  [end of locations/spiders/sunoco.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/locations/spiders/sunoco.py b/locations/spiders/sunoco.py
  --- a/locations/spiders/sunoco.py
  +++ b/locations/spiders/sunoco.py
  @@ -17,44 +17,34 @@
           for location in json.loads(response.body_as_unicode()):
               opening_hours = OpeningHours()
   
  -            for key in [
  -                'Hrs of Operation Mon-Sat Open',
  -                'Hrs of Operation Mon-Sat Close',
  -                'Hrs of Operation Sun Open',
  -                'Hrs of Operation Sun Close'
  -            ]:
  -                if location[key] >= 2400:
  -                    location[key] -= 2400
  -
  -            for day in ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']:
  -                opening_hours.add_range(day=day,
  -                                        open_time=f"{location['Hrs of Operation Mon-Sat Open']:04d}",
  -                                        close_time=f"{location['Hrs of Operation Mon-Sat Close']:04d}",
  -                                        time_format='%H%M')
  -
  -            opening_hours.add_range(day='Su',
  -                                    open_time=f"{location['Hrs of Operation Sun Open']:04d}",
  -                                    close_time=f"{location['Hrs of Operation Sun Close']:04d}",
  -                                    time_format='%H%M')
  +            for key, val in location.items():
  +                if not key.endswith('_Hours'):
  +                    continue
  +                day = key[:2].capitalize()
  +                if val == '24 hours':
  +                    open_time = close_time = '12 AM'
  +                else:
  +                    open_time, close_time = val.split(' to ')
  +                opening_hours.add_range(day, open_time, close_time, '%I %p')
   
               yield GeojsonPointItem(
  -                ref=location['Facility ID'],
  +                ref=location['Store_ID'],
                   lon=location['Longitude'],
                   lat=location['Latitude'],
                   # name as shown on the Sunoco site
  -                name=f"Sunoco #{location['Facility ID']}",
  -                addr_full=location['Address'],
  +                name=f"Sunoco #{location['Store_ID']}",
  +                addr_full=location['Street_Address'],
                   city=location['City'],
                   state=location['State'],
  -                postcode=location['Zip'],
  +                postcode=location['Postalcode'],
                   country='US',
                   phone=location['Phone'],
                   opening_hours=opening_hours.as_opening_hours(),
                   extras={
                       'amenity:fuel': True,
  -                    'atm': int(location['ATM'] or 0) == 1,
  -                    'car_wash': int(location['Car Wash'] or 0) == 1,
  -                    'fuel:diesel': int(location['Diesel'] or 0) == 1,
  -                    'fuel:kerosene': int(location['Kerosene'] or 0) == 1
  +                    'atm': location['ATM'] == 'Y',
  +                    'car_wash': location['CarWash'],
  +                    'fuel:diesel': location['HasDiesel'] == 'Y',
  +                    'fuel:kerosene': location['HasKero'] == 'Y'
                   }
               )
  
verification_info: {"golden_diff": "diff --git a/locations/spiders/sunoco.py b/locations/spiders/sunoco.py\n--- a/locations/spiders/sunoco.py\n+++ b/locations/spiders/sunoco.py\n@@ -17,44 +17,34 @@\n         for location in json.loads(response.body_as_unicode()):\n             opening_hours = OpeningHours()\n \n-            for key in [\n-                'Hrs of Operation Mon-Sat Open',\n-                'Hrs of Operation Mon-Sat Close',\n-                'Hrs of Operation Sun Open',\n-                'Hrs of Operation Sun Close'\n-            ]:\n-                if location[key] >= 2400:\n-                    location[key] -= 2400\n-\n-            for day in ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']:\n-                opening_hours.add_range(day=day,\n-                                        open_time=f\"{location['Hrs of Operation Mon-Sat Open']:04d}\",\n-                                        close_time=f\"{location['Hrs of Operation Mon-Sat Close']:04d}\",\n-                                        time_format='%H%M')\n-\n-            opening_hours.add_range(day='Su',\n-                                    open_time=f\"{location['Hrs of Operation Sun Open']:04d}\",\n-                                    close_time=f\"{location['Hrs of Operation Sun Close']:04d}\",\n-                                    time_format='%H%M')\n+            for key, val in location.items():\n+                if not key.endswith('_Hours'):\n+                    continue\n+                day = key[:2].capitalize()\n+                if val == '24 hours':\n+                    open_time = close_time = '12 AM'\n+                else:\n+                    open_time, close_time = val.split(' to ')\n+                opening_hours.add_range(day, open_time, close_time, '%I %p')\n \n             yield GeojsonPointItem(\n-                ref=location['Facility ID'],\n+                ref=location['Store_ID'],\n                 lon=location['Longitude'],\n                 lat=location['Latitude'],\n                 # name as shown on the Sunoco site\n-                name=f\"Sunoco #{location['Facility ID']}\",\n-                addr_full=location['Address'],\n+                name=f\"Sunoco #{location['Store_ID']}\",\n+                addr_full=location['Street_Address'],\n                 city=location['City'],\n                 state=location['State'],\n-                postcode=location['Zip'],\n+                postcode=location['Postalcode'],\n                 country='US',\n                 phone=location['Phone'],\n                 opening_hours=opening_hours.as_opening_hours(),\n                 extras={\n                     'amenity:fuel': True,\n-                    'atm': int(location['ATM'] or 0) == 1,\n-                    'car_wash': int(location['Car Wash'] or 0) == 1,\n-                    'fuel:diesel': int(location['Diesel'] or 0) == 1,\n-                    'fuel:kerosene': int(location['Kerosene'] or 0) == 1\n+                    'atm': location['ATM'] == 'Y',\n+                    'car_wash': location['CarWash'],\n+                    'fuel:diesel': location['HasDiesel'] == 'Y',\n+                    'fuel:kerosene': location['HasKero'] == 'Y'\n                 }\n             )\n", "issue": "Spider sunoco is broken\nDuring the global build at 2021-07-21-14-42-39, spider **sunoco** failed with **0 features** and **1 errors**.\n\nHere's [the log](https://data.alltheplaces.xyz/runs/2021-07-21-14-42-39/logs/sunoco.txt) and [the output](https://data.alltheplaces.xyz/runs/2021-07-21-14-42-39/output/sunoco.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-07-21-14-42-39/output/sunoco.geojson))\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nimport scrapy\nimport json\n\nfrom locations.items import GeojsonPointItem\nfrom locations.hours import OpeningHours\n\n\nclass SunocoSpider(scrapy.Spider):\n    name = \"sunoco\"\n    item_attributes = {'brand': \"Sunoco\", 'brand_wikidata': \"Q1423218\"}\n    allowed_domains = [\"sunoco.com\"]\n\n    start_urls = ['https://www.sunoco.com/js/locations.json']\n\n    def parse(self, response):\n        for location in json.loads(response.body_as_unicode()):\n            opening_hours = OpeningHours()\n\n            for key in [\n                'Hrs of Operation Mon-Sat Open',\n                'Hrs of Operation Mon-Sat Close',\n                'Hrs of Operation Sun Open',\n                'Hrs of Operation Sun Close'\n            ]:\n                if location[key] >= 2400:\n                    location[key] -= 2400\n\n            for day in ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']:\n                opening_hours.add_range(day=day,\n                                        open_time=f\"{location['Hrs of Operation Mon-Sat Open']:04d}\",\n                                        close_time=f\"{location['Hrs of Operation Mon-Sat Close']:04d}\",\n                                        time_format='%H%M')\n\n            opening_hours.add_range(day='Su',\n                                    open_time=f\"{location['Hrs of Operation Sun Open']:04d}\",\n                                    close_time=f\"{location['Hrs of Operation Sun Close']:04d}\",\n                                    time_format='%H%M')\n\n            yield GeojsonPointItem(\n                ref=location['Facility ID'],\n                lon=location['Longitude'],\n                lat=location['Latitude'],\n                # name as shown on the Sunoco site\n                name=f\"Sunoco #{location['Facility ID']}\",\n                addr_full=location['Address'],\n                city=location['City'],\n                state=location['State'],\n                postcode=location['Zip'],\n                country='US',\n                phone=location['Phone'],\n                opening_hours=opening_hours.as_opening_hours(),\n                extras={\n                    'amenity:fuel': True,\n                    'atm': int(location['ATM'] or 0) == 1,\n                    'car_wash': int(location['Car Wash'] or 0) == 1,\n                    'fuel:diesel': int(location['Diesel'] or 0) == 1,\n                    'fuel:kerosene': int(location['Kerosene'] or 0) == 1\n                }\n            )\n", "path": "locations/spiders/sunoco.py"}]}