<commit_before>from os import path

fixtures = path.abspath(path.join(path.dirname(__file__), 'fixtures'))

with open(path.join(fixtures, 'maine.geojson')) as f:
    MAINE_GEOJSON = "".join(f.read().split())

with open(path.join(fixtures, 'self-intersecting.geojson')) as f:
    SELF_INTERSECTING_GEOJSON = "".join(f.read().split())

with open(path.join(fixtures, 'dissolve_me.geojson')) as f:
    DISSOLVE_GEOJSON = "".join(f.read().split())

with open(path.join(fixtures, 'intersect_base.geojson')) as f:
    INTERSECT_BASE_GEOJSON = "".join(f.read().split())

with open(path.join(fixtures, 'intersect_fully_within.geojson')) as f:
    INTERSECT_FULLY_WITHIN_GEOJSON = "".join(f.read().split())

with open(path.join(fixtures, 'intersect_partially_within.geojson')) as f:
    INTERSECT_PARTIALLY_WITHIN_GEOJSON = "".join(f.read().split())<commit_msg>added download sample data method<commit_after>from os import path, remove
import gzip

from urllib.request import urlretrieve

fixtures = path.abspath(path.join(path.dirname(__file__), 'fixtures'))


def download_sample_data():

    big_files = ['IDN_adm0.shp.geojson.gz',
                 'FJI_adm0.shp.geojson.gz']

    repo = 'https://github.com/brendancol/geo-fixtures'

    for name in big_files:
        url = path.join(repo, 'blob/master', name + '?raw=true')
        print(url)
        gzip_path = path.join(fixtures, name)
        output_path = path.join(fixtures, name.replace('.gz', ''))

        urlretrieve(url, gzip_path)
        with gzip.open(gzip_path, 'rb') as f:
            with open(output_path, 'wb') as outf:
                print(output_path)
                outf.write(f.read())
                print('added sample data: {}'.format(name))

        remove(gzip_path)


with open(path.join(fixtures, 'maine.geojson')) as f:
    MAINE_GEOJSON = "".join(f.read().split())


with open(path.join(fixtures, 'self-intersecting.geojson')) as f:
    SELF_INTERSECTING_GEOJSON = "".join(f.read().split())


with open(path.join(fixtures, 'dissolve_me.geojson')) as f:
    DISSOLVE_GEOJSON = "".join(f.read().split())


with open(path.join(fixtures, 'intersect_base.geojson')) as f:
    INTERSECT_BASE_GEOJSON = "".join(f.read().split())


with open(path.join(fixtures, 'intersect_fully_within.geojson')) as f:
    INTERSECT_FULLY_WITHIN_GEOJSON = "".join(f.read().split())


with open(path.join(fixtures, 'intersect_partially_within.geojson')) as f:
    INTERSECT_PARTIALLY_WITHIN_GEOJSON = "".join(f.read().split())
{'fraction_non_alphanumeric': 0.1608222490931076, 'fraction_numerical': 0.0008061265618702137, 'mean_word_length': 4.13871635610766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4783546', 'n_tokens_mistral': 940, 'n_tokens_neox': 904, 'n_words': 150}