| 157 | |
| 158 | |
| 159 | def download_data(): |
| 160 | # Download the data |
| 161 | print("Downloading data...") |
| 162 | urls = { |
| 163 | "simple-profiles.csv.gz": "https://osf.io/download/w2xns/", |
| 164 | "simple-relationships.csv.gz": "https://osf.io/download/nbq6h/", |
| 165 | } |
| 166 | |
| 167 | # make the data directory |
| 168 | create_directory("data") |
| 169 | |
| 170 | for name, url in urls.items(): |
| 171 | dl_file(url, "data/" + name) |
| 172 | |
| 173 | # Unzip the files |
| 174 | for name in urls.keys(): |
| 175 | print("Unzipping " + name + "...") |
| 176 | with gzip.open("data/" + name, "rb") as f_in: |
| 177 | with open("data/" + name[:-3], "wb") as f_out: |
| 178 | shutil.copyfileobj(f_in, f_out) |
| 179 | print("Done unzipping " + name + "...") |
| 180 | os.remove("data/" + name) |
| 181 | |
| 182 | # return the file paths |
| 183 | return "data/simple-profiles.csv", "data/simple-relationships.csv" |
| 184 | |
| 185 | |
| 186 | def main(docker, choice): |