Downloads the test data from the internet. Parameters ---------- url : str Download url. relpath : str Relative file path. module : Union[str, list, tuple], optional Subdirectory paths under test data folder. overwrite : bool, defaults to False
(url, relpath, module=None, overwrite=False)
| 137 | |
| 138 | |
| 139 | def download_testdata(url, relpath, module=None, overwrite=False): |
| 140 | """Downloads the test data from the internet. |
| 141 | |
| 142 | Parameters |
| 143 | ---------- |
| 144 | url : str |
| 145 | Download url. |
| 146 | |
| 147 | relpath : str |
| 148 | Relative file path. |
| 149 | |
| 150 | module : Union[str, list, tuple], optional |
| 151 | Subdirectory paths under test data folder. |
| 152 | |
| 153 | overwrite : bool, defaults to False |
| 154 | If True, will download a fresh copy of the file regardless of |
| 155 | the cache. If False, will only download the file if a cached |
| 156 | version is missing. |
| 157 | |
| 158 | Returns |
| 159 | ------- |
| 160 | abspath : str |
| 161 | Absolute file path of downloaded file |
| 162 | |
| 163 | """ |
| 164 | global TEST_DATA_ROOT_PATH |
| 165 | if module is None: |
| 166 | module_path = "" |
| 167 | elif isinstance(module, str): |
| 168 | module_path = module |
| 169 | elif isinstance(module, list | tuple): |
| 170 | module_path = Path(*module) |
| 171 | else: |
| 172 | raise ValueError("Unsupported module: " + module) |
| 173 | abspath = Path(TEST_DATA_ROOT_PATH, module_path, relpath) |
| 174 | download(url, abspath, overwrite=overwrite, size_compare=False) |
| 175 | return str(abspath) |
searching dependent graphs…