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

Issue:
Potbelly Sandwich Shop
http://www.potbelly.com/Shops/ShopLocator.aspx
Potbelly Sandwich Shop
http://www.potbelly.com/Shops/ShopLocator.aspx
Potbelly Sandwich Shop
http://www.potbelly.com/Shops/ShopLocator.aspx


Discussion:
working on this
working on this
working on this

Resolving patch:
diff --git a/locations/spiders/potbelly_sandwichshop.py b/locations/spiders/potbelly_sandwichshop.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/potbelly_sandwichshop.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+import re
+
+from locations.items import GeojsonPointItem
+
+
+class PotbellySandwichSpider(scrapy.Spider):
+
+    name = "potbelly_sandwich"
+    allowed_domains = ["www.potbelly.com"]
+    start_urls = (
+        'https://www.potbelly.com/dist/main.js',
+    )
+
+    def parse(self, response):
+        results = response.body_as_unicode()
+        sub_str = find_between(results, 'staticLocations=', "shown:!0}}]}")
+        js_obj = sub_str + "shown:!0}}]"
+        js_obj = js_obj.replace('!0', 'true')
+        js_obj = js_obj.replace('!1', 'false')
+        js_obj = js_obj.replace(',hours:', ',"hours":')
+        js_obj = js_obj.replace('\\r\\n', '; ')
+        js_obj = re.sub(r'(-?[a-zA-Z]+):(\d{1,2}:)', r'\1: \2', js_obj)
+        cleaner_js = re.sub(r'([a-z_]+):([^/ ])', r'"\1":\2', js_obj)
+        locations = json.loads(cleaner_js)
+
+        for data in locations:
+            properties = {
+                'ref': data['location']['id'],
+                'name': data['location']['name'],
+                'lat': data['location']['latitude'],
+                'lon': data['location']['longitude'],
+                'addr_full': data['location']['street_address'],
+                'city': data['location']['locality'],
+                'state': data['location']['region'],
+                'postcode': data['location']['postal_code'],
+                'phone': data['location']['phone'],
+                'website': data['location']['facebook_url'],
+                'opening_hours': data['location']['hours']
+            }
+
+            yield GeojsonPointItem(**properties)
+
+
+def find_between(s, first, last):
+    try:
+        start = s.index(first) + len(first)
+        end = s.index(last, start)
+        return s[start:end]
+    except ValueError:
+        return ""


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Northern California Breweries
http://projects.sfchronicle.com/2017/brewery-map/


Discussion:

Resolving patch:
diff --git a/locations/spiders/northern_california_breweries.py b/locations/spiders/northern_california_breweries.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/northern_california_breweries.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+import json
+import re
+
+class NorthernCaliforniaBreweriesSpider(scrapy.Spider):
+    name = "northern_california_breweries"
+    allowed_domains = ["projects.sfchronicle.com"]
+    start_urls = (
+        'http://projects.sfchronicle.com/2017/brewery-map/',
+    )
+
+    def parse(self, response):
+      beerData = response.xpath("//*[text()[contains(.,'beerData')]]").extract_first()
+      matches = re.search("var beerData = (\[(.*)\])", beerData)
+      jsonData = matches.group(0).replace("var beerData = ","")
+      breweryList = json.loads(jsonData)
+
+      for item in breweryList:
+        yield GeojsonPointItem(
+          ref=item.get('Brewery'),
+          lat=float(item.get('Latitude')),
+          lon=float(item.get('Longitude')),
+          addr_full=item.get('Address'),
+          city=item.get('City'),
+          state="CA",
+          website=item.get('Website'),
+        )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
In-N-Out Burger
http://www.in-n-out.com/locations


Discussion:
locations here: https://github.com/dalekunce/in-n-out

maproulette task here: http://maproulette.org/map/433
I can take this one @nvkelso

Resolving patch:
diff --git a/locations/spiders/innout.py b/locations/spiders/innout.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/innout.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+
+
+class TemplateSpider(scrapy.Spider):
+    name = "innout"
+
+    allowed_domains = ["www.in-n-out.com"]
+    start_urls = ['http://locations.in-n-out.com/api/finder/search/?showunopened=false&latitude='
+                  '37.751&longitude=-97.822&maxdistance=3050&maxresults=2500']
+
+    def parse(self, response):
+        # testing
+        response.selector.remove_namespaces()
+
+        for store_elem in response.xpath('//LocationFinderStore'):
+            city = store_elem.xpath('./City/text()').extract_first()
+            lat = store_elem.xpath('./Latitude/text()').extract_first()
+            lon = store_elem.xpath('./Longitude/text()').extract_first()
+            ref = store_elem.xpath('./StoreNumber/text()').extract_first()
+            addr_full = store_elem.xpath('./StreetAddress/text()').extract_first()
+            zipcode = store_elem.xpath('./ZipCode/text()').extract_first()
+            state = store_elem.xpath('./State/text()').extract_first()
+            name = store_elem.xpath('./Name/text()').extract_first()
+
+            properties = {
+                'name': name,
+                'addr_full': addr_full,
+                'city': city,
+                'state': state,
+                'postcode': zipcode,
+                'ref': ref,
+                'website': 'http://locations.in-n-out.com/' + ref,
+                'lon': float(lon),
+                'lat': float(lat),
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Panda Express
https://www.pandaexpress.com/userlocation


Discussion:
On it

Resolving patch:
diff --git a/locations/spiders/pandaexpress.py b/locations/spiders/pandaexpress.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/pandaexpress.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from scrapy.http import Request
+import json
+from locations.items import GeojsonPointItem
+
+
+class PandaSpider(scrapy.Spider):
+    name = "pandaexpress"
+    allowed_domains = ["inkplant.com", "pandaexpress.com"]
+    start_urls = ['https://inkplant.com/code/state-latitudes-longitudes']
+
+    def parse(self, response):
+
+        # Get all state names to search for Panda Express
+        sname = response.xpath("//tr//td[1]/text()").extract()[1:]
+        # Add Puerto Rico
+        sname.append("Puerto Rico")
+
+        # Iterate through each state to locate Panda Express Locations
+        for state in sname:
+
+            state_url = "https://www.pandaexpress.com/userlocation/searchbyquery?query="+state+\
+                        "&limit=1000&hours=true&_=1512680879964"
+
+            # parse and return relevant location information
+            yield Request(state_url, callback=self.parseState)
+
+    def parseState(self, response):
+        state_data = json.loads(response.body_as_unicode())
+
+        for store in state_data:
+            properties = {
+                'addr_full': store['Address'],
+                'city': store["City"],
+                'state': store['State'],
+                'postcode': store['Zip'].strip(),
+                'ref': store['Id'],
+                'lon': float(store['Longitude']),
+                'lat': float(store['Latitude']),
+                'phone': store['Phone']
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Crown Burgers
http://www.crown-burgers.com/locations.php


Discussion:
Can I take this?

Resolving patch:
diff --git a/locations/spiders/crown_burgers.py b/locations/spiders/crown_burgers.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/crown_burgers.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+import re
+
+from locations.items import GeojsonPointItem
+
+STATES = {
+        'Utah': 'UT',
+       }
+
+class CrownburgerSpider(scrapy.Spider):
+    name = "crown_burgers"
+    allowed_domains = ["crown-burgers.com","maps.google.com"]
+    start_urls = (
+        'http://www.crown-burgers.com/locations.php',
+    )
+
+    def parse(self, response):
+        shops = response.xpath('//div[@id="right_frame"]/p')
+        for shop in range(1,len(shops)+1,2):
+            position_data=shops.xpath('(//p)['+str(shop+1)+']/iframe/@src')
+            address2=re.match(r'(.{3,})(,|\W)(\w+) (\d{5})',shops.xpath('(//p)['+str(shop+1)+']/text()').extract()[1])
+
+            yield scrapy.Request(position_data.extract_first(), callback=self.parse_store,meta={
+                'shop':shops.xpath('(//p)['+str(shop)+']/text()').extract_first(),
+                'address':shops.xpath('(//p)['+str(shop+1)+']/text()').extract()[0],
+                'phone':shops.xpath('(//p)['+str(shop+1)+']/text()').extract()[2],
+                'city':address2.group(1).rstrip(','),
+                'state':STATES[address2.group(3)],
+                'postcode':address2.group(4),
+                })
+
+    def parse_store(self, response): 
+            pos=json.loads(re.search(r'initEmbed\((.*)\);',response.xpath('//script').extract()[2]).groups()[0])[21][3][0][2]
+            yield GeojsonPointItem(
+                lat=float(pos[0]),
+                lon=float(pos[1]),
+                phone=response.meta.get('phone'),
+                website=self.start_urls[0],
+                ref=response.meta.get('shop'),
+                opening_hours='Mo-Sa 10:00-22:30', #no data about each shop
+                addr_full=response.meta.get('address'),
+                city=response.meta.get('city'),
+                state=response.meta.get('state'),
+                postcode=response.meta.get('postcode'),
+                country='US', 
+            )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
La Salsa
http://lasalsa.com/locations/


Discussion:
Search engine. Uses Google's geocoder to convert the search string to a lat/lon, then fetches:
```http://lasalsa.com/wp-content/themes/lasalsa-main/locations-search.php?lat=<lat>&lng=<lng>&radius=50```
Apparently has no limit to the radius, so http://lasalsa.com/wp-content/themes/lasalsa-main/locations-search.php?lat=0&lng=0&radius=99999999 will give you all stores!

Resolving patch:
diff --git a/locations/spiders/la_salsa.py b/locations/spiders/la_salsa.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/la_salsa.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+import scrapy
+
+from locations.items import GeojsonPointItem
+
+
+class LaSalsaSpider(scrapy.Spider):
+    name = "la_salsa"
+    allowed_domains = ["www.lasalsa.com"]
+    start_urls = (
+        'http://lasalsa.com/wp-content/themes/lasalsa-main/locations-search.php?lat=0&lng=0&radius=99999999',
+    )
+
+    def parse(self, response):
+        for match in response.xpath("//markers/marker"):
+            yield GeojsonPointItem(
+                ref=match.xpath('.//@name').extract_first(),
+                lat=float(match.xpath('.//@latitude').extract_first()),
+                lon=float(match.xpath('.//@longitude').extract_first()),
+                addr_full=match.xpath('.//@address').extract_first(),
+                city=match.xpath('.//@city').extract_first(),
+                state=match.xpath('.//@state').extract_first(),
+                postcode=match.xpath('.//@zip').extract_first(),
+                phone=match.xpath('.//@phone').extract_first(),
+            )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Shoney's
http://batchgeo.com/map/b317db15b42986919f24bff19465e039

(this is literally what they link to from their homepage)


Discussion:

Resolving patch:
diff --git a/locations/spiders/shoneys.py b/locations/spiders/shoneys.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/shoneys.py
@@ -0,0 +1,35 @@
+import json
+import re
+import scrapy
+from locations.items import GeojsonPointItem
+
+keymap = {
+    'addr_full': 'a',
+    'city': 'c',
+    'state': 's',
+    'postcode': 'z',
+    'name': 't',
+    'lat': 'lt',
+    'lon': 'ln',
+}
+
+class ShoneysSpider(scrapy.Spider):
+    name = "shoneys"
+    allowed_domains = ["static.batchgeo.com"]
+    start_urls = (
+        'https://static.batchgeo.com/map/json/b317db15b42986919f24bff19465e039/1482130242',
+    )
+
+    def parse(self, response):
+        body = response.body_as_unicode()[6:-1]
+        data = json.loads(body)
+        stores = data['mapRS']                            
+        properties = {}
+        for store in stores:                                 
+            for key1, key2 in keymap.items():
+                if key2 in store and store[key2]:
+                    properties[key1] = store[key2]
+
+            properties['ref'] = properties['addr_full']
+                
+            yield GeojsonPointItem(**properties)             


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Anthony's Restaurants
https://www.anthonys.com/restaurants/


Discussion:
If I go to https://www.anthonys.com/restaurants/locations/ it retrieves https://www.anthonys.com/restaurants/search/47.6062095/-122.3320708/2000 (XML format).

Resolving patch:
diff --git a/locations/spiders/anthonys_restaurants.py b/locations/spiders/anthonys_restaurants.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/anthonys_restaurants.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+
+class AnthonysRestaurantsSpiders(scrapy.Spider):
+    name = "anthonys_restaurants"
+    allowed_domains = ["www.anthonys.com"]
+    start_urls = (
+        'https://www.anthonys.com/restaurants/search/47.6062095/-122.3320708/2000',
+    )
+
+    def parse(self, response):
+        for match in response.xpath("//markers/marker"):
+            fullAddress=match.xpath('.//@address').extract_first().replace('<br />', ',')
+            print(fullAddress)
+            #Accounts for cases with second address line
+            if(len(fullAddress.split(",")) == 4):
+                cityString = fullAddress.split(",")[2].strip()
+                stateString = fullAddress.split(",")[3].strip().split(" ")[0].strip()
+                postString = fullAddress.split(",")[3].strip().split(" ")[1].strip()
+                addrLineOne = fullAddress.split(",")[0].strip()
+                addrLineTwo = fullAddress.split(",")[1].strip()
+                addrString = addrLineOne + ", " + addrLineTwo
+            else:
+                cityString = fullAddress.split(",")[1].strip()
+                stateString = fullAddress.split(",")[2].strip().split(" ")[0].strip()
+                postString = fullAddress.split(",")[2].strip().split(" ")[1].strip()
+                addrString = fullAddress.split(",")[0]
+
+            yield GeojsonPointItem(
+              ref=match.xpath('.//@title').extract_first().strip(),
+              lat=match.xpath('.//@lat').extract_first().strip(),
+              lon=match.xpath('.//@lng').extract_first().strip(),
+              addr_full=addrString,
+              city=cityString,
+              state=stateString,
+              postcode=postString,
+              phone=match.xpath('.//@phone').extract_first().replace(" ",""),
+            )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Hostelling International
https://www.hihostels.com/explore


Discussion:

Resolving patch:
diff --git a/locations/spiders/hihostels.py b/locations/spiders/hihostels.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/hihostels.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+
+from locations.items import GeojsonPointItem
+
+
+class HiHostelsSpider(scrapy.Spider):
+    name = "hihostels"
+    allowed_domains = ['hihostels.com']
+    start_urls = (
+        'https://www.hihostels.com/sitemap.xml',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//url/loc/text()').extract()
+        regex = re.compile(r'http\S+hihostels.com/\S+/hostels/\S+')
+        for path in city_urls:
+            if not re.search(regex,path):
+                pass
+            else:
+                yield scrapy.Request(
+                    path.strip(),
+                    callback=self.parse_store,
+                )
+
+    def parse_store(self, response):
+
+        properties = {
+            'name': " ".join(response.xpath('/html/body/div[1]/div[6]/div[2]/div[1]/h1/span/text()').extract()[0].split()),
+            'ref': " ".join(response.xpath('/html/body/div[1]/div[6]/div[2]/div[1]/h1/span/text()').extract()[0].split()),
+            'addr_full': " ".join(response.xpath('/html/body/div[1]/div[6]/div[2]/div[1]/div[2]/p[1]/text()').extract()[0].split(',')[0].split()),
+            'city': " ".join(response.xpath('/html/body/div[1]/div[6]/div[2]/div[1]/div[2]/p[1]/text()').extract()[0].split(',')[1].split()),
+            'postcode': " ".join(response.xpath('/html/body/div[1]/div[6]/div[2]/div[1]/div[2]/p[1]/text()').extract()[0].split(',')[-2].split()),
+            'country': " ".join(response.xpath('/html/body/div[1]/div[6]/div[2]/div[1]/div[2]/p[1]/text()').extract()[0].split(',')[-1].split()),
+            'website': response.xpath('//head/link[@rel="canonical"]/@href').extract_first(),
+            'lon': float(response.xpath('//*[@id ="lon"]/@value').extract()[0]),
+            'lat': float(response.xpath('//*[@id ="lat"]/@value').extract()[0]),
+        }
+
+        yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Olive Garden
http://www.olivegarden.com/locations/location-search


Discussion:

Resolving patch:
diff --git a/locations/spiders/olivegarden.py b/locations/spiders/olivegarden.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/olivegarden.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+
+from locations.items import GeojsonPointItem
+
+
+class OliveGardenSpider(scrapy.Spider):
+    name = "olivegarden"
+    allowed_domains = ['olivegarden.com']
+    download_delay = 1.5
+    start_urls = (
+        'http://www.olivegarden.com/en-locations-sitemap.xml',
+    )
+
+    def address(self, address):
+        if not address:
+            return None
+
+        addr_tags = {
+            "addr_full": address[0].split('value="')[1].split('"')[0].split(',')[0],
+            "city": address[0].split('value="')[1].split('"')[0].split(',')[1],
+            "state": address[0].split('value="')[1].split('"')[0].split(',')[-2],
+            "postcode": address[0].split('value="')[1].split('"')[0].split(',')[-1],
+        }
+
+        return addr_tags
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//url/loc/text()').extract()
+        locationURL = re.compile(r'http:/(/|/www.)olivegarden.com/locations/\S+')
+        for path in city_urls:
+            if not re.search(locationURL, path):
+                pass
+            else:
+                yield scrapy.Request(
+                    path.strip(),
+                    callback=self.parse_store,
+                )
+
+    def parse_store(self, response):
+        properties = {
+            'name': response.xpath('/html/body/div[3]/div/div/div/div/div/div/div[1]/h1').extract()[0].split('\n')[1].split('<br>')[0],
+            'website': response.xpath('//head/link[@rel="canonical"]/@href').extract_first(),
+            'ref': " ".join(response.xpath('/html/head/title/text()').extract()[0].split('|')[0].split()),
+            'lon': float(response.xpath('//input[@id="restLatLong"]').extract()[0].split('value="')[1].split('"')[0].split(',')[1]),
+            'lat': float(response.xpath('//input[@id="restLatLong"]').extract()[0].split('value="')[1].split('"')[0].split(',')[0]),
+        }
+
+        address = self.address(response.xpath('//input[@id="restAddress"]').extract())
+        if address:
+            properties.update(address)
+
+        yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Dierbergs
http://www.dierbergs.com/MyDierbergs/Locations


Discussion:

Resolving patch:
diff --git a/locations/spiders/dierbergs.py b/locations/spiders/dierbergs.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/dierbergs.py
@@ -0,0 +1,39 @@
+import json
+import re
+import scrapy
+from locations.items import GeojsonPointItem
+
+class DierbergsSpider(scrapy.Spider):
+    name = "dierbergs"
+    allowed_domains = ["www.dierbergs.com"]
+
+    start_urls = (
+        'http://www.dierbergs.com/MyDierbergs/Locations',
+    )
+
+    def parse_Ref(self, data):
+        data = data.xpath(".//img")[0]
+        ref = data.xpath("@alt").extract_first()
+        match = re.search(r'Store #(\d{1,})', ref)
+        ref = match.groups()[0]
+        return ref
+
+    def parse(self, response):
+        data = response.xpath('.//div[@class="location-listing-item row"]')
+
+        for store in data:
+            ref = self.parse_Ref(store)
+            properties = {
+                'ref': ref,
+                'addr_full': store.xpath("//span[@class='address']//text()").extract_first().strip(),
+                'city': store.xpath("//span[@class='city']//text()").extract_first().strip(),
+                'state': store.xpath("//span[@class='state']//text()").extract_first().strip(),
+                'postcode': store.xpath("//span[@class='zip']//text()").extract_first().strip(),
+                'phone': store.xpath("//span[@class='phone']//text()").extract_first().strip(),
+                'name': store.xpath(".//strong//text()").extract_first().strip(),
+                'lon': store.xpath("@data-lon").extract_first(),
+                'lat': store.xpath("@data-lat").extract_first()
+            }
+
+            yield GeojsonPointItem(**properties)
+            


Test patch: