|
62 | 62 |
|
63 | 63 |
|
64 | 64 | class KaggleApi(KaggleApi):
|
65 |
| - __version__ = '1.5.3' |
| 65 | + __version__ = '1.5.4' |
66 | 66 |
|
67 | 67 | CONFIG_NAME_PROXY = 'proxy'
|
68 | 68 | CONFIG_NAME_COMPETITION = 'competition'
|
@@ -92,29 +92,36 @@ class KaggleApi(KaggleApi):
|
92 | 92 | valid_list_languages = ['all', 'python', 'r', 'sqlite', 'julia']
|
93 | 93 | valid_list_kernel_types = ['all', 'script', 'notebook']
|
94 | 94 | valid_list_output_types = ['all', 'visualization', 'data']
|
95 |
| - valid_list_sort_by = ['hotness', 'commentCount', 'dateCreated', 'dateRun', |
96 |
| - 'relevance', 'scoreAscending', 'scoreDescending', 'viewCount', 'voteCount'] |
| 95 | + valid_list_sort_by = [ |
| 96 | + 'hotness', 'commentCount', 'dateCreated', 'dateRun', 'relevance', |
| 97 | + 'scoreAscending', 'scoreDescending', 'viewCount', 'voteCount' |
| 98 | + ] |
97 | 99 |
|
98 | 100 | # Competitoins valid types
|
99 | 101 | valid_competition_groups = ['general', 'entered', 'inClass']
|
100 | 102 | valid_competition_categories = [
|
101 |
| - 'all', 'featured', 'research', 'recruitment', 'gettingStarted', 'masters', 'playground'] |
102 |
| - valid_competition_sort_by = ['grouped', 'prize', 'earliestDeadline', |
103 |
| - 'latestDeadline', 'numberOfTeams', 'recentlyCreated'] |
| 103 | + 'all', 'featured', 'research', 'recruitment', 'gettingStarted', |
| 104 | + 'masters', 'playground' |
| 105 | + ] |
| 106 | + valid_competition_sort_by = [ |
| 107 | + 'grouped', 'prize', 'earliestDeadline', 'latestDeadline', |
| 108 | + 'numberOfTeams', 'recentlyCreated' |
| 109 | + ] |
104 | 110 |
|
105 | 111 | # Datasets valid types
|
106 | 112 | valid_dataset_file_types = ['all', 'csv', 'sqlite', 'json', 'bigQuery']
|
107 | 113 | valid_dataset_license_names = ['all', 'cc', 'gpl', 'odb', 'other']
|
108 | 114 | valid_dataset_sizes = ['all', 'small', 'medium', 'large']
|
109 |
| - valid_dataset_sort_bys = ['hottest', 'votes', |
110 |
| - 'updated', 'active', 'published'] |
| 115 | + valid_dataset_sort_bys = [ |
| 116 | + 'hottest', 'votes', 'updated', 'active', 'published' |
| 117 | + ] |
111 | 118 |
|
112 | 119 | # Hack for https://github.com/Kaggle/kaggle-api/issues/22 / b/78194015
|
113 | 120 | if six.PY2:
|
114 | 121 | reload(sys)
|
115 | 122 | sys.setdefaultencoding('latin1')
|
116 | 123 |
|
117 |
| -## Authentication |
| 124 | + ## Authentication |
118 | 125 |
|
119 | 126 | def authenticate(self):
|
120 | 127 | """authenticate the user with the Kaggle API. This method will generate
|
@@ -164,7 +171,7 @@ def read_config_environment(self, config_data=None, quiet=False):
|
164 | 171 |
|
165 | 172 | return config_data
|
166 | 173 |
|
167 |
| -## Configuration |
| 174 | + ## Configuration |
168 | 175 |
|
169 | 176 | def _load_config(self, config_data):
|
170 | 177 | """the final step of the authenticate steps, where we load the values
|
@@ -386,8 +393,7 @@ def print_config_values(self, prefix='- '):
|
386 | 393 | self.print_config_value(self.CONFIG_NAME_PROXY, prefix=prefix)
|
387 | 394 | self.print_config_value(self.CONFIG_NAME_COMPETITION, prefix=prefix)
|
388 | 395 |
|
389 |
| - |
390 |
| -## Competitions |
| 396 | + ## Competitions |
391 | 397 |
|
392 | 398 | def competitions_list(self,
|
393 | 399 | group=None,
|
@@ -1561,7 +1567,7 @@ def kernels_list(self,
|
1561 | 1567 | raise ValueError(
|
1562 | 1568 | 'Invalid output type specified. Valid options are ' +
|
1563 | 1569 | str(self.valid_list_output_types))
|
1564 |
| - |
| 1570 | + |
1565 | 1571 | if sort_by and sort_by not in self.valid_list_sort_by:
|
1566 | 1572 | raise ValueError(
|
1567 | 1573 | 'Invalid sort by type specified. Valid options are ' +
|
@@ -1651,14 +1657,24 @@ def kernels_initialize(self, folder):
|
1651 | 1657 |
|
1652 | 1658 | username = self.get_config_value(self.CONFIG_NAME_USER)
|
1653 | 1659 | meta_data = {
|
1654 |
| - 'id': username + '/INSERT_KERNEL_SLUG_HERE', |
1655 |
| - 'title': 'INSERT_TITLE_HERE', |
1656 |
| - 'code_file': 'INSERT_CODE_FILE_PATH_HERE', |
1657 |
| - 'language': 'Pick one of: {' + ','.join(x for x in self.valid_push_language_types) + '}', |
1658 |
| - 'kernel_type': 'Pick one of: {' + ','.join(x for x in self.valid_push_kernel_types) + '}', |
1659 |
| - 'is_private': 'true', |
1660 |
| - 'enable_gpu': 'false', |
1661 |
| - 'enable_internet': 'false', |
| 1660 | + 'id': |
| 1661 | + username + '/INSERT_KERNEL_SLUG_HERE', |
| 1662 | + 'title': |
| 1663 | + 'INSERT_TITLE_HERE', |
| 1664 | + 'code_file': |
| 1665 | + 'INSERT_CODE_FILE_PATH_HERE', |
| 1666 | + 'language': |
| 1667 | + 'Pick one of: {' + ','.join( |
| 1668 | + x for x in self.valid_push_language_types) + '}', |
| 1669 | + 'kernel_type': |
| 1670 | + 'Pick one of: {' + ','.join( |
| 1671 | + x for x in self.valid_push_kernel_types) + '}', |
| 1672 | + 'is_private': |
| 1673 | + 'true', |
| 1674 | + 'enable_gpu': |
| 1675 | + 'false', |
| 1676 | + 'enable_internet': |
| 1677 | + 'false', |
1662 | 1678 | 'dataset_sources': [],
|
1663 | 1679 | 'competition_sources': [],
|
1664 | 1680 | 'kernel_sources': [],
|
|
0 commit comments