kaggle 1.7.4.2__py3-none-any.whl → 1.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kaggle/__init__.py +10 -6
- kaggle/api/kaggle_api.py +574 -585
- kaggle/api/kaggle_api_extended.py +5251 -4738
- kaggle/cli.py +1335 -1585
- kaggle/models/api_blob_type.py +3 -3
- kaggle/models/dataset_column.py +129 -129
- kaggle/models/dataset_new_request.py +130 -72
- kaggle/models/dataset_new_version_request.py +88 -56
- kaggle/models/dataset_update_settings_request.py +93 -59
- kaggle/models/kaggle_models_extended.py +169 -172
- kaggle/models/kernel_push_request.py +152 -100
- kaggle/models/model_instance_new_version_request.py +30 -30
- kaggle/models/model_instance_update_request.py +171 -71
- kaggle/models/model_new_instance_request.py +223 -88
- kaggle/models/model_new_request.py +61 -46
- kaggle/models/model_update_request.py +66 -48
- kaggle/models/start_blob_upload_request.py +146 -138
- kaggle/models/start_blob_upload_response.py +83 -78
- kaggle/models/upload_file.py +92 -96
- kaggle/test/test_authenticate.py +23 -23
- {kaggle-1.7.4.2.dist-info → kaggle-1.8.0.dist-info}/METADATA +11 -15
- kaggle-1.8.0.dist-info/RECORD +148 -0
- kagglesdk/__init__.py +5 -1
- kagglesdk/benchmarks/services/__init__.py +0 -0
- kagglesdk/benchmarks/services/benchmarks_api_service.py +19 -0
- kagglesdk/benchmarks/types/__init__.py +0 -0
- kagglesdk/benchmarks/types/benchmark_types.py +307 -0
- kagglesdk/benchmarks/types/benchmarks_api_service.py +243 -0
- kagglesdk/blobs/services/blob_api_service.py +1 -1
- kagglesdk/blobs/types/blob_api_service.py +2 -2
- kagglesdk/common/services/__init__.py +0 -0
- kagglesdk/common/services/operations_service.py +46 -0
- kagglesdk/common/types/file_download.py +1 -1
- kagglesdk/common/types/http_redirect.py +1 -1
- kagglesdk/common/types/operations.py +194 -0
- kagglesdk/common/types/operations_service.py +48 -0
- kagglesdk/community/__init__.py +0 -0
- kagglesdk/community/types/__init__.py +0 -0
- kagglesdk/community/types/content_enums.py +44 -0
- kagglesdk/community/types/organization.py +410 -0
- kagglesdk/competitions/services/competition_api_service.py +49 -12
- kagglesdk/competitions/types/competition.py +14 -0
- kagglesdk/competitions/types/competition_api_service.py +1639 -1275
- kagglesdk/competitions/types/search_competitions.py +28 -0
- kagglesdk/datasets/databundles/__init__.py +0 -0
- kagglesdk/datasets/databundles/types/__init__.py +0 -0
- kagglesdk/datasets/databundles/types/databundle_api_types.py +540 -0
- kagglesdk/datasets/services/dataset_api_service.py +39 -14
- kagglesdk/datasets/types/dataset_api_service.py +567 -297
- kagglesdk/datasets/types/dataset_enums.py +21 -0
- kagglesdk/datasets/types/dataset_service.py +145 -0
- kagglesdk/datasets/types/dataset_types.py +74 -74
- kagglesdk/datasets/types/search_datasets.py +6 -0
- kagglesdk/discussions/__init__.py +0 -0
- kagglesdk/discussions/types/__init__.py +0 -0
- kagglesdk/discussions/types/search_discussions.py +43 -0
- kagglesdk/discussions/types/writeup_enums.py +11 -0
- kagglesdk/education/services/education_api_service.py +1 -1
- kagglesdk/education/types/education_api_service.py +1 -1
- kagglesdk/kaggle_client.py +55 -20
- kagglesdk/kaggle_creds.py +148 -0
- kagglesdk/kaggle_env.py +89 -27
- kagglesdk/kaggle_http_client.py +235 -290
- kagglesdk/kaggle_oauth.py +200 -0
- kagglesdk/kaggle_object.py +298 -250
- kagglesdk/kernels/services/kernels_api_service.py +46 -9
- kagglesdk/kernels/types/kernels_api_service.py +658 -158
- kagglesdk/kernels/types/kernels_enums.py +6 -0
- kagglesdk/kernels/types/search_kernels.py +6 -0
- kagglesdk/licenses/__init__.py +0 -0
- kagglesdk/licenses/types/__init__.py +0 -0
- kagglesdk/licenses/types/licenses_types.py +182 -0
- kagglesdk/models/services/model_api_service.py +46 -21
- kagglesdk/models/types/model_api_service.py +1018 -652
- kagglesdk/models/types/model_enums.py +8 -0
- kagglesdk/models/types/model_service.py +71 -71
- kagglesdk/models/types/model_types.py +1057 -5
- kagglesdk/models/types/search_models.py +8 -0
- kagglesdk/search/__init__.py +0 -0
- kagglesdk/search/services/__init__.py +0 -0
- kagglesdk/search/services/search_api_service.py +19 -0
- kagglesdk/search/types/__init__.py +0 -0
- kagglesdk/search/types/search_api_service.py +2435 -0
- kagglesdk/search/types/search_content_shared.py +50 -0
- kagglesdk/search/types/search_enums.py +45 -0
- kagglesdk/search/types/search_service.py +303 -0
- kagglesdk/security/__init__.py +0 -0
- kagglesdk/security/services/__init__.py +0 -0
- kagglesdk/security/services/iam_service.py +31 -0
- kagglesdk/security/services/oauth_service.py +58 -0
- kagglesdk/security/types/__init__.py +0 -0
- kagglesdk/security/types/authentication.py +171 -0
- kagglesdk/security/types/iam_service.py +496 -0
- kagglesdk/security/types/oauth_service.py +1181 -0
- kagglesdk/security/types/roles.py +8 -0
- kagglesdk/security/types/security_types.py +159 -0
- kagglesdk/test/__init__.py +0 -0
- kagglesdk/test/test_client.py +20 -24
- kagglesdk/users/services/__init__.py +0 -0
- kagglesdk/users/services/account_service.py +31 -0
- kagglesdk/users/services/group_api_service.py +31 -0
- kagglesdk/users/types/account_service.py +345 -0
- kagglesdk/users/types/group_api_service.py +315 -0
- kagglesdk/users/types/group_types.py +165 -0
- kagglesdk/users/types/groups_enum.py +8 -0
- kagglesdk/users/types/progression_service.py +9 -0
- kagglesdk/users/types/search_users.py +23 -0
- kagglesdk/users/types/user_avatar.py +226 -0
- kaggle/configuration.py +0 -206
- kaggle-1.7.4.2.dist-info/RECORD +0 -89
- {kaggle-1.7.4.2.dist-info → kaggle-1.8.0.dist-info}/WHEEL +0 -0
- {kaggle-1.7.4.2.dist-info → kaggle-1.8.0.dist-info}/entry_points.txt +0 -0
- {kaggle-1.7.4.2.dist-info → kaggle-1.8.0.dist-info}/licenses/LICENSE.txt +0 -0
- {kaggle/test → kagglesdk/benchmarks}/__init__.py +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from kagglesdk.kaggle_object import *
|
|
2
|
+
|
|
3
|
+
class ListSearchContentRangeFilter(KaggleObject):
|
|
4
|
+
r"""
|
|
5
|
+
Attributes:
|
|
6
|
+
min (int)
|
|
7
|
+
The minimum value (inclusive) to apply to filtering
|
|
8
|
+
max (int)
|
|
9
|
+
The maximum value (inclusive) to apply to filtering
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
self._min = 0
|
|
14
|
+
self._max = 0
|
|
15
|
+
self._freeze()
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def min(self) -> int:
|
|
19
|
+
"""The minimum value (inclusive) to apply to filtering"""
|
|
20
|
+
return self._min
|
|
21
|
+
|
|
22
|
+
@min.setter
|
|
23
|
+
def min(self, min: int):
|
|
24
|
+
if min is None:
|
|
25
|
+
del self.min
|
|
26
|
+
return
|
|
27
|
+
if not isinstance(min, int):
|
|
28
|
+
raise TypeError('min must be of type int')
|
|
29
|
+
self._min = min
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def max(self) -> int:
|
|
33
|
+
"""The maximum value (inclusive) to apply to filtering"""
|
|
34
|
+
return self._max
|
|
35
|
+
|
|
36
|
+
@max.setter
|
|
37
|
+
def max(self, max: int):
|
|
38
|
+
if max is None:
|
|
39
|
+
del self.max
|
|
40
|
+
return
|
|
41
|
+
if not isinstance(max, int):
|
|
42
|
+
raise TypeError('max must be of type int')
|
|
43
|
+
self._max = max
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
ListSearchContentRangeFilter._fields = [
|
|
47
|
+
FieldMetadata("min", "min", "_min", int, 0, PredefinedSerializer()),
|
|
48
|
+
FieldMetadata("max", "max", "_max", int, 0, PredefinedSerializer()),
|
|
49
|
+
]
|
|
50
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
class ListSearchContentOrderBy(enum.Enum):
|
|
4
|
+
LIST_SEARCH_CONTENT_ORDER_BY_UNSPECIFIED = 0
|
|
5
|
+
LIST_SEARCH_CONTENT_ORDER_BY_DATE_CREATED = 1
|
|
6
|
+
LIST_SEARCH_CONTENT_ORDER_BY_DATE_UPDATED = 2
|
|
7
|
+
LIST_SEARCH_CONTENT_ORDER_BY_HOTNESS = 3
|
|
8
|
+
LIST_SEARCH_CONTENT_ORDER_BY_LAST_VIEWED = 4
|
|
9
|
+
LIST_SEARCH_CONTENT_ORDER_BY_TOTAL_COMMENTS = 5
|
|
10
|
+
LIST_SEARCH_CONTENT_ORDER_BY_VOTES = 6
|
|
11
|
+
|
|
12
|
+
class DocumentType(enum.Enum):
|
|
13
|
+
DOCUMENT_TYPE_UNSPECIFIED = 0
|
|
14
|
+
BLOG = 1
|
|
15
|
+
COMPETITION = 2
|
|
16
|
+
DATASET = 3
|
|
17
|
+
KERNEL = 5
|
|
18
|
+
COMMENT = 6
|
|
19
|
+
TOPIC = 8
|
|
20
|
+
USER = 9
|
|
21
|
+
COURSE = 10
|
|
22
|
+
TUTORIAL = 11
|
|
23
|
+
MODEL = 12
|
|
24
|
+
RESOURCEREFERENCE = 13
|
|
25
|
+
BENCHMARKTASK = 14
|
|
26
|
+
BENCHMARK = 15
|
|
27
|
+
|
|
28
|
+
class OwnerType(enum.Enum):
|
|
29
|
+
OWNER_TYPE_UNSPECIFIED = 0
|
|
30
|
+
"""ownerUserId is sole owner of content or is in read/writeGroupId"""
|
|
31
|
+
OWNER_TYPE_OWNS = 1
|
|
32
|
+
"""ownerUserId is sole owner of content"""
|
|
33
|
+
OWNER_TYPE_COLLABORATIONS = 2
|
|
34
|
+
"""ownerUserId is in read/writeGroupId, but not owner [Profiles only]"""
|
|
35
|
+
OWNER_TYPE_SHARED_WITH_CURRENT_USER = 3
|
|
36
|
+
"""ownerUserId is sole owner of content, currentUser is in read/writeGroupId"""
|
|
37
|
+
|
|
38
|
+
class PrivacyFilter(enum.Enum):
|
|
39
|
+
ALL = 0
|
|
40
|
+
"""Return all search results (private and public)."""
|
|
41
|
+
PRIVATE = 1
|
|
42
|
+
"""Return only private search results (if caller has access, of course)."""
|
|
43
|
+
PUBLIC = 2
|
|
44
|
+
"""Return only public search results."""
|
|
45
|
+
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from kagglesdk.community.types.content_enums import ContentState
|
|
3
|
+
from kagglesdk.discussions.types.writeup_enums import WriteUpType
|
|
4
|
+
from kagglesdk.kaggle_object import *
|
|
5
|
+
from kagglesdk.users.types.user_avatar import UserAvatar
|
|
6
|
+
from typing import Optional, List
|
|
7
|
+
|
|
8
|
+
class WriteUpCompetitionInfo(KaggleObject):
|
|
9
|
+
r"""
|
|
10
|
+
Attributes:
|
|
11
|
+
competition_title (str)
|
|
12
|
+
Title of the Competition or Hackathon
|
|
13
|
+
competition_url (str)
|
|
14
|
+
Url of the Competition or Hackathon
|
|
15
|
+
deadline (datetime)
|
|
16
|
+
Deadline of the Competition or Hackathon
|
|
17
|
+
write_up_leaderboard_rank (int)
|
|
18
|
+
Rank of Competition Solution WriteUp on Leaderboard
|
|
19
|
+
leaderboard_url (str)
|
|
20
|
+
Leaderboard Tab Url for Competition
|
|
21
|
+
winners_url (str)
|
|
22
|
+
Winners Tab Url of Hackathon
|
|
23
|
+
is_hackathon_winner (bool)
|
|
24
|
+
Boolean to tell if user's WriteUp is winner of Hackathon
|
|
25
|
+
competition_id (int)
|
|
26
|
+
Id of the Competition
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(self):
|
|
30
|
+
self._competition_title = ""
|
|
31
|
+
self._competition_url = ""
|
|
32
|
+
self._deadline = None
|
|
33
|
+
self._write_up_leaderboard_rank = None
|
|
34
|
+
self._leaderboard_url = None
|
|
35
|
+
self._winners_url = None
|
|
36
|
+
self._is_hackathon_winner = None
|
|
37
|
+
self._competition_id = 0
|
|
38
|
+
self._freeze()
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def competition_title(self) -> str:
|
|
42
|
+
"""Title of the Competition or Hackathon"""
|
|
43
|
+
return self._competition_title
|
|
44
|
+
|
|
45
|
+
@competition_title.setter
|
|
46
|
+
def competition_title(self, competition_title: str):
|
|
47
|
+
if competition_title is None:
|
|
48
|
+
del self.competition_title
|
|
49
|
+
return
|
|
50
|
+
if not isinstance(competition_title, str):
|
|
51
|
+
raise TypeError('competition_title must be of type str')
|
|
52
|
+
self._competition_title = competition_title
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def competition_url(self) -> str:
|
|
56
|
+
"""Url of the Competition or Hackathon"""
|
|
57
|
+
return self._competition_url
|
|
58
|
+
|
|
59
|
+
@competition_url.setter
|
|
60
|
+
def competition_url(self, competition_url: str):
|
|
61
|
+
if competition_url is None:
|
|
62
|
+
del self.competition_url
|
|
63
|
+
return
|
|
64
|
+
if not isinstance(competition_url, str):
|
|
65
|
+
raise TypeError('competition_url must be of type str')
|
|
66
|
+
self._competition_url = competition_url
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def deadline(self) -> datetime:
|
|
70
|
+
"""Deadline of the Competition or Hackathon"""
|
|
71
|
+
return self._deadline
|
|
72
|
+
|
|
73
|
+
@deadline.setter
|
|
74
|
+
def deadline(self, deadline: datetime):
|
|
75
|
+
if deadline is None:
|
|
76
|
+
del self.deadline
|
|
77
|
+
return
|
|
78
|
+
if not isinstance(deadline, datetime):
|
|
79
|
+
raise TypeError('deadline must be of type datetime')
|
|
80
|
+
self._deadline = deadline
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def write_up_leaderboard_rank(self) -> int:
|
|
84
|
+
"""Rank of Competition Solution WriteUp on Leaderboard"""
|
|
85
|
+
return self._write_up_leaderboard_rank or 0
|
|
86
|
+
|
|
87
|
+
@write_up_leaderboard_rank.setter
|
|
88
|
+
def write_up_leaderboard_rank(self, write_up_leaderboard_rank: Optional[int]):
|
|
89
|
+
if write_up_leaderboard_rank is None:
|
|
90
|
+
del self.write_up_leaderboard_rank
|
|
91
|
+
return
|
|
92
|
+
if not isinstance(write_up_leaderboard_rank, int):
|
|
93
|
+
raise TypeError('write_up_leaderboard_rank must be of type int')
|
|
94
|
+
self._write_up_leaderboard_rank = write_up_leaderboard_rank
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def leaderboard_url(self) -> str:
|
|
98
|
+
"""Leaderboard Tab Url for Competition"""
|
|
99
|
+
return self._leaderboard_url or ""
|
|
100
|
+
|
|
101
|
+
@leaderboard_url.setter
|
|
102
|
+
def leaderboard_url(self, leaderboard_url: Optional[str]):
|
|
103
|
+
if leaderboard_url is None:
|
|
104
|
+
del self.leaderboard_url
|
|
105
|
+
return
|
|
106
|
+
if not isinstance(leaderboard_url, str):
|
|
107
|
+
raise TypeError('leaderboard_url must be of type str')
|
|
108
|
+
self._leaderboard_url = leaderboard_url
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def winners_url(self) -> str:
|
|
112
|
+
"""Winners Tab Url of Hackathon"""
|
|
113
|
+
return self._winners_url or ""
|
|
114
|
+
|
|
115
|
+
@winners_url.setter
|
|
116
|
+
def winners_url(self, winners_url: Optional[str]):
|
|
117
|
+
if winners_url is None:
|
|
118
|
+
del self.winners_url
|
|
119
|
+
return
|
|
120
|
+
if not isinstance(winners_url, str):
|
|
121
|
+
raise TypeError('winners_url must be of type str')
|
|
122
|
+
self._winners_url = winners_url
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def is_hackathon_winner(self) -> bool:
|
|
126
|
+
"""Boolean to tell if user's WriteUp is winner of Hackathon"""
|
|
127
|
+
return self._is_hackathon_winner or False
|
|
128
|
+
|
|
129
|
+
@is_hackathon_winner.setter
|
|
130
|
+
def is_hackathon_winner(self, is_hackathon_winner: Optional[bool]):
|
|
131
|
+
if is_hackathon_winner is None:
|
|
132
|
+
del self.is_hackathon_winner
|
|
133
|
+
return
|
|
134
|
+
if not isinstance(is_hackathon_winner, bool):
|
|
135
|
+
raise TypeError('is_hackathon_winner must be of type bool')
|
|
136
|
+
self._is_hackathon_winner = is_hackathon_winner
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def competition_id(self) -> int:
|
|
140
|
+
"""Id of the Competition"""
|
|
141
|
+
return self._competition_id
|
|
142
|
+
|
|
143
|
+
@competition_id.setter
|
|
144
|
+
def competition_id(self, competition_id: int):
|
|
145
|
+
if competition_id is None:
|
|
146
|
+
del self.competition_id
|
|
147
|
+
return
|
|
148
|
+
if not isinstance(competition_id, int):
|
|
149
|
+
raise TypeError('competition_id must be of type int')
|
|
150
|
+
self._competition_id = competition_id
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class WriteUpItemInfo(KaggleObject):
|
|
154
|
+
r"""
|
|
155
|
+
Attributes:
|
|
156
|
+
type (WriteUpType)
|
|
157
|
+
Type of WriteUp
|
|
158
|
+
subtitle (str)
|
|
159
|
+
Subtitle of WriteUp
|
|
160
|
+
collaborators (UserAvatar)
|
|
161
|
+
List of WriteUp collaborators
|
|
162
|
+
competition_info (WriteUpCompetitionInfo)
|
|
163
|
+
Competition metadata associated with WriteUp
|
|
164
|
+
content_state (ContentState)
|
|
165
|
+
Content State of WriteUp
|
|
166
|
+
team_name (str)
|
|
167
|
+
Name of the team that owns the WriteUp
|
|
168
|
+
id (int)
|
|
169
|
+
Id of the WriteUp
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
def __init__(self):
|
|
173
|
+
self._type = WriteUpType.WRITE_UP_TYPE_UNSPECIFIED
|
|
174
|
+
self._subtitle = None
|
|
175
|
+
self._collaborators = []
|
|
176
|
+
self._competition_info = None
|
|
177
|
+
self._content_state = ContentState.CONTENT_STATE_UNSPECIFIED
|
|
178
|
+
self._team_name = None
|
|
179
|
+
self._id = 0
|
|
180
|
+
self._freeze()
|
|
181
|
+
|
|
182
|
+
@property
|
|
183
|
+
def type(self) -> 'WriteUpType':
|
|
184
|
+
"""Type of WriteUp"""
|
|
185
|
+
return self._type
|
|
186
|
+
|
|
187
|
+
@type.setter
|
|
188
|
+
def type(self, type: 'WriteUpType'):
|
|
189
|
+
if type is None:
|
|
190
|
+
del self.type
|
|
191
|
+
return
|
|
192
|
+
if not isinstance(type, WriteUpType):
|
|
193
|
+
raise TypeError('type must be of type WriteUpType')
|
|
194
|
+
self._type = type
|
|
195
|
+
|
|
196
|
+
@property
|
|
197
|
+
def subtitle(self) -> str:
|
|
198
|
+
"""Subtitle of WriteUp"""
|
|
199
|
+
return self._subtitle or ""
|
|
200
|
+
|
|
201
|
+
@subtitle.setter
|
|
202
|
+
def subtitle(self, subtitle: Optional[str]):
|
|
203
|
+
if subtitle is None:
|
|
204
|
+
del self.subtitle
|
|
205
|
+
return
|
|
206
|
+
if not isinstance(subtitle, str):
|
|
207
|
+
raise TypeError('subtitle must be of type str')
|
|
208
|
+
self._subtitle = subtitle
|
|
209
|
+
|
|
210
|
+
@property
|
|
211
|
+
def collaborators(self) -> Optional[List[Optional['UserAvatar']]]:
|
|
212
|
+
"""List of WriteUp collaborators"""
|
|
213
|
+
return self._collaborators
|
|
214
|
+
|
|
215
|
+
@collaborators.setter
|
|
216
|
+
def collaborators(self, collaborators: Optional[List[Optional['UserAvatar']]]):
|
|
217
|
+
if collaborators is None:
|
|
218
|
+
del self.collaborators
|
|
219
|
+
return
|
|
220
|
+
if not isinstance(collaborators, list):
|
|
221
|
+
raise TypeError('collaborators must be of type list')
|
|
222
|
+
if not all([isinstance(t, UserAvatar) for t in collaborators]):
|
|
223
|
+
raise TypeError('collaborators must contain only items of type UserAvatar')
|
|
224
|
+
self._collaborators = collaborators
|
|
225
|
+
|
|
226
|
+
@property
|
|
227
|
+
def competition_info(self) -> Optional['WriteUpCompetitionInfo']:
|
|
228
|
+
"""Competition metadata associated with WriteUp"""
|
|
229
|
+
return self._competition_info or None
|
|
230
|
+
|
|
231
|
+
@competition_info.setter
|
|
232
|
+
def competition_info(self, competition_info: Optional[Optional['WriteUpCompetitionInfo']]):
|
|
233
|
+
if competition_info is None:
|
|
234
|
+
del self.competition_info
|
|
235
|
+
return
|
|
236
|
+
if not isinstance(competition_info, WriteUpCompetitionInfo):
|
|
237
|
+
raise TypeError('competition_info must be of type WriteUpCompetitionInfo')
|
|
238
|
+
self._competition_info = competition_info
|
|
239
|
+
|
|
240
|
+
@property
|
|
241
|
+
def content_state(self) -> 'ContentState':
|
|
242
|
+
"""Content State of WriteUp"""
|
|
243
|
+
return self._content_state
|
|
244
|
+
|
|
245
|
+
@content_state.setter
|
|
246
|
+
def content_state(self, content_state: 'ContentState'):
|
|
247
|
+
if content_state is None:
|
|
248
|
+
del self.content_state
|
|
249
|
+
return
|
|
250
|
+
if not isinstance(content_state, ContentState):
|
|
251
|
+
raise TypeError('content_state must be of type ContentState')
|
|
252
|
+
self._content_state = content_state
|
|
253
|
+
|
|
254
|
+
@property
|
|
255
|
+
def team_name(self) -> str:
|
|
256
|
+
"""Name of the team that owns the WriteUp"""
|
|
257
|
+
return self._team_name or ""
|
|
258
|
+
|
|
259
|
+
@team_name.setter
|
|
260
|
+
def team_name(self, team_name: Optional[str]):
|
|
261
|
+
if team_name is None:
|
|
262
|
+
del self.team_name
|
|
263
|
+
return
|
|
264
|
+
if not isinstance(team_name, str):
|
|
265
|
+
raise TypeError('team_name must be of type str')
|
|
266
|
+
self._team_name = team_name
|
|
267
|
+
|
|
268
|
+
@property
|
|
269
|
+
def id(self) -> int:
|
|
270
|
+
"""Id of the WriteUp"""
|
|
271
|
+
return self._id
|
|
272
|
+
|
|
273
|
+
@id.setter
|
|
274
|
+
def id(self, id: int):
|
|
275
|
+
if id is None:
|
|
276
|
+
del self.id
|
|
277
|
+
return
|
|
278
|
+
if not isinstance(id, int):
|
|
279
|
+
raise TypeError('id must be of type int')
|
|
280
|
+
self._id = id
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
WriteUpCompetitionInfo._fields = [
|
|
284
|
+
FieldMetadata("competitionTitle", "competition_title", "_competition_title", str, "", PredefinedSerializer()),
|
|
285
|
+
FieldMetadata("competitionUrl", "competition_url", "_competition_url", str, "", PredefinedSerializer()),
|
|
286
|
+
FieldMetadata("deadline", "deadline", "_deadline", datetime, None, DateTimeSerializer()),
|
|
287
|
+
FieldMetadata("writeUpLeaderboardRank", "write_up_leaderboard_rank", "_write_up_leaderboard_rank", int, None, PredefinedSerializer(), optional=True),
|
|
288
|
+
FieldMetadata("leaderboardUrl", "leaderboard_url", "_leaderboard_url", str, None, PredefinedSerializer(), optional=True),
|
|
289
|
+
FieldMetadata("winnersUrl", "winners_url", "_winners_url", str, None, PredefinedSerializer(), optional=True),
|
|
290
|
+
FieldMetadata("isHackathonWinner", "is_hackathon_winner", "_is_hackathon_winner", bool, None, PredefinedSerializer(), optional=True),
|
|
291
|
+
FieldMetadata("competitionId", "competition_id", "_competition_id", int, 0, PredefinedSerializer()),
|
|
292
|
+
]
|
|
293
|
+
|
|
294
|
+
WriteUpItemInfo._fields = [
|
|
295
|
+
FieldMetadata("type", "type", "_type", WriteUpType, WriteUpType.WRITE_UP_TYPE_UNSPECIFIED, EnumSerializer()),
|
|
296
|
+
FieldMetadata("subtitle", "subtitle", "_subtitle", str, None, PredefinedSerializer(), optional=True),
|
|
297
|
+
FieldMetadata("collaborators", "collaborators", "_collaborators", UserAvatar, [], ListSerializer(KaggleObjectSerializer())),
|
|
298
|
+
FieldMetadata("competitionInfo", "competition_info", "_competition_info", WriteUpCompetitionInfo, None, KaggleObjectSerializer(), optional=True),
|
|
299
|
+
FieldMetadata("contentState", "content_state", "_content_state", ContentState, ContentState.CONTENT_STATE_UNSPECIFIED, EnumSerializer()),
|
|
300
|
+
FieldMetadata("teamName", "team_name", "_team_name", str, None, PredefinedSerializer(), optional=True),
|
|
301
|
+
FieldMetadata("id", "id", "_id", int, 0, PredefinedSerializer()),
|
|
302
|
+
]
|
|
303
|
+
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from kagglesdk.kaggle_http_client import KaggleHttpClient
|
|
2
|
+
from kagglesdk.security.types.iam_service import GetIamPolicyRequest, IamPolicy, SetIamPolicyRequest
|
|
3
|
+
|
|
4
|
+
class IamClient(object):
|
|
5
|
+
|
|
6
|
+
def __init__(self, client: KaggleHttpClient):
|
|
7
|
+
self._client = client
|
|
8
|
+
|
|
9
|
+
def get_iam_policy(self, request: GetIamPolicyRequest = None) -> IamPolicy:
|
|
10
|
+
r"""
|
|
11
|
+
Args:
|
|
12
|
+
request (GetIamPolicyRequest):
|
|
13
|
+
The request object; initialized to empty instance if not specified.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
if request is None:
|
|
17
|
+
request = GetIamPolicyRequest()
|
|
18
|
+
|
|
19
|
+
return self._client.call("security.IamService", "GetIamPolicy", request, IamPolicy)
|
|
20
|
+
|
|
21
|
+
def set_iam_policy(self, request: SetIamPolicyRequest = None) -> IamPolicy:
|
|
22
|
+
r"""
|
|
23
|
+
Args:
|
|
24
|
+
request (SetIamPolicyRequest):
|
|
25
|
+
The request object; initialized to empty instance if not specified.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
if request is None:
|
|
29
|
+
request = SetIamPolicyRequest()
|
|
30
|
+
|
|
31
|
+
return self._client.call("security.IamService", "SetIamPolicy", request, IamPolicy)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from kagglesdk.common.types.http_redirect import HttpRedirect
|
|
2
|
+
from kagglesdk.kaggle_http_client import KaggleHttpClient
|
|
3
|
+
from kagglesdk.security.types.oauth_service import ExchangeOAuthTokenRequest, ExchangeOAuthTokenResponse, IntrospectTokenRequest, IntrospectTokenResponse, RegisterOAuthClientRequest, RegisterOAuthClientResponse, StartOAuthFlowRequest
|
|
4
|
+
|
|
5
|
+
class OAuthClient(object):
|
|
6
|
+
|
|
7
|
+
def __init__(self, client: KaggleHttpClient):
|
|
8
|
+
self._client = client
|
|
9
|
+
|
|
10
|
+
def start_oauth_flow(self, request: StartOAuthFlowRequest = None) -> HttpRedirect:
|
|
11
|
+
r"""
|
|
12
|
+
Args:
|
|
13
|
+
request (StartOAuthFlowRequest):
|
|
14
|
+
The request object; initialized to empty instance if not specified.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
if request is None:
|
|
18
|
+
request = StartOAuthFlowRequest()
|
|
19
|
+
|
|
20
|
+
return self._client.call("security.OAuthService", "StartOAuthFlow", request, HttpRedirect)
|
|
21
|
+
|
|
22
|
+
def exchange_oauth_token(self, request: ExchangeOAuthTokenRequest = None) -> ExchangeOAuthTokenResponse:
|
|
23
|
+
r"""
|
|
24
|
+
Args:
|
|
25
|
+
request (ExchangeOAuthTokenRequest):
|
|
26
|
+
The request object; initialized to empty instance if not specified.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
if request is None:
|
|
30
|
+
request = ExchangeOAuthTokenRequest()
|
|
31
|
+
|
|
32
|
+
return self._client.call("security.OAuthService", "ExchangeOAuthToken", request, ExchangeOAuthTokenResponse)
|
|
33
|
+
|
|
34
|
+
def introspect_token(self, request: IntrospectTokenRequest = None) -> IntrospectTokenResponse:
|
|
35
|
+
r"""
|
|
36
|
+
Args:
|
|
37
|
+
request (IntrospectTokenRequest):
|
|
38
|
+
The request object; initialized to empty instance if not specified.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
if request is None:
|
|
42
|
+
request = IntrospectTokenRequest()
|
|
43
|
+
|
|
44
|
+
return self._client.call("security.OAuthService", "IntrospectToken", request, IntrospectTokenResponse)
|
|
45
|
+
|
|
46
|
+
def register_oauth_client(self, request: RegisterOAuthClientRequest = None) -> RegisterOAuthClientResponse:
|
|
47
|
+
r"""
|
|
48
|
+
Dynamic Client Registration Endpoint (RFC 7591)
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
request (RegisterOAuthClientRequest):
|
|
52
|
+
The request object; initialized to empty instance if not specified.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
if request is None:
|
|
56
|
+
request = RegisterOAuthClientRequest()
|
|
57
|
+
|
|
58
|
+
return self._client.call("security.OAuthService", "RegisterOAuthClient", request, RegisterOAuthClientResponse)
|
|
File without changes
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
from kagglesdk.kaggle_object import *
|
|
2
|
+
from typing import Optional, List
|
|
3
|
+
|
|
4
|
+
class AuthorizationPermissionScope(KaggleObject):
|
|
5
|
+
r"""
|
|
6
|
+
Attributes:
|
|
7
|
+
name (str)
|
|
8
|
+
description (str)
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self):
|
|
12
|
+
self._name = ""
|
|
13
|
+
self._description = None
|
|
14
|
+
self._freeze()
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def name(self) -> str:
|
|
18
|
+
return self._name
|
|
19
|
+
|
|
20
|
+
@name.setter
|
|
21
|
+
def name(self, name: str):
|
|
22
|
+
if name is None:
|
|
23
|
+
del self.name
|
|
24
|
+
return
|
|
25
|
+
if not isinstance(name, str):
|
|
26
|
+
raise TypeError('name must be of type str')
|
|
27
|
+
self._name = name
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def description(self) -> str:
|
|
31
|
+
return self._description or ""
|
|
32
|
+
|
|
33
|
+
@description.setter
|
|
34
|
+
def description(self, description: Optional[str]):
|
|
35
|
+
if description is None:
|
|
36
|
+
del self.description
|
|
37
|
+
return
|
|
38
|
+
if not isinstance(description, str):
|
|
39
|
+
raise TypeError('description must be of type str')
|
|
40
|
+
self._description = description
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class AuthorizationRoleScope(KaggleObject):
|
|
44
|
+
r"""
|
|
45
|
+
Attributes:
|
|
46
|
+
name (str)
|
|
47
|
+
description (str)
|
|
48
|
+
permissions (AuthorizationPermissionScope)
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
def __init__(self):
|
|
52
|
+
self._name = ""
|
|
53
|
+
self._description = None
|
|
54
|
+
self._permissions = []
|
|
55
|
+
self._freeze()
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def name(self) -> str:
|
|
59
|
+
return self._name
|
|
60
|
+
|
|
61
|
+
@name.setter
|
|
62
|
+
def name(self, name: str):
|
|
63
|
+
if name is None:
|
|
64
|
+
del self.name
|
|
65
|
+
return
|
|
66
|
+
if not isinstance(name, str):
|
|
67
|
+
raise TypeError('name must be of type str')
|
|
68
|
+
self._name = name
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def description(self) -> str:
|
|
72
|
+
return self._description or ""
|
|
73
|
+
|
|
74
|
+
@description.setter
|
|
75
|
+
def description(self, description: Optional[str]):
|
|
76
|
+
if description is None:
|
|
77
|
+
del self.description
|
|
78
|
+
return
|
|
79
|
+
if not isinstance(description, str):
|
|
80
|
+
raise TypeError('description must be of type str')
|
|
81
|
+
self._description = description
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def permissions(self) -> Optional[List[Optional['AuthorizationPermissionScope']]]:
|
|
85
|
+
return self._permissions
|
|
86
|
+
|
|
87
|
+
@permissions.setter
|
|
88
|
+
def permissions(self, permissions: Optional[List[Optional['AuthorizationPermissionScope']]]):
|
|
89
|
+
if permissions is None:
|
|
90
|
+
del self.permissions
|
|
91
|
+
return
|
|
92
|
+
if not isinstance(permissions, list):
|
|
93
|
+
raise TypeError('permissions must be of type list')
|
|
94
|
+
if not all([isinstance(t, AuthorizationPermissionScope) for t in permissions]):
|
|
95
|
+
raise TypeError('permissions must contain only items of type AuthorizationPermissionScope')
|
|
96
|
+
self._permissions = permissions
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class AuthorizationScope(KaggleObject):
|
|
100
|
+
r"""
|
|
101
|
+
Attributes:
|
|
102
|
+
resource_id (int)
|
|
103
|
+
permission (AuthorizationPermissionScope)
|
|
104
|
+
role (AuthorizationRoleScope)
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
def __init__(self):
|
|
108
|
+
self._resource_id = 0
|
|
109
|
+
self._permission = None
|
|
110
|
+
self._role = None
|
|
111
|
+
self._freeze()
|
|
112
|
+
|
|
113
|
+
@property
|
|
114
|
+
def resource_id(self) -> int:
|
|
115
|
+
return self._resource_id
|
|
116
|
+
|
|
117
|
+
@resource_id.setter
|
|
118
|
+
def resource_id(self, resource_id: int):
|
|
119
|
+
if resource_id is None:
|
|
120
|
+
del self.resource_id
|
|
121
|
+
return
|
|
122
|
+
if not isinstance(resource_id, int):
|
|
123
|
+
raise TypeError('resource_id must be of type int')
|
|
124
|
+
self._resource_id = resource_id
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def permission(self) -> Optional['AuthorizationPermissionScope']:
|
|
128
|
+
return self._permission or None
|
|
129
|
+
|
|
130
|
+
@permission.setter
|
|
131
|
+
def permission(self, permission: Optional['AuthorizationPermissionScope']):
|
|
132
|
+
if permission is None:
|
|
133
|
+
del self.permission
|
|
134
|
+
return
|
|
135
|
+
if not isinstance(permission, AuthorizationPermissionScope):
|
|
136
|
+
raise TypeError('permission must be of type AuthorizationPermissionScope')
|
|
137
|
+
del self.role
|
|
138
|
+
self._permission = permission
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def role(self) -> Optional['AuthorizationRoleScope']:
|
|
142
|
+
return self._role or None
|
|
143
|
+
|
|
144
|
+
@role.setter
|
|
145
|
+
def role(self, role: Optional['AuthorizationRoleScope']):
|
|
146
|
+
if role is None:
|
|
147
|
+
del self.role
|
|
148
|
+
return
|
|
149
|
+
if not isinstance(role, AuthorizationRoleScope):
|
|
150
|
+
raise TypeError('role must be of type AuthorizationRoleScope')
|
|
151
|
+
del self.permission
|
|
152
|
+
self._role = role
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
AuthorizationPermissionScope._fields = [
|
|
156
|
+
FieldMetadata("name", "name", "_name", str, "", PredefinedSerializer()),
|
|
157
|
+
FieldMetadata("description", "description", "_description", str, None, PredefinedSerializer(), optional=True),
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
AuthorizationRoleScope._fields = [
|
|
161
|
+
FieldMetadata("name", "name", "_name", str, "", PredefinedSerializer()),
|
|
162
|
+
FieldMetadata("description", "description", "_description", str, None, PredefinedSerializer(), optional=True),
|
|
163
|
+
FieldMetadata("permissions", "permissions", "_permissions", AuthorizationPermissionScope, [], ListSerializer(KaggleObjectSerializer())),
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
AuthorizationScope._fields = [
|
|
167
|
+
FieldMetadata("resourceId", "resource_id", "_resource_id", int, 0, PredefinedSerializer()),
|
|
168
|
+
FieldMetadata("permission", "permission", "_permission", AuthorizationPermissionScope, None, KaggleObjectSerializer(), optional=True),
|
|
169
|
+
FieldMetadata("role", "role", "_role", AuthorizationRoleScope, None, KaggleObjectSerializer(), optional=True),
|
|
170
|
+
]
|
|
171
|
+
|