Download a dataset. Parameters: save_path (str) -- A directory to save the data to. dataset (str) -- (optional). A specific dataset to download. Note: this must include the file extension. If None, o
(self, save_path, dataset=None)
| 77 | os.remove(temp_save_path) |
| 78 | |
| 79 | def get(self, save_path, dataset=None): |
| 80 | """ |
| 81 | |
| 82 | Download a dataset. |
| 83 | |
| 84 | Parameters: |
| 85 | save_path (str) -- A directory to save the data to. |
| 86 | dataset (str) -- (optional). A specific dataset to download. |
| 87 | Note: this must include the file extension. |
| 88 | If None, options will be presented for you |
| 89 | to choose from. |
| 90 | |
| 91 | Returns: |
| 92 | save_path_full (str) -- the absolute path to the downloaded data. |
| 93 | |
| 94 | """ |
| 95 | if dataset is None: |
| 96 | selected_dataset = self._present_options() |
| 97 | else: |
| 98 | selected_dataset = dataset |
| 99 | |
| 100 | save_path_full = join(save_path, selected_dataset.split('.')[0]) |
| 101 | |
| 102 | if isdir(save_path_full): |
| 103 | warn("\n'{0}' already exists. Voiding Download.".format( |
| 104 | save_path_full)) |
| 105 | else: |
| 106 | self._print('Downloading Data...') |
| 107 | url = "{0}/{1}".format(self.url, selected_dataset) |
| 108 | self._download_data(url, save_path=save_path) |
| 109 | |
| 110 | return abspath(save_path_full) |
no test coverage detected