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

Issue:
Maurice's
https://locations.maurices.com/


Discussion:

Resolving patch:
diff --git a/locations/spiders/maurices.py b/locations/spiders/maurices.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/maurices.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+import json
+import re
+import scrapy
+
+from locations.items import GeojsonPointItem
+
+SCRIPT = 'normalize-space(//script[@type="application/ld+json"]/text())'
+
+def replacement(match):
+	return match.group().strip() + '; '
+
+class MauriceSpider(scrapy.Spider):
+
+    name = "maurice"
+    allowed_domains = ["www.maurices.com", "locations.maurices.com"]
+    download_delay = 0.2
+    start_urls = (
+        'https://locations.maurices.com',
+    )
+
+
+    def parse_store_info(self, store_info):
+
+        s_info = json.loads(store_info.xpath(SCRIPT).extract_first())[0]
+        opening_hours = s_info.get('openingHours', '')
+        if opening_hours:
+            hours = re.sub(r"[0-9]+ ", replacement,
+                          opening_hours.strip().replace(' - ', '-'))
+            hours = re.sub(r"Closed ", replacement, hours)
+            opening_hours = hours.replace(": ", " ")
+
+        props = {
+            'city': s_info['address']['addressLocality'].strip(),
+            'state': s_info['address']['addressRegion'].strip(),
+            'ref': store_info.url,
+            'website': store_info.url,
+            'phone': s_info['address']['telephone'].strip(),
+            'postcode': s_info['address']['postalCode'],
+            'addr_full': s_info['address']['streetAddress'].strip(),
+            'lat': float(s_info['geo']['latitude']),
+            'lon': float(s_info['geo']['longitude']),
+            'opening_hours': opening_hours,
+
+
+        }
+        return GeojsonPointItem(**props)
+
+    def parse_city_stores(self, response):
+
+        store_info_urls = response.xpath('//a[@class="store-info"]/@href').extract()
+        for store in store_info_urls:
+            yield scrapy.Request(response.urljoin(store), callback=self.parse_store_info)
+
+
+    def parse_state(self, response):
+
+        city_urls = response.xpath('//div[@class="map-list-item is-single"]/a/@href').extract()
+        for city in city_urls:
+            yield scrapy.Request(response.urljoin(city), callback=self.parse_city_stores)
+
+    def parse(self, response):
+
+        state_urls = response.xpath('//div[@class="map-list-item is-single"]/a/@href').extract()
+        for state in state_urls:
+            yield scrapy.Request(response.urljoin(state), callback=self.parse_state)
+


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
The Barre Code
http://thebarrecode.com/


Discussion:

Resolving patch:
diff --git a/locations/spiders/thebarrecode.py b/locations/spiders/thebarrecode.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/thebarrecode.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+from locations.items import GeojsonPointItem
+
+class TheBarreCodeSpider(scrapy.Spider):
+    name = "thebarrecode"
+    allowed_domains = ["thebarrecode.com"]
+    start_urls = (
+        'http://www.thebarrecode.com/',
+    )
+
+    def parse(self, response):
+        for location_url in response.xpath('//h4[@class="studio-location-name"]/a[1]/@href').extract():
+            yield scrapy.Request(
+                location_url,
+                callback=self.parse_location,
+            )
+
+    def parse_location(self, response):
+        properties = {
+            'addr_full': response.xpath('//h4[@class="studio-address"]/span[@class="street"]/text()').extract_first(),
+            'city': response.xpath('//h4[@class="studio-address"]/span[@class="city"]/text()').extract_first().replace(', ', ''),
+            'state': response.xpath('//h4[@class="studio-address"]/span[@class="state"]/text()').extract_first(),
+            'postcode': response.xpath('//h4[@class="studio-address"]/text()').extract_first(),
+            'phone': response.xpath('//h4[@class="studio-phone"]/text()').extract_first(),
+            'name': response.xpath('//h3[@class="studio-location-name"]/text()').extract_first(),
+            'ref': response.url,
+            'website': response.url,
+        }
+
+        for key in properties:
+            if properties[key] and isinstance(properties[key], str):
+                properties[key] = properties[key].strip()
+
+        lat = response.xpath('//div[@class="marker"]/@data-lat').extract_first()
+        if lat:
+            lat = float(lat)
+            properties['lat'] = lat
+        lon = response.xpath('//div[@class="marker"]/@data-lng').extract_first()
+        if lon:
+            lon = float(lon)
+            properties['lon'] = lon
+
+        yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Sur La Table
https://www.surlatable.com/browse/storeLocator/landingPage.jsp


Discussion:

Resolving patch:
diff --git a/locations/spiders/surlatable.py b/locations/spiders/surlatable.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/surlatable.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+
+from locations.items import GeojsonPointItem
+
+
+class ShopkoSpider(scrapy.Spider):
+    name = "surlatable"
+    allowed_domains = ['surlatable.com']
+    start_urls = (
+        'https://www.surlatable.com/storeHome.xml',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//url/loc/text()').extract()
+        for path in city_urls:
+            yield scrapy.Request(
+                path.strip(),
+                callback=self.parse_store,
+            )
+
+    def parse_store(self, response):
+
+        if response.xpath('//fieldset[@class="storehours left"]/dl').extract_first():
+            storeHoursHTML = str(response.xpath('//fieldset[@class="storehours left"]/dl').extract_first())
+            p = re.compile(r'<.*?>')
+            storeHours = p.sub(' ', storeHoursHTML)
+            storeHours = storeHours.strip()
+        else:
+            storeHours = response.xpath('//fieldset[@class="storehours left"]/dl').extract_first()
+
+
+        properties = {
+            'name': response.xpath('//h2[@class="name"]/text()').extract_first(),
+            'website': response.request.url,
+            'ref': response.xpath('//h2[@class="name"]/text()').extract_first(),
+            'addr_full': response.xpath('//fieldset[@class]/dl/dd/text()').extract_first().strip(),
+            'city': response.xpath('//fieldset[@class]/dl/dd/text()').extract()[1].strip().split(',')[0],
+            'state': response.xpath('//fieldset[@class]/dl/dd/text()').extract()[1].split(',')[1].strip().replace('\xa0',' ').split()[0],
+            'postcode': response.xpath('//fieldset[@class]/dl/dd/text()').extract()[1].split(',')[1].strip().replace('\xa0',' ').split()[1],
+            'opening_hours': storeHours,
+        }
+
+        yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Supervalu Stores
http://www.supervalustores.com/


Discussion:

Resolving patch:
diff --git a/locations/spiders/supervalu.py b/locations/spiders/supervalu.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/supervalu.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+import json
+
+class SupervaluSpider(scrapy.Spider):
+    name = "supervalu"
+    allowed_domains = ["www.supervalustores.com"]
+    
+    def start_requests(self):
+        url = 'http://www.supervalustores.com/tools/cm?getAll=cities'
+        yield scrapy.Request(url, callback=self.parse)
+
+    def parse(self, response):
+        stores = json.loads(response.body_as_unicode())
+        for store in stores:
+            properties = dict(
+                city = store['city'],
+                ref = store['id'],
+                lat = store['lat'],
+                lon = store['lng'],
+                name = store['name'],
+                phone = store['phone'],
+                postcode = store['zip'],
+                state = store['state'],
+                addr_full = store['street']
+                )
+            yield GeojsonPointItem(**properties)
+
+        


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Sentry Food
https://www.sentryfoods.com/stores/search-stores.html


Discussion:

Resolving patch:
diff --git a/locations/spiders/sentryfoods.py b/locations/spiders/sentryfoods.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/sentryfoods.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+
+
+class SentryFoodsSpider(scrapy.Spider):
+    name = "sentryfoods"
+    allowed_domains = ['sentryfoods.com']
+    start_urls = (
+        'https://www.sentryfoods.com/stores/search-stores.html',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//div[@class="searchbystate parbase section"]/div/div/*/ul/li/a/@href').extract()
+        for path in city_urls:
+            yield scrapy.Request(
+                "https://www.sentryfoods.com" + path.strip() + "&displayCount=100",
+                callback=self.parse_state,
+            )
+
+    def parse_state(self, response):
+        response.selector.remove_namespaces()
+        store_elems = response.xpath('//div[@class="store-search-results"]/ul/li')
+        for store_elem in store_elems:
+            url = response.urljoin(store_elem.xpath('.//a[@class="store-detail"]/@href').extract_first())
+            city_state_zip = store_elem.xpath('.//p[@class="store-city-state-zip"]/text()').extract_first()
+            city, state_zip = city_state_zip.split(',', 1)
+            state, zipcode = state_zip.split(' ', 1)
+
+            props = {
+                'website': url,
+                'ref': store_elem.xpath('.//@data-storeid').extract_first(),
+                'lat': store_elem.xpath('.//@data-storelat').extract_first(),
+                'lon': store_elem.xpath('.//@data-storelng').extract_first(),
+                'name': store_elem.xpath('.//h6[@class="store-display-name"]/text()').extract_first(),
+                'addr_full': store_elem.xpath('.//p[@class="store-address"]/text()').extract_first(),
+                'phone': store_elem.xpath('.//p[@class="store-main-phone"]/span/text()').extract_first().strip(),
+                'opening_hours': store_elem.xpath('.//ul[@class="store-regular-hours"]/li/text()').extract_first(),
+                'city': city,
+                'state': state,
+                'postcode': zipcode,
+            }
+            yield GeojsonPointItem(**props)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Sendik's
https://www.sendiks.com/my-store/locations


Discussion:

Resolving patch:
diff --git a/locations/spiders/sendiks.py b/locations/spiders/sendiks.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/sendiks.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+import json
+
+from locations.items import GeojsonPointItem
+
+
+class SendikSpider(scrapy.Spider):
+    name = "sendiks"
+    allowed_domains = ['www.sendiks.com']
+    start_urls = (
+        'https://www.sendiks.com/sitemap-pt-stores-2015-07.xml',
+        'https://www.sendiks.com/sitemap-pt-stores-2015-08.xml',
+        'https://www.sendiks.com/sitemap-pt-stores-2016-11.xml',
+        'https://www.sendiks.com/sitemap-pt-stores-2017-04.xml',
+        'https://www.sendiks.com/sitemap-pt-stores-2017-06.xml',
+        'https://www.sendiks.com/sitemap-pt-stores-2017-07.xml',
+        'https://www.sendiks.com/sitemap-pt-stores-2017-08.xml',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//url/loc/text()').extract()
+        for path in city_urls:
+            yield scrapy.Request(
+                path.strip(),
+                callback=self.parse_store,
+            )
+
+    def parse_store(self, response):
+
+        if response.xpath('//div[@class="fp-store-address"]/div/text()').extract_first():
+            properties = {
+            'name': response.xpath('//h2/text()').extract_first(),
+            'ref': response.xpath('//h2/text()').extract_first(),
+            'addr_full': response.xpath('//div[@class="fp-store-address"]/div/text()').extract_first(),
+            'city': response.xpath('//div[@class="fp-store-address"]/text()').extract_first().split(',')[0].strip(),
+            'state': response.xpath('//div[@class="fp-store-address"]/text()').extract_first().split()[-2],
+            'postcode': response.xpath('//div[@class="fp-store-address"]/text()').extract_first().split()[-1],
+            'phone': response.xpath('//div[@class="fp-store-info fp-widget"]/div/div/div[5]/p/text()').extract_first(),
+            'website': response.request.url,
+            'opening_hours': response.xpath('//div[@class="fp-store-info fp-widget"]/div/div/div[4]/p/text()').extract_first(),
+            'lat': float(response.xpath('//script').extract()[-6].split('latitude":')[1].split(',')[0]),
+            'lon': float(response.xpath('//script').extract()[-6].split('longitude":')[1].split(',')[0]),
+            }
+            yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Anytime Fitness
https://www.anytimefitness.com/locations/


Discussion:

Resolving patch:
diff --git a/locations/spiders/anytime_fitness.py b/locations/spiders/anytime_fitness.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/anytime_fitness.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+import json
+
+class AnytimeFitnessSpider(scrapy.Spider):
+    name = 'anytime_fitness'
+    allowed_domains = ['www.anytimefitness.com']
+
+    def start_requests(self):
+        url = 'https://www.anytimefitness.com/wp-content/uploads/gyms.json'
+        yield scrapy.Request(url, callback=self.parse)
+
+    def parse(self, response):
+        gyms = json.loads(response.body_as_unicode())
+
+        for gym in gyms:
+            yield GeojsonPointItem(
+                lat = gym['latitude'],
+                lon = gym['longitude'],
+                addr_full = '{}, {}'.format(gym['content']['address'], gym['content']['address2']),
+                city = gym['content']['city'],
+                phone = gym['content']['phone'],
+                state = gym['content']['state_abbr'],
+                postcode = gym['content']['zip'],
+                ref = gym['content']['url'],
+                country = gym['content']['country']
+                )
+                
+                
+    


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Planet Fitness
https://www.planetfitness.com/gyms


Discussion:

Resolving patch:
diff --git a/locations/spiders/planet_fitness.py b/locations/spiders/planet_fitness.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/planet_fitness.py
@@ -0,0 +1,41 @@
+import scrapy
+from locations.items import GeojsonPointItem
+import re
+
+
+class PlanetFitnessSpider(scrapy.Spider):
+    name = "planet-fitness"
+    allowed_domains = ["planetfitness.com"]
+    start_urls = (
+        "https://www.planetfitness.com/sitemap.xml",
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//url/loc/text()').extract()
+        for path in city_urls:
+            if "https://www.planetfitness.com/gyms/" in path:
+                yield scrapy.Request(
+                    path,
+                    callback=self.parse_gym
+                )
+
+    def parse_gym(self, response):
+        coordinates = re.findall(r"(?<=\.setLngLat\(\[).*(?=\]\))", response.body_as_unicode())
+        lat, lon = coordinates[0].split(", ") if len(coordinates) else [None, None]
+
+        point = {
+            "lat": lat,
+            "lon": lon,
+            "name": "Planet Fitness " + response.css("h1.alt::text").extract_first(default="").strip(),
+            "addr_full": response.css(".address-line1::text").extract_first(),
+            "city": response.css(".locality::text").extract_first(),
+            "state": response.css(".administrative-area::text").extract_first(),
+            "postcode": response.css(".postal-code::text").extract_first(),
+            "country": response.css(".country::text").extract_first(),
+            "phone": response.css(".field--name-field-phone div::text").extract_first(default="").strip(),
+            "website": response.url,
+            "ref": response.url
+        }
+
+        yield GeojsonPointItem(**point)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Lush Cosmetics
https://www.lushusa.com/Stores-Locate


Discussion:

Resolving patch:
diff --git a/locations/spiders/lush_cosmetics.py b/locations/spiders/lush_cosmetics.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/lush_cosmetics.py
@@ -0,0 +1,30 @@
+import scrapy
+from locations.items import GeojsonPointItem
+import json
+
+
+class LushSpider(scrapy.Spider):
+    name = 'lush'
+    download_delay = 0
+    allowed_domains = ['www.lushusa.com']
+    start_urls = [
+        'https://www.lushusa.com/on/demandware.store/Sites-Lush-Site/en_US/Stores-Search?lat=41.8781136&lng=-87.62979819999998&radius=50']
+
+    def parse(self, response):
+        results = json.loads(response.body_as_unicode())
+        for i in results:
+            yield GeojsonPointItem(
+                ref=i['storeInfo']['id'],
+                name=i['storeInfo']['name'],
+                phone=i['storeInfo']['phone'],
+                street=i['storeInfo']['address1'],
+                postcode=i['storeInfo']['postalCode'],
+                city=i['storeInfo']['city'],
+                state=i['storeInfo']['state'],
+                lat=i['storeInfo']['lat'],
+                lon=i['storeInfo']['lng'],
+                addr_full=f"{i['storeInfo']['address1']}"
+                          f" {i['storeInfo']['city']}, "
+                          f"{i['storeInfo']['state']} "
+                          f"{i['storeInfo']['postalCode']}"
+            )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Albert Heijn
Supermarket/Grocery store in Netherlands (and elsewhere)


Discussion:

Resolving patch:
diff --git a/locations/spiders/albert_heijn.py b/locations/spiders/albert_heijn.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/albert_heijn.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+import json
+
+class AlbertHeijnSpider(scrapy.Spider):
+    name = 'albert_heijn'
+    allowed_domains = ['www.ah.nl']
+
+    def start_requests(self):
+        url = 'https://www.ah.nl/data/winkelinformatie/winkels/json'
+        yield scrapy.Request(url, callback=self.parse)
+
+    def parse(self, response):
+        stores = json.loads(response.body_as_unicode())
+        for store in stores['stores']:
+            yield GeojsonPointItem(
+                lat = store['lat'],
+                lon = store['lng'],
+                addr_full = store['street'],
+                city = store['city'],
+                phone = store['phoneNumber'],
+                state = "",
+                postcode = store['zip'],
+                ref = store['no'],
+                country = "Netherlands",
+                website = "https://www.ah.nl/winkel/albert-heijn/%s/%s/%s"%(store['city'],store['street'],store['no'])
+                )
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Nordstrom 
https://shop.nordstrom.com/c/sitemap-stores


Discussion:

Resolving patch:
diff --git a/locations/spiders/nordstrom.py b/locations/spiders/nordstrom.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/nordstrom.py
@@ -0,0 +1,34 @@
+import scrapy
+import re
+from locations.items import GeojsonPointItem
+class NordstromSpider(scrapy.Spider):
+
+    name = "nordstrom"
+    allowed_domains = ["shop.nordstrom.com"]
+    download_delay = 0.5
+    start_urls = (
+        'https://shop.nordstrom.com/c/sitemap-stores',
+    )
+
+    def parse_stores(self, response):
+        lat = re.findall(r'\"Latitude\":\"[0-9-.]+' ,response.body_as_unicode())[0]
+        lng = re.findall(r'\"Longitude\":\"[0-9-.]+' ,response.body_as_unicode())[0]
+        lat = re.findall(r"[0-9.-]+$",lat)[0]
+        lng = re.findall(r"[0-9.-]+$",lng)[0]
+        properties = {
+            'addr_full': response.xpath('normalize-space(//span[@itemprop="streetAddress"]/text())').extract_first().replace(',' ,''),
+            'phone': response.xpath('normalize-space(//span[@itemprop="telephone"]/text())').extract_first(),
+            'city': response.xpath('normalize-space(//span[@itemprop="addressLocality"]/text())').extract_first().replace(',' ,''),
+            'state': response.xpath('normalize-space(//span[@itemprop="addressRegion"]/text())').extract_first(),
+            'postcode': response.xpath('normalize-space(//span[@itemprop="postalCode"]/text())').extract_first(),
+            'ref': response.xpath('normalize-space(//div[@class="store-number"]/text())').extract_first(),
+            'website': response.url,
+            'lat': float(lat),
+            'lon': float(lng),
+        }
+        yield GeojsonPointItem(**properties)
+
+    def parse(self, response):
+        urls = response.xpath('//a[contains(@href ,"shop.nordstrom.com/st/")]/@href').extract()
+        for path in urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_stores)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Lifetime Fitness
https://www.lifetime.life/view-all-locations.html


Discussion:

Resolving patch:
diff --git a/locations/spiders/lifetime.py b/locations/spiders/lifetime.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/lifetime.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+from locations.items import GeojsonPointItem
+
+
+class LifetimeFitnessSpider(scrapy.Spider):
+    name = "lifetimefitness"
+    allowed_domains = ['lifetime.life']
+    start_urls = (
+        'https://www.lifetime.life/view-all-locations.html',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//a[@class="btn btn-link btn-xs m-b-sm p-x-0 b-x-xs-0 pull-xs-right"]/@href').extract()
+        for path in city_urls:
+            yield scrapy.Request(
+                "https://www.lifetime.life" + path.strip(),
+                callback=self.parse_store,
+            )
+
+    def parse_store(self, response):
+
+        json_data = response.xpath('//script[@type="application/ld+json"]/text()').extract_first()
+        data = json.loads(json_data)
+
+        properties = {
+        'name': data['name'],
+        'ref': data['name'],
+        'addr_full': data['address']['streetAddress'],
+        'city': data['address']['addressLocality'],
+        'state': data['address']['addressRegion'],
+        'postcode': data['address']['postalCode'],
+        'phone': data['telephone'],
+        'website': data['url'],
+        'lat': data['geo']['latitude'],
+        'lon': data['geo']['longitude'],
+        }
+
+        yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch: