internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: alltheplaces/alltheplaces

Issue:
Portillo's
http://www.portillos.com/locations/


Discussion:
```
curl 'http://www.portillos.com/ajax/location/getAllLocations/' \
-X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 's: mjA1AiWID8JqImr3iMoEXFUpeuasRBIglY+FBqETplI=' \
-H 'Accept: application/json, text/plain, */*' \
--data-binary '{"locations":[],"all":"y"}' \
--compressed
```

Resolving patch:
diff --git a/locations/spiders/portillos.py b/locations/spiders/portillos.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/portillos.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+
+from locations.items import GeojsonPointItem
+
+
+class PortillosSpider(scrapy.Spider):
+    name = "portillos"
+    allowed_domains = ["www.portillos.com"]
+    start_urls = (
+        'https://www.portillos.com/locations/',
+    )
+
+    def parse(self, response):
+        yield scrapy.Request(
+            'https://www.portillos.com/ajax/location/getAllLocations/',
+            callback=self.parse_locations,
+            method='POST',
+            body='{"locations":[],"all":"y"}',
+            headers={
+                'Content-Type': 'application/json;charset=UTF-8',
+                'Accept': 'application/json',
+                's': 'mjA1AiWID8JqImr3iMoEXFUpeuasRBIglY+FBqETplI=',
+            }
+        )
+
+    def parse_locations(self, response):
+        data = json.loads(response.body_as_unicode())
+
+        for location in data['locations']:
+            yield scrapy.Request(
+                'https://www.portillos.com/ajax/location/getLocationDetails/?id=%s' % location['Id'],
+                callback=self.parse_store,
+            )
+
+    def parse_store(self, response):
+        store_data = json.loads(response.body_as_unicode())['location']
+
+        properties = {
+            'phone': store_data['Phone'],
+            'website': response.urljoin(store_data['Url']),
+            'ref': store_data['Id'],
+            'name': store_data['Name'],
+            'addr:full': store_data['Address'],
+            'addr:postcode': store_data['Zip'],
+            'addr:state': store_data['State'],
+            'addr:city': store_data['City'],
+        }
+
+        lon_lat = [
+            float(store_data['Lng']),
+            float(store_data['Lat']),
+        ]
+
+        yield GeojsonPointItem(
+            properties=properties,
+            lon_lat=lon_lat,
+        )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Five Guys
http://www.fiveguys.com/Locations


Discussion:

Resolving patch:
diff --git a/locations/spiders/fiveguys.py b/locations/spiders/fiveguys.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/fiveguys.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+
+from locations.items import GeojsonPointItem
+
+
+class FiveguysSpider(scrapy.Spider):
+    name = "fiveguys"
+    allowed_domains = ["www.fiveguys.com"]
+    start_urls = (
+        'http://www.fiveguys.com/5gapi/stores/ByDistance?lat=45.0&lng=-90.0&distance=25000&secondaryDistance=250&lang=en',
+    )
+
+    def parse(self, response):
+        results = json.loads(response.body_as_unicode())
+
+        for data in results:
+            store_data = data['Store']
+
+            properties = {
+                'phone': store_data['PhoneNumber'],
+                'addr:full': store_data['AddressLine1'],
+                'addr:city': store_data['City'],
+                'addr:state': store_data['StateOrProvince'],
+                'addr:postcode': store_data['PostalCode'],
+                'ref': store_data['ClientKey'],
+            }
+
+            lon_lat = [
+                float(store_data['Longitude']),
+                float(store_data['Latitude']),
+            ]
+
+            yield GeojsonPointItem(
+                properties=properties,
+                lon_lat=lon_lat,
+            )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Blue Bottle Coffee
https://bluebottlecoffee.com/cafes


Discussion:
working on this

Resolving patch:
diff --git a/locations/spiders/blue_bottle_cafe.py b/locations/spiders/blue_bottle_cafe.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/blue_bottle_cafe.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+from locations.items import GeojsonPointItem
+
+class BlueBottleCafeSpider(scrapy.Spider):
+
+    name = "bluebottlecafe"
+    allowed_domains = ["www.bluebottlecoffee.com"]
+    start_urls = (
+        'https://bluebottlecoffee.com/api/cafe_search/fetch.json?coordinates=false&query=true&search_value=all',
+    )
+
+    def parse(self, response):
+        results = json.loads(response.body_as_unicode())
+        for region_name in results["cafes"]:
+            for store_data in results["cafes"][region_name]:
+
+                address_string = store_data['address'].replace('\n', ' ').replace('\r', '').replace('<br>', ', ')
+                address_data = address_string.split(", ")
+
+                properties = {
+                    'name': store_data['name'],
+                    'addr:full': address_string,
+                    'addr:city': address_string.split(", ")[1],
+                    'website': store_data['url'],
+                    'ref': store_data['id'],
+                }
+                lon_lat = [
+                    store_data['longitude'],
+                    store_data['latitude'],
+                ]
+
+                yield GeojsonPointItem(
+                    properties=properties,
+                    lon_lat=lon_lat,
+                )
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Marshall's



Discussion:

Resolving patch:
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 @@ def parse(self, response):
 
         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
             )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Super One Foods
http://www.superonefoods.com/store-finder

Regional grocer centered in Duluth, Minnesota


Discussion:
assigning to myself

Resolving patch:
diff --git a/locations/spiders/superonefoods.py b/locations/spiders/superonefoods.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/superonefoods.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+import json
+import scrapy
+import re
+
+from locations.items import GeojsonPointItem
+
+class SuperonefoodsSpider(scrapy.Spider):
+	name = "superonefoods"
+	allowed_domains = ["www.superonefoods.com"]
+	start_urls = (
+		'https://www.superonefoods.com/store-finder',
+	)
+
+	def parse(self, response):
+		# retrieve js data variable from script tag
+		items = response.xpath('//script/text()')[3].re("var stores =(.+?);\n")
+		
+		# convert data variable from unicode to string
+		items = [str(x) for x in items]
+		
+		# convert type string representation of list to type list
+		data = [items[0]]
+		
+		# load list into json object for parsing
+		jsondata = json.loads(data[0])
+
+		# loop through json data object and retrieve values; yield the values to GeojsonPointItem
+		for item in jsondata:
+			properties = {
+				'ref': item.get('_id'),
+				'addr:full': item.get('address'),
+				'addr:city': item.get('city'),
+				'addr:state': item.get('state'),
+				'addr:postcode': item.get('zip'),
+			}
+
+			yield GeojsonPointItem(
+				ref=item.get('_id'),
+				lat=float(item.get('latitude')),
+				lon=float(item.get('longitude')),
+				addr_full=item.get('address'),
+				city=item.get('city'),
+				state=item.get('state'),
+				postcode=item.get('zip'),
+				website='https://www.superonefoods.com/store-details/'+item.get('url'),
+			)
+


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Coastal Farm & Ranch
https://www.coastalfarm.com/locations/


Discussion:
working on this

Resolving patch:
diff --git a/locations/spiders/coastal.py b/locations/spiders/coastal.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/coastal.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+from locations.items import GeojsonPointItem
+
+
+class CoastalFarmSpider(scrapy.Spider):
+
+    name = "coastalfarm"
+    allowed_domains = ["www.coastalfarm.com"]
+    start_urls = (
+        'https://www.coastalfarm.com/wp-admin/admin-ajax.php?action=store_search&lat=45.523062&lng=-122.67648199999996&max_results=25&search_radius=50',
+    )
+
+    def parse(self, response):
+        results = json.loads(response.body_as_unicode())
+        print(results)
+        for data in results:
+            properties = {
+                'city': data['city'],
+                'ref': data['id'],
+                'lon': data['lng'],
+                'lat': data['lat'],
+                'addr_full': data['address'],
+                'phone': data['phone'],
+                'state': data['state'],
+                'postcode': data['zip'],
+                'website': data['url']
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Wilco Farm Stores
https://www.farmstore.com/locations/


Discussion:
working on this

Resolving patch:
diff --git a/locations/spiders/coastal.py b/locations/spiders/coastal.py
--- a/locations/spiders/coastal.py
+++ b/locations/spiders/coastal.py
@@ -14,7 +14,6 @@ class CoastalFarmSpider(scrapy.Spider):
 
     def parse(self, response):
         results = json.loads(response.body_as_unicode())
-        print(results)
         for data in results:
             properties = {
                 'city': data['city'],
diff --git a/locations/spiders/wilco_farm.py b/locations/spiders/wilco_farm.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/wilco_farm.py
@@ -0,0 +1,32 @@
+import json
+import re
+import scrapy
+from locations.items import GeojsonPointItem
+
+class WilcoFarmSpider(scrapy.Spider):
+    name = "wilcofarm"
+    allowed_domains = ["www.farmstore.com"]
+
+    start_urls = (
+        'https://www.farmstore.com/locations/',
+    )
+
+    def parse(self, response):
+        pattern = r"(var markers=\[)(.*?)(\]\;)"
+        data = re.search(pattern, response.body_as_unicode(), re.MULTILINE).group(2)
+        data = json.loads('[' + data + ']')
+        for item in data:
+            properties = {
+                'ref': item['storeId'],
+                'name': item['storeName'],
+                'addr_full': item['storeStreet'],
+                'city': item['storeCity'],
+                'state': item['storeState'],
+                'postcode': item['storeZip'],
+                'lat': item['storeLat'],
+                'lon': item['storeLng'],
+                'phone': item['storePhone'],
+                'opening_hours': item['storeHours']
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Taco Cabana
http://www.tacocabana.com/locator/ mostly Texas and surrounding areas
Taco Cabana
http://www.tacocabana.com/locator/ mostly Texas and surrounding areas


Discussion:

Resolving patch:
diff --git a/locations/spiders/tacocabana.py b/locations/spiders/tacocabana.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/tacocabana.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+import re
+
+from locations.items import GeojsonPointItem
+
+class TacocabanaSpider(scrapy.Spider):
+    name = "tacocabana"
+    allowed_domains = ["www.tacocabana.com"]
+    start_urls = (
+        "http://www.tacocabana.com/wp-admin/admin-ajax.php?action=get_ajax_processor&processor=get-locations&queryType=&postID=816",
+    )
+        
+    def parse(self, response):
+        data = json.loads(re.sub(r"\s<.*?>.*<.*?>\s", "", response.body_as_unicode()))
+
+        for store in data:
+            properties = {
+                "phone"         : store["phone_number"],
+                "ref"           : str(store["locator_store_number"]),
+                "name"          : store["post_title"],
+                "opening_hours" : store["hours"],
+                "website"       : store["permalink"],
+                "lat"           : store["x_coordinate"],
+                "lon"           : store["y_coordinate"],
+                "street"        : store["street_address_1"] + store["street_address_2"],
+                "city"          : store["city"],
+                "state"         : store["state"],
+                "postcode"      : store["zip_code"]
+            }
+            
+            yield GeojsonPointItem(**properties)
+        
+        else:
+            self.logger.info("No results")
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Kohl's
http://www.kohls.com/stores.shtml


Discussion:

Resolving patch:
diff --git a/locations/spiders/kohls.py b/locations/spiders/kohls.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/kohls.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+import re
+import scrapy
+
+from locations.items import GeojsonPointItem
+
+
+class KohlsSpider(scrapy.Spider):
+
+    name = "kohls"
+    download_delay = 1.5
+    allowed_domains = ["www.kohls.com"]
+    start_urls = (
+        'https://www.kohls.com/stores.shtml',
+    )
+
+    def parse_stores(self, response):
+        opening_hours = re.findall(r'"openingHours": "([.||\t|\n|A-Z|a-z|\-|0-9|:|\s]+)', response.text)
+        hours = ''
+        if opening_hours:
+            for osm in opening_hours:
+                hours = osm.split('\n')
+                hours = "; ".join([hour.replace(':', '').replace(' - ', '-') for hour in hours if hour])
+
+        properties = {
+            'addr_full': response.xpath('//div[@id="mainAddrLine1"]/text()').extract_first(),
+            'phone': response.xpath('//div[@class="indy-big-map-phone"]/text()').extract_first(),
+            'city': response.xpath('//meta[@name="city"]/@content').extract_first(),
+            'state': response.xpath('//meta[@name="state"]/@content').extract_first(),
+            'postcode': response.xpath('//meta[@name="zip"]/@content').extract_first(),
+            'name': response.xpath('//div[@class="location-header"]/text()').extract_first(),
+            'website': response.url,
+            'lat': float(re.findall(r'"latitude": "([-\d]+\.[\d]+)"', response.text)[0]),
+            'lon': float(re.findall(r'"longitude": "([-\d]+\.[\d]+)"', response.text)[0]),
+            'ref': response.url,
+            'opening_hours': hours
+        }
+
+        return GeojsonPointItem(**properties)
+
+    def parse_city_stores(self, response):
+        stores = response.xpath('//span[@class="location-title"]/a/@href').extract()
+        for store in stores:
+            yield scrapy.Request(response.urljoin(store), callback=self.parse_stores)
+
+    def parse_state(self, response):
+        city_urls = response.xpath('//a[@class="citylist"]/@href').extract()
+        for path in city_urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_city_stores)
+
+    def parse(self, response):
+        urls = response.xpath('//a[@class="regionlist"]/@href').extract()
+        for path in urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_state)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
&pizza
You have to click the Locations link on the right, no direct link that I can find http://www.andpizza.com
&pizza
You have to click the Locations link on the right, no direct link that I can find http://www.andpizza.com


Discussion:

Resolving patch:
diff --git a/locations/spiders/andpizza.py b/locations/spiders/andpizza.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/andpizza.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+
+from locations.items import GeojsonPointItem
+
+
+class TacocabanaSpider(scrapy.Spider):
+    name = 'andpizza'
+    allowed_domains = ['andpizza.com']
+    start_urls = (
+        'https://andpizza.com',
+    )
+
+    def normalize_time(sef, time_str):
+        match = re.search(r'([0-9]{1,2}) (a|p)m$', time_str)
+        if not match:
+            match = re.search(r'([0-9]{1,2})(a|p)m$', time_str)
+            h, am_pm = match.groups()
+        else:
+            h, am_pm = match.groups()
+
+        return '%02d:%02d' % (
+            int(h) + 12 if am_pm == 'p.' else int(h),
+            int('0'),
+        )
+        return ''
+
+    def hours(self, data):
+        opening_hours = ''
+        
+        if '&bar' in data:
+            data = data[:data.index('&bar')]
+        
+        for i in range(len(data)//2):
+            days = data[i*2].split(' ')
+            hours = data[i*2+1]
+            if len(days) == 1:
+                day = days[0][:2]
+            elif len(days) == 3:
+                day = days[0][:2] + '-' + days[2][:2]
+            else:
+                day = 'Mo-Su'
+
+            hours = hours.split('-')
+            open = self.normalize_time(hours[0].strip())
+            close = self.normalize_time(hours[1].strip())
+            
+            open_close = '{}-{}'.format(
+                open,
+                close
+            )
+
+            opening_hours += '{} {}; '.format(
+                day,
+                open_close
+            )
+        
+        return opening_hours
+
+    def parse(self, response):
+        selector = scrapy.Selector(response)
+        stores = selector.css('div.location')
+
+        for store in stores:
+            ref = store.css('div.location::attr(class)').extract_first().split(' ')[1]
+            name = store.css('a.knockout *::text').extract_first()
+            address = store.css('address>a *::text').extract()
+            address1 = address[0]
+            address2 = address[len(address)-1].split(',')
+            hours = store.css('div.hours')
+
+            store_hours = ''
+            if not hours.css('span>a'):
+                store_hours = self.hours(store.css('div.hours *::text').extract())
+
+            properties = {
+                'ref': ref,
+                'name': name,
+                'street': address1,
+                'city': address2[0],
+                'state': address2[1].split(' ')[1],
+                'postcode': address2[1].split(' ')[2],
+                'opening_hours': store_hours,
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
The Beer Store
http://www.thebeerstore.ca/locations
The Beer Store
http://www.thebeerstore.ca/locations


Discussion:
Started working on this issue.
Started working on this issue.

Resolving patch:
diff --git a/locations/spiders/beer_store.py b/locations/spiders/beer_store.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/beer_store.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+
+from locations.items import GeojsonPointItem
+
+
+class BeerStoreSpider(scrapy.Spider):
+
+    name = "beer_store"
+    allowed_domains = ["www.thebeerstore.ca/"]
+    start_urls = (
+        'http://www.thebeerstore.ca/storelocations.json',
+    )
+
+    def parse(self, response):
+        results = json.loads(response.body_as_unicode())
+        features = results["features"]
+        for data in features:
+            description = data['properties']['description']
+            end_str = "<a href"
+            properties = {
+                'ref': data['properties']['storeid'],
+                'lon': data['geometry']['coordinates'][0],
+                'lat': data['geometry']['coordinates'][1],
+                'name': data['properties']['name'],
+                'addr_full': description[:description.find(end_str)]
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Beacon & Bridge Market
http://www.beaconandbridge.com/locations/
Beacon & Bridge Market
http://www.beaconandbridge.com/locations/


Discussion:
started working on this
started working on this

Resolving patch:
diff --git a/locations/spiders/beacon_bridge_market.py b/locations/spiders/beacon_bridge_market.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/beacon_bridge_market.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+import traceback
+
+from locations.items import GeojsonPointItem
+
+URL = 'http://www.beaconandbridge.com/wp-admin/admin-ajax.php'
+HEADERS = {
+           'Accept-Language': 'en-US,en;q=0.9,ru;q=0.6',
+           'Origin': 'http://www.beaconandbridge.com',
+           'Accept-Encoding': 'gzip, deflate, br',
+           'Accept': 'application/json, text/plain, */*',
+           'Referer': 'http://www.beaconandbridge.com/locations/',
+           'Connection': 'keep-alive',
+           'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
+           }
+class BeaconAndBridgeSpider(scrapy.Spider):
+
+    name = "beacon_and_bridge"
+    allowed_domains = ["www.beaconandbridge.com/"]
+
+    def start_requests(self):
+        form_data = {'formdata': 'addressInput=', 'lat': '43.0142978', 'lng': '-83.68935469999997', 'radius': '10000', 'action': 'csl_ajax_onload' }
+
+        yield scrapy.http.FormRequest(url=URL, method='POST', formdata=form_data,
+                                          headers=HEADERS, callback=self.parse)
+                                          
+    def parse(self, response):
+        results = json.loads(response.body_as_unicode())
+        for data in results['response']:
+            properties = {
+                'ref': data['id'],
+                'name': data['name'],
+                'lat': data['lat'],
+                'lon': data['lng'],
+                'addr_full': data['address'],
+                'city': data['city'],
+                'state': data['state'],
+                'postcode': data['zip'],
+                'country': data['country'],
+                'phone': data['phone'],
+                'website': data['url'],
+
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch: