prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Spider pricerite is broken
  During the global build at 2021-05-26-14-42-23, spider **pricerite** failed with **0 features** and **2 errors**.
  
  Here's [the log](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/logs/pricerite.log) and [the output](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/pricerite.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/pricerite.geojson))
  
  </issue>
  <code>
  [start of locations/spiders/pricerite.py]
  1 # -*- coding: utf-8 -*-
  2 import json
  3 import re
  4 
  5 import scrapy
  6 
  7 from locations.items import GeojsonPointItem
  8 from locations.hours import OpeningHours
  9 
  10 
  11 class PriceRiteSpider(scrapy.Spider):
  12     name = "pricerite"
  13     item_attributes = { 'brand': "PriceRite" }
  14     allowed_domains = ["priceritesupermarkets.com"]
  15 
  16     start_urls = (
  17         "https://www.priceritesupermarkets.com/locations/",
  18     )
  19 
  20     def parse(self, response):
  21         script = response.xpath('//script[contains(text(), "var stores")]').extract_first()
  22         stores = json.loads(re.search(r'var stores = (.*?);', script).groups()[0])
  23 
  24         for store in stores:
  25             properties = {
  26                 "ref": store["storeNumber"],
  27                 "name": store["name"],
  28                 "lat": store["latitude"],
  29                 "lon": store["longitude"],
  30                 "addr_full": store["address1"],
  31                 "city": store["city"],
  32                 "state": store["state"],
  33                 "postcode": store["zipCode"],
  34             }
  35 
  36             yield GeojsonPointItem(**properties)
  37 
  38
  [end of locations/spiders/pricerite.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/pricerite.py b/locations/spiders/pricerite.py
  --- a/locations/spiders/pricerite.py
  +++ b/locations/spiders/pricerite.py
  @@ -5,32 +5,36 @@
   import scrapy
   
   from locations.items import GeojsonPointItem
  -from locations.hours import OpeningHours
   
   
   class PriceRiteSpider(scrapy.Spider):
       name = "pricerite"
       item_attributes = { 'brand': "PriceRite" }
  -    allowed_domains = ["priceritesupermarkets.com"]
  +    allowed_domains = ["priceritemarketplace.com"]
   
       start_urls = (
  -        "https://www.priceritesupermarkets.com/locations/",
  +        "https://www.priceritemarketplace.com/",
       )
   
       def parse(self, response):
  -        script = response.xpath('//script[contains(text(), "var stores")]').extract_first()
  -        stores = json.loads(re.search(r'var stores = (.*?);', script).groups()[0])
  +        script = response.xpath('//script[contains(text(), "__PRELOADED_STATE__")]/text()').extract_first()
  +        script = script[script.index('{'):]
  +        stores = json.loads(script)['stores']['availablePlanningStores']['items']
   
           for store in stores:
  +            ref = store["retailerStoreId"]
               properties = {
  -                "ref": store["storeNumber"],
  +                "ref": ref,
  +                "website": f"https://www.priceritemarketplace.com/sm/planning/rsid/{ref}",
                   "name": store["name"],
  -                "lat": store["latitude"],
  -                "lon": store["longitude"],
  -                "addr_full": store["address1"],
  +                "lat": store["location"]["latitude"],
  +                "lon": store["location"]["longitude"],
  +                "addr_full": store["addressLine1"],
                   "city": store["city"],
  -                "state": store["state"],
  -                "postcode": store["zipCode"],
  +                "state": store["countyProvinceState"],
  +                "postcode": store["postCode"],
  +                "phone": store["phone"],
  +                "opening_hours": store["openingHours"],
               }
   
               yield GeojsonPointItem(**properties)
  
verification_info: {"golden_diff": "diff --git a/locations/spiders/pricerite.py b/locations/spiders/pricerite.py\n--- a/locations/spiders/pricerite.py\n+++ b/locations/spiders/pricerite.py\n@@ -5,32 +5,36 @@\n import scrapy\n \n from locations.items import GeojsonPointItem\n-from locations.hours import OpeningHours\n \n \n class PriceRiteSpider(scrapy.Spider):\n     name = \"pricerite\"\n     item_attributes = { 'brand': \"PriceRite\" }\n-    allowed_domains = [\"priceritesupermarkets.com\"]\n+    allowed_domains = [\"priceritemarketplace.com\"]\n \n     start_urls = (\n-        \"https://www.priceritesupermarkets.com/locations/\",\n+        \"https://www.priceritemarketplace.com/\",\n     )\n \n     def parse(self, response):\n-        script = response.xpath('//script[contains(text(), \"var stores\")]').extract_first()\n-        stores = json.loads(re.search(r'var stores = (.*?);', script).groups()[0])\n+        script = response.xpath('//script[contains(text(), \"__PRELOADED_STATE__\")]/text()').extract_first()\n+        script = script[script.index('{'):]\n+        stores = json.loads(script)['stores']['availablePlanningStores']['items']\n \n         for store in stores:\n+            ref = store[\"retailerStoreId\"]\n             properties = {\n-                \"ref\": store[\"storeNumber\"],\n+                \"ref\": ref,\n+                \"website\": f\"https://www.priceritemarketplace.com/sm/planning/rsid/{ref}\",\n                 \"name\": store[\"name\"],\n-                \"lat\": store[\"latitude\"],\n-                \"lon\": store[\"longitude\"],\n-                \"addr_full\": store[\"address1\"],\n+                \"lat\": store[\"location\"][\"latitude\"],\n+                \"lon\": store[\"location\"][\"longitude\"],\n+                \"addr_full\": store[\"addressLine1\"],\n                 \"city\": store[\"city\"],\n-                \"state\": store[\"state\"],\n-                \"postcode\": store[\"zipCode\"],\n+                \"state\": store[\"countyProvinceState\"],\n+                \"postcode\": store[\"postCode\"],\n+                \"phone\": store[\"phone\"],\n+                \"opening_hours\": store[\"openingHours\"],\n             }\n \n             yield GeojsonPointItem(**properties)\n", "issue": "Spider pricerite is broken\nDuring the global build at 2021-05-26-14-42-23, spider **pricerite** failed with **0 features** and **2 errors**.\n\nHere's [the log](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/logs/pricerite.log) and [the output](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/pricerite.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/pricerite.geojson))\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nimport json\nimport re\n\nimport scrapy\n\nfrom locations.items import GeojsonPointItem\nfrom locations.hours import OpeningHours\n\n\nclass PriceRiteSpider(scrapy.Spider):\n    name = \"pricerite\"\n    item_attributes = { 'brand': \"PriceRite\" }\n    allowed_domains = [\"priceritesupermarkets.com\"]\n\n    start_urls = (\n        \"https://www.priceritesupermarkets.com/locations/\",\n    )\n\n    def parse(self, response):\n        script = response.xpath('//script[contains(text(), \"var stores\")]').extract_first()\n        stores = json.loads(re.search(r'var stores = (.*?);', script).groups()[0])\n\n        for store in stores:\n            properties = {\n                \"ref\": store[\"storeNumber\"],\n                \"name\": store[\"name\"],\n                \"lat\": store[\"latitude\"],\n                \"lon\": store[\"longitude\"],\n                \"addr_full\": store[\"address1\"],\n                \"city\": store[\"city\"],\n                \"state\": store[\"state\"],\n                \"postcode\": store[\"zipCode\"],\n            }\n\n            yield GeojsonPointItem(**properties)\n\n", "path": "locations/spiders/pricerite.py"}]}