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

Issue:
BigLots
http://local.biglots.com/


Discussion:

Resolving patch:
diff --git a/locations/spiders/biglots.py b/locations/spiders/biglots.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/biglots.py
@@ -0,0 +1,45 @@
+import scrapy
+import re
+from locations.items import GeojsonPointItem
+
+class BigLotsSpider(scrapy.Spider):
+
+    name = "biglots"
+    allowed_domains = ["local.biglots.com"]
+    download_delay = 0.5
+    start_urls = (
+        'http://local.biglots.com/',
+    )
+
+    def parse_stores(self, response):
+        properties = {
+            'addr_full': response.xpath('normalize-space(//span[@itemprop="streetAddress"]/text())').extract_first(),
+            'phone': response.xpath('normalize-space(//span[@itemprop="telephone"]/text())').extract_first(),
+            'city': response.xpath('normalize-space(//span[@itemprop="addressLocality"]/text())').extract_first(),
+            'state': response.xpath('normalize-space(//span[@itemprop="addressRegion"]/text())').extract_first(),
+            'postcode': response.xpath('normalize-space(//span[@itemprop="postalCode"]/text())').extract_first(),
+            'ref': re.findall(r"[0-9]+" , response.url)[0],
+            'website': response.url,
+            'lat': float(response.xpath('normalize-space(//meta[@name="geo.position"]/@content)').extract_first().split(';')[0].strip()),
+            'lon': float(response.xpath('normalize-space(//meta[@name="geo.position"]/@content)').extract_first().split(';')[1].strip())
+        }
+        hours = response.xpath('//meta[@itemprop="openingHours"]/@content').extract()
+        hours = '; '.join(hours)
+        if hours:
+            properties['opening_hours'] = hours
+        yield GeojsonPointItem(**properties)
+
+    def parse_city_stores(self, response):
+        stores = response.xpath('//ul[@id="results_list"]/li/div[@class="result clearfix"]/h2/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('//div[@class="column"]/div/ul/li/a/@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('//div[@id="states"]/ul/li/a/@href').extract()
+        for path in urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_state)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Anatomie
https://anatomie.com/apps/store-locator/


Discussion:

Resolving patch:
diff --git a/locations/spiders/anatomie.py b/locations/spiders/anatomie.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/anatomie.py
@@ -0,0 +1,30 @@
+import scrapy
+import re
+import json
+import lxml
+from locations.items import GeojsonPointItem
+class AnatomieSpider(scrapy.Spider):
+
+    name = "anatomie"
+    allowed_domains = ["stores.boldapps.net"]
+    start_urls = (
+        'https://stores.boldapps.net/front-end/get_surrounding_stores.php?shop=anatomie-store.myshopify.com&latitude=38.331258&longitude=-121.54841799999997&max_distance=100000&limit=10000&calc_distance=1',
+    )
+
+    def parse(self, response):
+        json_data = json.loads(response.body_as_unicode())
+        for item in json_data['stores']:
+            address = lxml.html.fromstring(item['summary'])
+            properties = {
+                'addr_full': address.xpath('normalize-space(.//span[@class="address"]/text())'),
+                'phone': '',
+                'name' : address.xpath('normalize-space(.//span[@class="name"]/text())'),
+                'city': address.xpath('normalize-space(.//span[@class="city"]/text())'),
+                'state': address.xpath('normalize-space(.//span[@class="prov_state"]/text())'),
+                'postcode':address.xpath('normalize-space(.//span[@class="postal_zip"]/text())'),
+                'ref': item['store_id'],
+                'website': response.url,
+                'lat': float(item['lat']),
+                'lon': float(item['lng']),
+            }
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Chrome Industries
https://www.chromeindustries.com/stores/


Discussion:

Resolving patch:
diff --git a/locations/spiders/chrome_industries.py b/locations/spiders/chrome_industries.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/chrome_industries.py
@@ -0,0 +1,28 @@
+import scrapy
+import re
+import json
+import lxml
+from locations.items import GeojsonPointItem
+class ChromeIndustriesSpider(scrapy.Spider):
+    name = "chrome_industries"
+    allowed_domains = ["www.chromeindustries.com"]
+    start_urls = (
+        'https://www.chromeindustries.com/on/demandware.store/Sites-chrome_na-Site/en_US/Stores-Search?latitude=32.7269669&longitude=-117.16470939999999&maxDistance=50000000',
+    )
+
+    def parse(self, response):
+        json_data = json.loads(response.body_as_unicode().replace('null' , '""'))
+        for item in json_data['locations']:
+            properties = {
+                'addr_full': item['address'] + ' '+item['address2'],
+                'phone':  item['phone'],
+                'name' : item['name'],
+                'city':  item['city'],
+                'state':  item['state'],
+                'postcode': item['zipcode'],
+                'ref': item['id'],
+                'website': "https://www.chromeindustries.com/stores/",
+                'lat':  float(item['latitude']),
+                'lon':  float(item['longitude'])
+            }
+            yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Pandora
https://stores.pandora.net/en-us/


Discussion:

Resolving patch:
diff --git a/locations/spiders/pandora.py b/locations/spiders/pandora.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/pandora.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+import json
+
+from locations.items import GeojsonPointItem
+
+
+class PandoraSpider(scrapy.Spider):
+    name = "pandora"
+    allowed_domains = ['pandora.net']
+    start_urls = (
+        'https://stores.pandora.net/en-us/',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//div[@class="map-list-item is-single"]/a/@href').extract()
+        for path in city_urls:
+            yield scrapy.Request(
+                response.request.url + path.strip(),
+                callback=self.parse_state,
+            )
+
+    def parse_state(self, response):
+        response.selector.remove_namespaces()
+        location_urls = response.xpath('//div[@class="map-list-item is-single"]/a[@class="gaq-link"]/@href').extract()
+        for path in location_urls:
+            yield scrapy.Request(
+                response.request.url + path.strip(),
+                callback=self.parse_city,
+            )
+
+    def parse_city(self, response):
+        response.selector.remove_namespaces()
+        location_urls = response.xpath('//a[@class="js-view-store-details gaq-link"]/@href').extract()
+        for path in location_urls:
+            yield scrapy.Request(
+                "https:" + path.strip(),
+                callback=self.parse_store,
+            )
+
+
+    def parse_store(self, response):
+        json_data = response.xpath('//script[@type="application/ld+json"]/text()').extract_first().replace('"Chic"', 'Chic')
+        data = json.loads(json_data)
+        data = data[0]
+
+        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['address']['telephone'],
+        'website': data['url'],
+        'opening_hours': data['openingHours'],
+        'lat': float(data['geo']['latitude']),
+        'lon': float(data['geo']['longitude']),
+        }
+
+
+        yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Enterprise Rent-a-car
Directory of all locations available. For example:

https://www.enterprise.com/en/car-rental/locations.html
https://www.enterprise.com/en/car-rental/locations/us.html
https://www.enterprise.com/en/car-rental/locations/us/pa/philadelphia.html
https://www.enterprise.com/en/car-rental/locations/us/pa/darby-17a5.html


Discussion:

Resolving patch:
diff --git a/locations/spiders/enterprise.py b/locations/spiders/enterprise.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/enterprise.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+import logging
+from locations.items import GeojsonPointItem
+
+class EnterpriseSpider(scrapy.Spider):
+    name = "enterprise"
+    allowed_domains = ["enterprise.com"]
+    start_urls = (
+        'https://www.enterprise.com/en/car-rental/locations.html',
+    )
+
+    def parse(self, response):
+        data = response.xpath('//script[@type="application/ld+json"]/text()').extract_first()
+        if data:
+            data = json.loads(data)
+            address = data.get('address', {})
+            properties = {
+                'name': data.get('name'),
+                'phone': data.get('telephone'),
+                'website': response.url,
+                'addr_full': address.get('streetAddress'),
+                'city': address.get('addressLocality'),
+                'state': address.get('addressRegion'),
+                'postcode': address.get('postalCode'),
+                'country': address.get('addressCountry'),
+            }
+            lat = data.get('geo', {}).get('latitude')
+            lon = data.get('geo', {}).get('longitude')
+            if lat: lat = float(lat)
+            if lon: lon = float(lon)
+            properties['lat'] = lat
+            properties['lon'] = lon
+            properties['ref'] = response.url
+            yield GeojsonPointItem(**properties)
+        for url in response.xpath('//a/@href').re('/en/car-rental/locations/.+'):
+            yield scrapy.Request(
+                response.urljoin(url),
+                callback=self.parse,
+            )
+


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Nike
https://www.nike.com/us/en_us/retail/en/directory


Discussion:
This site blocks IP addresses that submit many request 

Resolving patch:
diff --git a/locations/spiders/nike.py b/locations/spiders/nike.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/nike.py
@@ -0,0 +1,32 @@
+import scrapy
+import re
+from locations.items import GeojsonPointItem
+
+class NikeSpider(scrapy.Spider):
+
+    name = "nike"
+    allowed_domains = ["www.nike.com"]
+    download_delay = 1.5
+    start_urls = (
+        'https://www.nike.com/us/en_us/retail/en/directory',
+    )
+
+    def parse_stores(self, response):
+        properties = {
+            'name': response.xpath('normalize-space(//meta[@itemprop="name"]/@content)').extract_first(),
+            'addr_full': response.xpath('normalize-space(//meta[@itemprop="streetAddress"]/@content)').extract_first(),
+            'phone': response.xpath('normalize-space(//meta[@itemprop="telephone"]/@content)').extract_first(),
+            'city': response.xpath('normalize-space(//meta[@itemprop="addressLocality"]/@content)').extract_first(),
+            'state': response.xpath('normalize-space(//meta[@itemprop="addressRegion"]/@content)').extract_first(),
+            'postcode': response.xpath('normalize-space(//meta[@itemprop="postalCode"]/@content)').extract_first(),
+            'ref': re.findall(r"[^\/]+$" ,response.url)[0],
+            'website': response.url,
+            'lat': float(response.xpath('normalize-space(//meta[@itemprop="latitude"]/@content)').extract_first()),
+            'lon': float(response.xpath('normalize-space(//meta[@itemprop="longitude"]/@content)').extract_first()),
+        }
+        yield GeojsonPointItem(**properties)
+
+    def parse(self, response):
+        urls = response.xpath('//div[@class="bwt-directory-store-wrapper bwt-hide-on-mobile"]/a/@href').extract()
+        for path in urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_stores)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Farmer's Insurance
https://agents.farmers.com/


Discussion:

Resolving patch:
diff --git a/locations/spiders/farmers_insurance.py b/locations/spiders/farmers_insurance.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/farmers_insurance.py
@@ -0,0 +1,59 @@
+import scrapy
+from locations.items import GeojsonPointItem
+import json
+
+
+class FarmersInsuranceSpider(scrapy.Spider):
+    name = "farmers-insurance"
+
+    start_urls = ["https://agents.farmers.com/"]
+
+    def get_hours(self, hours_json):
+        days = json.loads(hours_json)
+        out_hours = []
+
+        for day in days:
+            start_day = day["day"][:2].title()
+            intervals = day["intervals"]
+            hours = ["%04d-%04d" % (interval["start"], interval["end"]) for interval in intervals]
+            if len(intervals):
+                out_hours.append("{} {}".format(start_day, ",".join(hours)))
+        if len(out_hours):
+            return "; ".join(out_hours)
+
+    def parse(self, response):
+        paths = [response.urljoin(x.xpath("@href").extract_first()) for x in
+                 response.css(".c-directory-list-content-item-link")]
+        for path in paths:
+            yield scrapy.Request(url=path, callback=self.parse_cities)
+
+    def parse_cities(self, response):
+        paths = [response.urljoin(x.xpath("@href").extract_first()) for x in
+                 response.css(".c-directory-list-content-item-link")]
+        for path in paths:
+            yield scrapy.Request(url=path, callback=self.parse_agents)
+
+    def parse_agents(self, response):
+        for agent in response.css(".location-item"):
+            coords = agent.xpath("@data-coordinates").extract_first(default=",")
+            lat, lon = coords.split(",")
+            agent_number = agent.xpath("@data-agent-number").extract_first()
+            agent_name = agent.css(".location-title-link::text").extract_first()
+            hours_json = agent.css(".c-location-hours-details-wrapper").xpath("@data-days").extract_first()
+
+            point = {
+                "lat": lat.strip(),
+                "lon": lon.strip(),
+                "city": agent.css(".c-address-city::text").extract_first(),
+                "state": agent.css(".c-address-state::text").extract_first(),
+                "postcode": agent.css(".c-address-postal-code::text").extract_first(),
+                "country": agent.css(".c-address-country-name::text").extract_first(),
+                "phone": agent.css(".location-phone a::text").extract_first(),
+                "website": response.urljoin(agent.css(".location-title-link").xpath("@href").extract_first()),
+                "ref": agent_number,
+                "name": "Farmers Insurance Agent - {}, Agent #{}".format(agent_name, agent_number),
+                "addr_full": " ".join([row.css("::text").extract_first() for row in agent.css(".c-AddressRow")][:2]),
+                "opening_hours": self.get_hours(hours_json),
+            }
+
+            yield GeojsonPointItem(**point)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Chuck E Cheese
https://www.chuckecheese.com


Discussion:

Resolving patch:
diff --git a/locations/spiders/chuckecheese.py b/locations/spiders/chuckecheese.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/chuckecheese.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+
+from locations.items import GeojsonPointItem
+
+
+class ChuckECheeseSpider(scrapy.Spider):
+    name = "chuckecheese"
+    allowed_domains = ['chuckecheese.com']
+    start_urls = (
+        'https://www.chuckecheese.com/sitemap.xml',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//url/loc/text()').extract()
+        for path in city_urls:
+            locationURL = re.compile(r'https://www.chuckecheese.com/storedetails/\w+/\S+/\d+')
+            if not re.search(locationURL, path):
+                pass
+            else:
+                yield scrapy.Request(
+                    path.strip(),
+                    callback=self.parse_store,
+                )
+
+    def parse_store(self, response):
+
+        if response.xpath('//p/span/time[@itemprop="openingHours"]/text()').extract():
+            storeHours = str(response.xpath('//p/span/time[@itemprop="openingHours"]/text()').extract())
+            storeHours = storeHours.replace('[','').replace(']','').replace("'",'').replace(',',' - ')
+        else:
+            storeHours = response.xpath('//p/span/time[@itemprop="openingHours"]/text()').extract()
+
+
+        properties = {
+            'name': response.xpath('//title/text()').extract_first().strip().split('–')[0].strip(),
+            'website': response.request.url,
+            'ref': response.xpath('//title/text()').extract_first().strip().split('–')[0].strip(),
+            'addr_full': response.xpath('//span[@class="street"]/text()').extract_first(),
+            'city': response.xpath('//span[@class="inlineAddress"][@itemprop="addressLocality"]/text()').extract_first(),
+            'state': response.xpath('//span[@class="inlineAddress"][@itemprop="addressRegion"]/text()').extract_first(),
+            'postcode': response.xpath('//span[@class="inlineAddress"][@itemprop="postalCode"]/text()').extract_first(),
+            'opening_hours': storeHours,
+             # 'lon': float(response.xpath('/html/body/div[1]/div[2]/div/script[3]/text()').extract()[0].split('store.lng = ')[1].split(';')[0]),
+             # 'lat': float(response.xpath('/html/body/div[1]/div[2]/div/script[3]/text()').extract()[0].split('store.lat = ')[1].split(';')[0]),
+        }
+
+        yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Bass Pro Shops
https://stores.basspro.com/


Discussion:
working on this

Resolving patch:
diff --git a/locations/spiders/bass_pro.py b/locations/spiders/bass_pro.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/bass_pro.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+
+base_url = 'https://stores.basspro.com/'
+
+
+class BassProSpider(scrapy.Spider):
+    name = "basspro"
+    download_delay = 0
+    allowed_domains = ["stores.basspro.com"]
+    start_urls = ['https://stores.basspro.com']
+    times = ''
+
+    def parse_store(self, response):
+        name = response.xpath('//span[@class="location-name-geo"]/text()')\
+            .extract_first()
+        street = response.xpath('//span[@class="c-address-street-1"]/text()')\
+            .extract_first()
+        city = response.xpath('//span[@itemprop="addressLocality"]/text()')\
+            .extract_first()
+        state = response.xpath('//abbr[@itemprop="addressRegion"]/text()')\
+            .extract_first()
+        postcode = response.xpath('//*[@itemprop="postalCode"]/text()') \
+            .extract_first()
+        phone = response.xpath('//span[@id="telephone"]/text()')\
+            .extract_first()
+        lat = response.xpath('//*[@itemprop="latitude"]/@content')\
+            .extract_first()
+        lon = response.xpath('//*[@itemprop="longitude"]/@content')\
+            .extract_first()
+        addr_full = "{} {}, {} {}".format(street, city, state, postcode)
+
+        hours_container = response.xpath(
+            '//div[@class="nap-hours"]//tr[contains('
+            '@class, "-hours-details-row")]')
+
+        for i in hours_container:
+            day = i.xpath('.//td[1]/text()').extract_first()[:2]
+            hour_start = i.xpath(
+                './/*/@data-open-interval-start').extract_first()
+            hour_end = i.xpath(
+                './/*/@data-open-interval-end').extract_first()
+
+            if hour_start:
+                if len(hour_start) < 4:
+                    hour_start = str(hour_start).zfill(4)
+                hour_start = hour_start[:2] + ':' + hour_start[2:]
+                hour_end = hour_end[:2] + ':' + hour_end[2:]
+                self.times += " {} {}-{} ".format(day, hour_start, hour_end)
+            else:
+                self.times += (day + ' off')
+
+        yield GeojsonPointItem(
+            ref=city,
+            name=name,
+            street=street,
+            city=city,
+            state=state,
+            postcode=postcode,
+            addr_full=addr_full,
+            phone=phone,
+            lat=lat,
+            lon=lon,
+            opening_hours=self.times
+        )
+        self.times = ''
+
+    def parse(self, response):
+        stores = response.xpath(
+            '//a[@class="location-card-title-link"]/@href').extract()
+        for store in stores:
+            yield scrapy.Request(base_url + store, callback=self.parse_store)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Tijuana Flats
https://tijuanaflats.com


Discussion:

Resolving patch:
diff --git a/locations/spiders/tijuanaflats.py b/locations/spiders/tijuanaflats.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/tijuanaflats.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+
+from locations.items import GeojsonPointItem
+
+
+class TijuanaFlatsSpider(scrapy.Spider):
+    name = "tijuanaflats"
+    allowed_domains = ['tijuanaflats.com']
+    start_urls = (
+        'https://tijuanaflats.com/wpsl_stores-sitemap.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('//table[@class="wpsl-opening-hours"]/tr').extract():
+            storeHours = str(response.xpath('//table[@class="wpsl-opening-hours"]/tr').extract())
+            storeHours = storeHours.replace('[','').replace(']','').replace("'",'').replace(',',' - ')
+        else:
+            storeHours = response.xpath('//table[@class="wpsl-opening-hours"]/tr').extract()
+
+
+        properties = {
+            'name': response.xpath('//h1[@class="entry-title"]/text()').extract_first(),
+            'website': response.request.url,
+            'ref': response.xpath('//h1[@class="entry-title"]/text()').extract_first(),
+            'addr_full': response.xpath('//div[@class="wpsl-location-address"]/span[1]/text()').extract_first() + " " + response.xpath('//div[@class="wpsl-location-address"]/span[2]/text()').extract_first(),
+            'city': response.xpath('//div[@class="wpsl-location-address"]/span[3]/text()').extract_first().rstrip(', '),
+            'state': response.xpath('//div[@class="wpsl-location-address"]/span[4]/text()').extract_first().strip(),
+            'postcode': response.xpath('//div[@class="wpsl-location-address"]/span[5]/text()').extract_first().strip(),
+            'opening_hours': storeHours,
+            'lat': float(response.xpath('//script/text()').extract()[-3].split('"lat":"')[1].split('"')[0]),
+            'lon': float(response.xpath('//script/text()').extract()[-3].split('"lng":"')[1].split('"')[0]),
+        }
+
+        yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch: