prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Marshall's
  
  
  </issue>
  <code>
  [start of locations/spiders/marshalls.py]
  1 import json
  2 import re
  3 import scrapy
  4 from locations.items import GeojsonPointItem
  5 
  6 STATES = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA",
  7           "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
  8           "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
  9           "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
  10           "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"]
  11 
  12 DAYS = {'Mon': 'Mo', 'Tue': 'Tu',
  13         'Wed': 'We', 'Thu': 'Th',
  14         'Fri': 'Fr', 'Sat': 'Sa',
  15         'Sun': 'Su'}
  16 
  17 URL = 'https://mktsvc.tjx.com/storelocator/GetSearchResultsByState'
  18 
  19 
  20 def normalize_time(hours):
  21 
  22     if not hours:
  23       return ''
  24 
  25     day_times = hours.split(',')
  26     normalize_day_times = []
  27 
  28     for day_time in day_times:
  29         day, hours = [x.strip() for x in day_time.split(': ')]
  30         normalize_hours = []
  31 
  32         if re.search('-', day):
  33             days = [x.strip() for x in day.split('-')]
  34             norm_days = '-'.join([DAYS.get(x, '') for x in days])
  35         else:
  36             norm_days = DAYS.get(day, '')
  37 
  38         if re.search('CLOSED', hours):
  39             norm_hours = ' off'
  40             normalize_hours.append(norm_hours)
  41         else:
  42             if re.search('-', hours):
  43                 hours = [x.strip() for x in hours.split('-')]
  44 
  45                 for hour in hours:
  46 
  47                     if hour[-1] == 'p':
  48                         if re.search(':', hour[:-1]):
  49                             hora, minute = [x.strip() for x in hour[:-1].split(':')]
  50                             if int(hora) < 12:
  51                                 norm_hours = str(int(hora) + 12) + ':' + minute
  52                         else:
  53                             if int(hour[:-1]) < 12:
  54                                 norm_hours = str(int(hour[:-1]) + 12) + ":00"
  55 
  56                     elif hour[-1] == 'a':
  57                         if re.search(':', hour[:-1]):
  58                             hora, minute = [x.strip() for x in hour[:-1].split(':')]
  59                             norm_hours = hora + ':' + minute
  60                         else:
  61                             norm_hours = hour[:-1] + ":00"
  62 
  63                     normalize_hours.append(norm_hours)
  64 
  65         normalize_day_times.append(' '.join([norm_days, '-'.join(normalize_hours)]))
  66     return '; '.join(normalize_day_times)
  67 
  68 
  69 class MarshallsSpider(scrapy.Spider):
  70 
  71     name = "marshalls"
  72     allowed_domains = ["mktsvc.tjx.com", 'www.marshallsonline.com']
  73 
  74     def start_requests(self):
  75         url = URL
  76 
  77         headers = {
  78                    'Accept-Language': 'en-US,en;q=0.8,ru;q=0.6',
  79                    'Origin': 'https://www.marshallsonline.com',
  80                    'Accept-Encoding': 'gzip, deflate, br',
  81                    'Accept': 'application/json, text/plain, */*',
  82                    'Referer': 'https://www.marshallsonline.com/store-finder/by-state',
  83                    'Connection': 'keep-alive',
  84                    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
  85                    }
  86 
  87         for state in STATES:
  88             form_data = {'chain': '10', 'lang': 'en', 'state': state}
  89 
  90             yield scrapy.http.FormRequest(url=url, method='POST', formdata=form_data,
  91                                           headers=headers, callback=self.parse)
  92 
  93     def parse(self, response):
  94 
  95         data = json.loads(response.body_as_unicode())
  96         stores = data.get('Stores', None)
  97 
  98         for store in stores:
  99             lon_lat = [store.pop('Longitude', None), store.pop('Latitude', None)]
  100             store['ref'] = URL + str(store.get('StoreID', None))
  101 
  102             opening_hours = normalize_time(store.get('Hours', ''))
  103 
  104             if opening_hours:
  105                 store['opening_hours'] = opening_hours
  106                 store.pop('Hours', None)
  107 
  108             yield GeojsonPointItem(
  109                 properties=store,
  110                 lon_lat=lon_lat
  111             )
  112
  [end of locations/spiders/marshalls.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/marshalls.py b/locations/spiders/marshalls.py
  --- a/locations/spiders/marshalls.py
  +++ b/locations/spiders/marshalls.py
  @@ -17,10 +17,20 @@
   URL = 'https://mktsvc.tjx.com/storelocator/GetSearchResultsByState'
   
   
  +NORMALIZE_KEYS = (
  +                    ('addr:full', ['Address', 'Address2']),
  +                    ('addr:city', ['City']),
  +                    ('addr:state', ['State']),
  +                    ('addr:postcode', ['Zip']),
  +                    ('addr:country', ['Country']),
  +                    ('phone', ['Phone']),
  +                 )
  +
  +
   def normalize_time(hours):
   
       if not hours:
  -      return ''
  +        return ''
   
       day_times = hours.split(',')
       normalize_day_times = []
  @@ -94,18 +104,23 @@
   
           data = json.loads(response.body_as_unicode())
           stores = data.get('Stores', None)
  +        props = {}
   
           for store in stores:
  -            lon_lat = [store.pop('Longitude', None), store.pop('Latitude', None)]
  -            store['ref'] = URL + str(store.get('StoreID', None))
  +            lon_lat = [store.pop('Longitude', ''), store.pop('Latitude', None)]
  +            props['ref'] = store.pop('StoreID', None)
  +            props['website'] = URL
  +
  +            for new_key, old_keys in NORMALIZE_KEYS:
  +                props[new_key] = ", ".join([store.pop(key, '').strip() for key in old_keys if store[key]])
   
  -            opening_hours = normalize_time(store.get('Hours', ''))
  +            opening_hours = normalize_time(store.pop('Hours', ''))
   
               if opening_hours:
  -                store['opening_hours'] = opening_hours
  -                store.pop('Hours', None)
  +                props['opening_hours'] = opening_hours
  +                props.pop('Hours', None)
   
               yield GeojsonPointItem(
  -                properties=store,
  +                properties=props,
                   lon_lat=lon_lat
               )
  
verification_info: {"golden_diff": "diff --git a/locations/spiders/marshalls.py b/locations/spiders/marshalls.py\n--- a/locations/spiders/marshalls.py\n+++ b/locations/spiders/marshalls.py\n@@ -17,10 +17,20 @@\n URL = 'https://mktsvc.tjx.com/storelocator/GetSearchResultsByState'\n \n \n+NORMALIZE_KEYS = (\n+                    ('addr:full', ['Address', 'Address2']),\n+                    ('addr:city', ['City']),\n+                    ('addr:state', ['State']),\n+                    ('addr:postcode', ['Zip']),\n+                    ('addr:country', ['Country']),\n+                    ('phone', ['Phone']),\n+                 )\n+\n+\n def normalize_time(hours):\n \n     if not hours:\n-      return ''\n+        return ''\n \n     day_times = hours.split(',')\n     normalize_day_times = []\n@@ -94,18 +104,23 @@\n \n         data = json.loads(response.body_as_unicode())\n         stores = data.get('Stores', None)\n+        props = {}\n \n         for store in stores:\n-            lon_lat = [store.pop('Longitude', None), store.pop('Latitude', None)]\n-            store['ref'] = URL + str(store.get('StoreID', None))\n+            lon_lat = [store.pop('Longitude', ''), store.pop('Latitude', None)]\n+            props['ref'] = store.pop('StoreID', None)\n+            props['website'] = URL\n+\n+            for new_key, old_keys in NORMALIZE_KEYS:\n+                props[new_key] = \", \".join([store.pop(key, '').strip() for key in old_keys if store[key]])\n \n-            opening_hours = normalize_time(store.get('Hours', ''))\n+            opening_hours = normalize_time(store.pop('Hours', ''))\n \n             if opening_hours:\n-                store['opening_hours'] = opening_hours\n-                store.pop('Hours', None)\n+                props['opening_hours'] = opening_hours\n+                props.pop('Hours', None)\n \n             yield GeojsonPointItem(\n-                properties=store,\n+                properties=props,\n                 lon_lat=lon_lat\n             )\n", "issue": "Marshall's\n\n", "before_files": [{"content": "import json\nimport re\nimport scrapy\nfrom locations.items import GeojsonPointItem\n\nSTATES = [\"AL\", \"AK\", \"AZ\", \"AR\", \"CA\", \"CO\", \"CT\", \"DC\", \"DE\", \"FL\", \"GA\",\n          \"HI\", \"ID\", \"IL\", \"IN\", \"IA\", \"KS\", \"KY\", \"LA\", \"ME\", \"MD\",\n          \"MA\", \"MI\", \"MN\", \"MS\", \"MO\", \"MT\", \"NE\", \"NV\", \"NH\", \"NJ\",\n          \"NM\", \"NY\", \"NC\", \"ND\", \"OH\", \"OK\", \"OR\", \"PA\", \"RI\", \"SC\",\n          \"SD\", \"TN\", \"TX\", \"UT\", \"VT\", \"VA\", \"WA\", \"WV\", \"WI\", \"WY\"]\n\nDAYS = {'Mon': 'Mo', 'Tue': 'Tu',\n        'Wed': 'We', 'Thu': 'Th',\n        'Fri': 'Fr', 'Sat': 'Sa',\n        'Sun': 'Su'}\n\nURL = 'https://mktsvc.tjx.com/storelocator/GetSearchResultsByState'\n\n\ndef normalize_time(hours):\n\n    if not hours:\n      return ''\n\n    day_times = hours.split(',')\n    normalize_day_times = []\n\n    for day_time in day_times:\n        day, hours = [x.strip() for x in day_time.split(': ')]\n        normalize_hours = []\n\n        if re.search('-', day):\n            days = [x.strip() for x in day.split('-')]\n            norm_days = '-'.join([DAYS.get(x, '') for x in days])\n        else:\n            norm_days = DAYS.get(day, '')\n\n        if re.search('CLOSED', hours):\n            norm_hours = ' off'\n            normalize_hours.append(norm_hours)\n        else:\n            if re.search('-', hours):\n                hours = [x.strip() for x in hours.split('-')]\n\n                for hour in hours:\n\n                    if hour[-1] == 'p':\n                        if re.search(':', hour[:-1]):\n                            hora, minute = [x.strip() for x in hour[:-1].split(':')]\n                            if int(hora) < 12:\n                                norm_hours = str(int(hora) + 12) + ':' + minute\n                        else:\n                            if int(hour[:-1]) < 12:\n                                norm_hours = str(int(hour[:-1]) + 12) + \":00\"\n\n                    elif hour[-1] == 'a':\n                        if re.search(':', hour[:-1]):\n                            hora, minute = [x.strip() for x in hour[:-1].split(':')]\n                            norm_hours = hora + ':' + minute\n                        else:\n                            norm_hours = hour[:-1] + \":00\"\n\n                    normalize_hours.append(norm_hours)\n\n        normalize_day_times.append(' '.join([norm_days, '-'.join(normalize_hours)]))\n    return '; '.join(normalize_day_times)\n\n\nclass MarshallsSpider(scrapy.Spider):\n\n    name = \"marshalls\"\n    allowed_domains = [\"mktsvc.tjx.com\", 'www.marshallsonline.com']\n\n    def start_requests(self):\n        url = URL\n\n        headers = {\n                   'Accept-Language': 'en-US,en;q=0.8,ru;q=0.6',\n                   'Origin': 'https://www.marshallsonline.com',\n                   'Accept-Encoding': 'gzip, deflate, br',\n                   'Accept': 'application/json, text/plain, */*',\n                   'Referer': 'https://www.marshallsonline.com/store-finder/by-state',\n                   'Connection': 'keep-alive',\n                   'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n                   }\n\n        for state in STATES:\n            form_data = {'chain': '10', 'lang': 'en', 'state': state}\n\n            yield scrapy.http.FormRequest(url=url, method='POST', formdata=form_data,\n                                          headers=headers, callback=self.parse)\n\n    def parse(self, response):\n\n        data = json.loads(response.body_as_unicode())\n        stores = data.get('Stores', None)\n\n        for store in stores:\n            lon_lat = [store.pop('Longitude', None), store.pop('Latitude', None)]\n            store['ref'] = URL + str(store.get('StoreID', None))\n\n            opening_hours = normalize_time(store.get('Hours', ''))\n\n            if opening_hours:\n                store['opening_hours'] = opening_hours\n                store.pop('Hours', None)\n\n            yield GeojsonPointItem(\n                properties=store,\n                lon_lat=lon_lat\n            )\n", "path": "locations/spiders/marshalls.py"}]}