kaggle 1.7.4.5__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 -598
- kaggle/api/kaggle_api_extended.py +5251 -4769
- kaggle/cli.py +1335 -1585
- kaggle/models/api_blob_type.py +3 -3
- kaggle/models/dataset_column.py +165 -174
- kaggle/models/dataset_new_request.py +83 -41
- kaggle/models/dataset_new_version_request.py +32 -25
- kaggle/models/dataset_update_settings_request.py +35 -27
- kaggle/models/kaggle_models_extended.py +169 -172
- kaggle/models/kernel_push_request.py +66 -49
- kaggle/models/model_instance_new_version_request.py +10 -18
- kaggle/models/model_instance_update_request.py +103 -34
- kaggle/models/model_new_instance_request.py +138 -41
- kaggle/models/model_new_request.py +35 -27
- kaggle/models/model_update_request.py +32 -25
- kaggle/models/start_blob_upload_request.py +192 -195
- kaggle/models/start_blob_upload_response.py +98 -98
- kaggle/models/upload_file.py +114 -120
- kaggle/test/test_authenticate.py +23 -23
- {kaggle-1.7.4.5.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 +554 -300
- 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 +46 -23
- kagglesdk/kaggle_creds.py +148 -0
- kagglesdk/kaggle_env.py +89 -25
- kagglesdk/kaggle_http_client.py +216 -306
- kagglesdk/kaggle_oauth.py +200 -0
- kagglesdk/kaggle_object.py +286 -293
- kagglesdk/kernels/services/kernels_api_service.py +46 -9
- kagglesdk/kernels/types/kernels_api_service.py +635 -159
- 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 +41 -17
- kagglesdk/models/types/model_api_service.py +987 -637
- 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/services/iam_service.py +31 -0
- kagglesdk/security/services/oauth_service.py +27 -1
- kagglesdk/security/types/authentication.py +63 -63
- kagglesdk/security/types/iam_service.py +496 -0
- kagglesdk/security/types/oauth_service.py +797 -10
- 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 -22
- kagglesdk/users/services/account_service.py +13 -1
- kagglesdk/users/services/group_api_service.py +31 -0
- kagglesdk/users/types/account_service.py +169 -28
- 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.5.dist-info/RECORD +0 -98
- {kaggle-1.7.4.5.dist-info → kaggle-1.8.0.dist-info}/WHEEL +0 -0
- {kaggle-1.7.4.5.dist-info → kaggle-1.8.0.dist-info}/entry_points.txt +0 -0
- {kaggle-1.7.4.5.dist-info → kaggle-1.8.0.dist-info}/licenses/LICENSE.txt +0 -0
- {kaggle/test → kagglesdk/benchmarks}/__init__.py +0 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
from kagglesdk.benchmarks.types.benchmark_types import BenchmarkResult
|
|
2
|
+
from kagglesdk.kaggle_object import *
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
class ApiBenchmarkLeaderboard(KaggleObject):
|
|
6
|
+
r"""
|
|
7
|
+
Attributes:
|
|
8
|
+
rows (ApiBenchmarkLeaderboard.LeaderboardRow)
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
class LeaderboardRow(KaggleObject):
|
|
12
|
+
r"""
|
|
13
|
+
Attributes:
|
|
14
|
+
model_version_name (str)
|
|
15
|
+
model_version_slug (str)
|
|
16
|
+
task_results (ApiBenchmarkLeaderboard.TaskResult)
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(self):
|
|
20
|
+
self._model_version_name = ""
|
|
21
|
+
self._model_version_slug = ""
|
|
22
|
+
self._task_results = []
|
|
23
|
+
self._freeze()
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def model_version_name(self) -> str:
|
|
27
|
+
return self._model_version_name
|
|
28
|
+
|
|
29
|
+
@model_version_name.setter
|
|
30
|
+
def model_version_name(self, model_version_name: str):
|
|
31
|
+
if model_version_name is None:
|
|
32
|
+
del self.model_version_name
|
|
33
|
+
return
|
|
34
|
+
if not isinstance(model_version_name, str):
|
|
35
|
+
raise TypeError('model_version_name must be of type str')
|
|
36
|
+
self._model_version_name = model_version_name
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def model_version_slug(self) -> str:
|
|
40
|
+
return self._model_version_slug
|
|
41
|
+
|
|
42
|
+
@model_version_slug.setter
|
|
43
|
+
def model_version_slug(self, model_version_slug: str):
|
|
44
|
+
if model_version_slug is None:
|
|
45
|
+
del self.model_version_slug
|
|
46
|
+
return
|
|
47
|
+
if not isinstance(model_version_slug, str):
|
|
48
|
+
raise TypeError('model_version_slug must be of type str')
|
|
49
|
+
self._model_version_slug = model_version_slug
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def task_results(self) -> Optional[List[Optional['ApiBenchmarkLeaderboard.TaskResult']]]:
|
|
53
|
+
return self._task_results
|
|
54
|
+
|
|
55
|
+
@task_results.setter
|
|
56
|
+
def task_results(self, task_results: Optional[List[Optional['ApiBenchmarkLeaderboard.TaskResult']]]):
|
|
57
|
+
if task_results is None:
|
|
58
|
+
del self.task_results
|
|
59
|
+
return
|
|
60
|
+
if not isinstance(task_results, list):
|
|
61
|
+
raise TypeError('task_results must be of type list')
|
|
62
|
+
if not all([isinstance(t, ApiBenchmarkLeaderboard.TaskResult) for t in task_results]):
|
|
63
|
+
raise TypeError('task_results must contain only items of type ApiBenchmarkLeaderboard.TaskResult')
|
|
64
|
+
self._task_results = task_results
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class TaskResult(KaggleObject):
|
|
68
|
+
r"""
|
|
69
|
+
Attributes:
|
|
70
|
+
benchmark_task_name (str)
|
|
71
|
+
benchmark_task_slug (str)
|
|
72
|
+
task_version (int)
|
|
73
|
+
result (BenchmarkResult)
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
def __init__(self):
|
|
77
|
+
self._benchmark_task_name = ""
|
|
78
|
+
self._benchmark_task_slug = ""
|
|
79
|
+
self._task_version = 0
|
|
80
|
+
self._result = None
|
|
81
|
+
self._freeze()
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def benchmark_task_name(self) -> str:
|
|
85
|
+
return self._benchmark_task_name
|
|
86
|
+
|
|
87
|
+
@benchmark_task_name.setter
|
|
88
|
+
def benchmark_task_name(self, benchmark_task_name: str):
|
|
89
|
+
if benchmark_task_name is None:
|
|
90
|
+
del self.benchmark_task_name
|
|
91
|
+
return
|
|
92
|
+
if not isinstance(benchmark_task_name, str):
|
|
93
|
+
raise TypeError('benchmark_task_name must be of type str')
|
|
94
|
+
self._benchmark_task_name = benchmark_task_name
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def benchmark_task_slug(self) -> str:
|
|
98
|
+
return self._benchmark_task_slug
|
|
99
|
+
|
|
100
|
+
@benchmark_task_slug.setter
|
|
101
|
+
def benchmark_task_slug(self, benchmark_task_slug: str):
|
|
102
|
+
if benchmark_task_slug is None:
|
|
103
|
+
del self.benchmark_task_slug
|
|
104
|
+
return
|
|
105
|
+
if not isinstance(benchmark_task_slug, str):
|
|
106
|
+
raise TypeError('benchmark_task_slug must be of type str')
|
|
107
|
+
self._benchmark_task_slug = benchmark_task_slug
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def task_version(self) -> int:
|
|
111
|
+
return self._task_version
|
|
112
|
+
|
|
113
|
+
@task_version.setter
|
|
114
|
+
def task_version(self, task_version: int):
|
|
115
|
+
if task_version is None:
|
|
116
|
+
del self.task_version
|
|
117
|
+
return
|
|
118
|
+
if not isinstance(task_version, int):
|
|
119
|
+
raise TypeError('task_version must be of type int')
|
|
120
|
+
self._task_version = task_version
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def result(self) -> Optional['BenchmarkResult']:
|
|
124
|
+
return self._result
|
|
125
|
+
|
|
126
|
+
@result.setter
|
|
127
|
+
def result(self, result: Optional['BenchmarkResult']):
|
|
128
|
+
if result is None:
|
|
129
|
+
del self.result
|
|
130
|
+
return
|
|
131
|
+
if not isinstance(result, BenchmarkResult):
|
|
132
|
+
raise TypeError('result must be of type BenchmarkResult')
|
|
133
|
+
self._result = result
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def __init__(self):
|
|
137
|
+
self._rows = []
|
|
138
|
+
self._freeze()
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def rows(self) -> Optional[List[Optional['ApiBenchmarkLeaderboard.LeaderboardRow']]]:
|
|
142
|
+
return self._rows
|
|
143
|
+
|
|
144
|
+
@rows.setter
|
|
145
|
+
def rows(self, rows: Optional[List[Optional['ApiBenchmarkLeaderboard.LeaderboardRow']]]):
|
|
146
|
+
if rows is None:
|
|
147
|
+
del self.rows
|
|
148
|
+
return
|
|
149
|
+
if not isinstance(rows, list):
|
|
150
|
+
raise TypeError('rows must be of type list')
|
|
151
|
+
if not all([isinstance(t, ApiBenchmarkLeaderboard.LeaderboardRow) for t in rows]):
|
|
152
|
+
raise TypeError('rows must contain only items of type ApiBenchmarkLeaderboard.LeaderboardRow')
|
|
153
|
+
self._rows = rows
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class ApiGetBenchmarkLeaderboardRequest(KaggleObject):
|
|
157
|
+
r"""
|
|
158
|
+
Attributes:
|
|
159
|
+
owner_slug (str)
|
|
160
|
+
benchmark_slug (str)
|
|
161
|
+
version_number (int)
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
def __init__(self):
|
|
165
|
+
self._owner_slug = ""
|
|
166
|
+
self._benchmark_slug = ""
|
|
167
|
+
self._version_number = None
|
|
168
|
+
self._freeze()
|
|
169
|
+
|
|
170
|
+
@property
|
|
171
|
+
def owner_slug(self) -> str:
|
|
172
|
+
return self._owner_slug
|
|
173
|
+
|
|
174
|
+
@owner_slug.setter
|
|
175
|
+
def owner_slug(self, owner_slug: str):
|
|
176
|
+
if owner_slug is None:
|
|
177
|
+
del self.owner_slug
|
|
178
|
+
return
|
|
179
|
+
if not isinstance(owner_slug, str):
|
|
180
|
+
raise TypeError('owner_slug must be of type str')
|
|
181
|
+
self._owner_slug = owner_slug
|
|
182
|
+
|
|
183
|
+
@property
|
|
184
|
+
def benchmark_slug(self) -> str:
|
|
185
|
+
return self._benchmark_slug
|
|
186
|
+
|
|
187
|
+
@benchmark_slug.setter
|
|
188
|
+
def benchmark_slug(self, benchmark_slug: str):
|
|
189
|
+
if benchmark_slug is None:
|
|
190
|
+
del self.benchmark_slug
|
|
191
|
+
return
|
|
192
|
+
if not isinstance(benchmark_slug, str):
|
|
193
|
+
raise TypeError('benchmark_slug must be of type str')
|
|
194
|
+
self._benchmark_slug = benchmark_slug
|
|
195
|
+
|
|
196
|
+
@property
|
|
197
|
+
def version_number(self) -> int:
|
|
198
|
+
return self._version_number or 0
|
|
199
|
+
|
|
200
|
+
@version_number.setter
|
|
201
|
+
def version_number(self, version_number: Optional[int]):
|
|
202
|
+
if version_number is None:
|
|
203
|
+
del self.version_number
|
|
204
|
+
return
|
|
205
|
+
if not isinstance(version_number, int):
|
|
206
|
+
raise TypeError('version_number must be of type int')
|
|
207
|
+
self._version_number = version_number
|
|
208
|
+
|
|
209
|
+
def endpoint(self):
|
|
210
|
+
if self.version_number:
|
|
211
|
+
path = '/api/v1/benchmarks/{owner_slug}/{benchmark_slug}/versions/{version_number}/leaderboard'
|
|
212
|
+
else:
|
|
213
|
+
path = '/api/v1/benchmarks/{owner_slug}/{benchmark_slug}/leaderboard'
|
|
214
|
+
return path.format_map(self.to_field_map(self))
|
|
215
|
+
|
|
216
|
+
@staticmethod
|
|
217
|
+
def endpoint_path():
|
|
218
|
+
return '/api/v1/benchmarks/{owner_slug}/{benchmark_slug}/leaderboard'
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
ApiBenchmarkLeaderboard.LeaderboardRow._fields = [
|
|
222
|
+
FieldMetadata("modelVersionName", "model_version_name", "_model_version_name", str, "", PredefinedSerializer()),
|
|
223
|
+
FieldMetadata("modelVersionSlug", "model_version_slug", "_model_version_slug", str, "", PredefinedSerializer()),
|
|
224
|
+
FieldMetadata("taskResults", "task_results", "_task_results", ApiBenchmarkLeaderboard.TaskResult, [], ListSerializer(KaggleObjectSerializer())),
|
|
225
|
+
]
|
|
226
|
+
|
|
227
|
+
ApiBenchmarkLeaderboard.TaskResult._fields = [
|
|
228
|
+
FieldMetadata("benchmarkTaskName", "benchmark_task_name", "_benchmark_task_name", str, "", PredefinedSerializer()),
|
|
229
|
+
FieldMetadata("benchmarkTaskSlug", "benchmark_task_slug", "_benchmark_task_slug", str, "", PredefinedSerializer()),
|
|
230
|
+
FieldMetadata("taskVersion", "task_version", "_task_version", int, 0, PredefinedSerializer()),
|
|
231
|
+
FieldMetadata("result", "result", "_result", BenchmarkResult, None, KaggleObjectSerializer()),
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
ApiBenchmarkLeaderboard._fields = [
|
|
235
|
+
FieldMetadata("rows", "rows", "_rows", ApiBenchmarkLeaderboard.LeaderboardRow, [], ListSerializer(KaggleObjectSerializer())),
|
|
236
|
+
]
|
|
237
|
+
|
|
238
|
+
ApiGetBenchmarkLeaderboardRequest._fields = [
|
|
239
|
+
FieldMetadata("ownerSlug", "owner_slug", "_owner_slug", str, "", PredefinedSerializer()),
|
|
240
|
+
FieldMetadata("benchmarkSlug", "benchmark_slug", "_benchmark_slug", str, "", PredefinedSerializer()),
|
|
241
|
+
FieldMetadata("versionNumber", "version_number", "_version_number", int, None, PredefinedSerializer(), optional=True),
|
|
242
|
+
]
|
|
243
|
+
|
|
@@ -22,4 +22,4 @@ class BlobApiClient(object):
|
|
|
22
22
|
if request is None:
|
|
23
23
|
request = ApiStartBlobUploadRequest()
|
|
24
24
|
|
|
25
|
-
return self._client.call("blobs.BlobApiService", "
|
|
25
|
+
return self._client.call("blobs.BlobApiService", "StartBlobUpload", request, ApiStartBlobUploadResponse)
|
|
@@ -65,7 +65,7 @@ class ApiStartBlobUploadRequest(KaggleObject):
|
|
|
65
65
|
return self._content_type or ""
|
|
66
66
|
|
|
67
67
|
@content_type.setter
|
|
68
|
-
def content_type(self, content_type: str):
|
|
68
|
+
def content_type(self, content_type: Optional[str]):
|
|
69
69
|
if content_type is None:
|
|
70
70
|
del self.content_type
|
|
71
71
|
return
|
|
@@ -93,7 +93,7 @@ class ApiStartBlobUploadRequest(KaggleObject):
|
|
|
93
93
|
return self._last_modified_epoch_seconds or 0
|
|
94
94
|
|
|
95
95
|
@last_modified_epoch_seconds.setter
|
|
96
|
-
def last_modified_epoch_seconds(self, last_modified_epoch_seconds: int):
|
|
96
|
+
def last_modified_epoch_seconds(self, last_modified_epoch_seconds: Optional[int]):
|
|
97
97
|
if last_modified_epoch_seconds is None:
|
|
98
98
|
del self.last_modified_epoch_seconds
|
|
99
99
|
return
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from kagglesdk.common.types.operations import Operation
|
|
2
|
+
from kagglesdk.common.types.operations_service import GetOperationRequest
|
|
3
|
+
from kagglesdk.kaggle_http_client import KaggleHttpClient
|
|
4
|
+
|
|
5
|
+
class OperationsClient(object):
|
|
6
|
+
r"""
|
|
7
|
+
Manages long-running operations with an API service.
|
|
8
|
+
|
|
9
|
+
When an API method normally takes long time to complete, it can be designed
|
|
10
|
+
to return [Operation][google.longrunning.Operation] to the client, and the
|
|
11
|
+
client can use this interface to receive the real response asynchronously by
|
|
12
|
+
polling the operation resource, or pass the operation resource to another API
|
|
13
|
+
(such as Pub/Sub API) to receive the response. Any API service that returns
|
|
14
|
+
long-running operations should implement the `Operations` interface so
|
|
15
|
+
developers can have a consistent client experience.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self, client: KaggleHttpClient):
|
|
19
|
+
self._client = client
|
|
20
|
+
|
|
21
|
+
def get_operation(self, request: GetOperationRequest = None, name: str = None) -> Operation:
|
|
22
|
+
r"""
|
|
23
|
+
Gets the latest state of a long-running operation. Clients can use this
|
|
24
|
+
method to poll the operation result at intervals as recommended by the API
|
|
25
|
+
service.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
request (GetOperationRequest):
|
|
29
|
+
The request object; initialized to empty instance if not specified.
|
|
30
|
+
May not be specified if any of the flattened field params are specified.
|
|
31
|
+
name (str)
|
|
32
|
+
This corresponds to the ``name`` field on the ``request`` instance;
|
|
33
|
+
if ``request`` is provided, this should not be set.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
has_flattened_args = any([name])
|
|
37
|
+
if request is not None and has_flattened_args:
|
|
38
|
+
raise ValueError('If the `request` argument is set, then none of '
|
|
39
|
+
'the individual field arguments should be set.')
|
|
40
|
+
|
|
41
|
+
if request is None:
|
|
42
|
+
request = GetOperationRequest()
|
|
43
|
+
if name is not None:
|
|
44
|
+
request.name = name
|
|
45
|
+
|
|
46
|
+
return self._client.call("common.OperationsService", "GetOperation", request, Operation)
|
|
@@ -80,7 +80,7 @@ class FileDownload(KaggleObject):
|
|
|
80
80
|
return self._content_length or 0
|
|
81
81
|
|
|
82
82
|
@content_length.setter
|
|
83
|
-
def content_length(self, content_length: int):
|
|
83
|
+
def content_length(self, content_length: Optional[int]):
|
|
84
84
|
if content_length is None:
|
|
85
85
|
del self.content_length
|
|
86
86
|
return
|
|
@@ -69,7 +69,7 @@ class HttpRedirect(KaggleObject):
|
|
|
69
69
|
return self._bypass_encoding or False
|
|
70
70
|
|
|
71
71
|
@bypass_encoding.setter
|
|
72
|
-
def bypass_encoding(self, bypass_encoding: bool):
|
|
72
|
+
def bypass_encoding(self, bypass_encoding: Optional[bool]):
|
|
73
73
|
if bypass_encoding is None:
|
|
74
74
|
del self.bypass_encoding
|
|
75
75
|
return
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
from kagglesdk.kaggle_object import *
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
class Operation(KaggleObject):
|
|
5
|
+
r"""
|
|
6
|
+
This resource represents a long-running operation that is the result of a
|
|
7
|
+
network API call.
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
name (str)
|
|
11
|
+
The server-assigned name, which is only unique within the same service that
|
|
12
|
+
originally returns it. If you use the default HTTP mapping, the
|
|
13
|
+
`name` should be a resource name ending with `operations/{unique_id}`.
|
|
14
|
+
metadata (object)
|
|
15
|
+
Service-specific metadata associated with the operation. It typically
|
|
16
|
+
contains progress information and common metadata such as create time.
|
|
17
|
+
Some services might not provide such metadata. Any method that returns a
|
|
18
|
+
long-running operation should document the metadata type, if any.
|
|
19
|
+
done (bool)
|
|
20
|
+
If the value is `false`, it means the operation is still in progress.
|
|
21
|
+
If `true`, the operation is completed, and either `error` or `response` is
|
|
22
|
+
available.
|
|
23
|
+
error (Operation.Status)
|
|
24
|
+
The error result of the operation in case of failure or cancellation.
|
|
25
|
+
response (object)
|
|
26
|
+
The normal, successful response of the operation. If the original
|
|
27
|
+
method returns no data on success, such as `Delete`, the response is
|
|
28
|
+
`google.protobuf.Empty`. If the original method is standard
|
|
29
|
+
`Get`/`Create`/`Update`, the response should be the resource. For other
|
|
30
|
+
methods, the response should have the type `XxxResponse`, where `Xxx`
|
|
31
|
+
is the original method name. For example, if the original method name
|
|
32
|
+
is `TakeSnapshot()`, the inferred response type is
|
|
33
|
+
`TakeSnapshotResponse`.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
class Status(KaggleObject):
|
|
37
|
+
r"""
|
|
38
|
+
Attributes:
|
|
39
|
+
code (int)
|
|
40
|
+
The HTTP status code that corresponds to `google.rpc.Status.code`.
|
|
41
|
+
message (str)
|
|
42
|
+
This corresponds to `google.rpc.Status.message`.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
def __init__(self):
|
|
46
|
+
self._code = 0
|
|
47
|
+
self._message = ""
|
|
48
|
+
self._freeze()
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def code(self) -> int:
|
|
52
|
+
"""The HTTP status code that corresponds to `google.rpc.Status.code`."""
|
|
53
|
+
return self._code
|
|
54
|
+
|
|
55
|
+
@code.setter
|
|
56
|
+
def code(self, code: int):
|
|
57
|
+
if code is None:
|
|
58
|
+
del self.code
|
|
59
|
+
return
|
|
60
|
+
if not isinstance(code, int):
|
|
61
|
+
raise TypeError('code must be of type int')
|
|
62
|
+
self._code = code
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def message(self) -> str:
|
|
66
|
+
"""This corresponds to `google.rpc.Status.message`."""
|
|
67
|
+
return self._message
|
|
68
|
+
|
|
69
|
+
@message.setter
|
|
70
|
+
def message(self, message: str):
|
|
71
|
+
if message is None:
|
|
72
|
+
del self.message
|
|
73
|
+
return
|
|
74
|
+
if not isinstance(message, str):
|
|
75
|
+
raise TypeError('message must be of type str')
|
|
76
|
+
self._message = message
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def __init__(self):
|
|
80
|
+
self._name = ""
|
|
81
|
+
self._metadata = None
|
|
82
|
+
self._done = False
|
|
83
|
+
self._error = None
|
|
84
|
+
self._response = None
|
|
85
|
+
self._freeze()
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def name(self) -> str:
|
|
89
|
+
r"""
|
|
90
|
+
The server-assigned name, which is only unique within the same service that
|
|
91
|
+
originally returns it. If you use the default HTTP mapping, the
|
|
92
|
+
`name` should be a resource name ending with `operations/{unique_id}`.
|
|
93
|
+
"""
|
|
94
|
+
return self._name
|
|
95
|
+
|
|
96
|
+
@name.setter
|
|
97
|
+
def name(self, name: str):
|
|
98
|
+
if name is None:
|
|
99
|
+
del self.name
|
|
100
|
+
return
|
|
101
|
+
if not isinstance(name, str):
|
|
102
|
+
raise TypeError('name must be of type str')
|
|
103
|
+
self._name = name
|
|
104
|
+
|
|
105
|
+
@property
|
|
106
|
+
def metadata(self) -> object:
|
|
107
|
+
r"""
|
|
108
|
+
Service-specific metadata associated with the operation. It typically
|
|
109
|
+
contains progress information and common metadata such as create time.
|
|
110
|
+
Some services might not provide such metadata. Any method that returns a
|
|
111
|
+
long-running operation should document the metadata type, if any.
|
|
112
|
+
"""
|
|
113
|
+
return self._metadata
|
|
114
|
+
|
|
115
|
+
@metadata.setter
|
|
116
|
+
def metadata(self, metadata: object):
|
|
117
|
+
if metadata is None:
|
|
118
|
+
del self.metadata
|
|
119
|
+
return
|
|
120
|
+
if not isinstance(metadata, object):
|
|
121
|
+
raise TypeError('metadata must be of type object')
|
|
122
|
+
self._metadata = metadata
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def done(self) -> bool:
|
|
126
|
+
r"""
|
|
127
|
+
If the value is `false`, it means the operation is still in progress.
|
|
128
|
+
If `true`, the operation is completed, and either `error` or `response` is
|
|
129
|
+
available.
|
|
130
|
+
"""
|
|
131
|
+
return self._done
|
|
132
|
+
|
|
133
|
+
@done.setter
|
|
134
|
+
def done(self, done: bool):
|
|
135
|
+
if done is None:
|
|
136
|
+
del self.done
|
|
137
|
+
return
|
|
138
|
+
if not isinstance(done, bool):
|
|
139
|
+
raise TypeError('done must be of type bool')
|
|
140
|
+
self._done = done
|
|
141
|
+
|
|
142
|
+
@property
|
|
143
|
+
def error(self) -> Optional['Operation.Status']:
|
|
144
|
+
"""The error result of the operation in case of failure or cancellation."""
|
|
145
|
+
return self._error or None
|
|
146
|
+
|
|
147
|
+
@error.setter
|
|
148
|
+
def error(self, error: Optional['Operation.Status']):
|
|
149
|
+
if error is None:
|
|
150
|
+
del self.error
|
|
151
|
+
return
|
|
152
|
+
if not isinstance(error, Operation.Status):
|
|
153
|
+
raise TypeError('error must be of type Operation.Status')
|
|
154
|
+
del self.response
|
|
155
|
+
self._error = error
|
|
156
|
+
|
|
157
|
+
@property
|
|
158
|
+
def response(self) -> object:
|
|
159
|
+
r"""
|
|
160
|
+
The normal, successful response of the operation. If the original
|
|
161
|
+
method returns no data on success, such as `Delete`, the response is
|
|
162
|
+
`google.protobuf.Empty`. If the original method is standard
|
|
163
|
+
`Get`/`Create`/`Update`, the response should be the resource. For other
|
|
164
|
+
methods, the response should have the type `XxxResponse`, where `Xxx`
|
|
165
|
+
is the original method name. For example, if the original method name
|
|
166
|
+
is `TakeSnapshot()`, the inferred response type is
|
|
167
|
+
`TakeSnapshotResponse`.
|
|
168
|
+
"""
|
|
169
|
+
return self._response or None
|
|
170
|
+
|
|
171
|
+
@response.setter
|
|
172
|
+
def response(self, response: object):
|
|
173
|
+
if response is None:
|
|
174
|
+
del self.response
|
|
175
|
+
return
|
|
176
|
+
if not isinstance(response, object):
|
|
177
|
+
raise TypeError('response must be of type object')
|
|
178
|
+
del self.error
|
|
179
|
+
self._response = response
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
Operation.Status._fields = [
|
|
183
|
+
FieldMetadata("code", "code", "_code", int, 0, PredefinedSerializer()),
|
|
184
|
+
FieldMetadata("message", "message", "_message", str, "", PredefinedSerializer()),
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
Operation._fields = [
|
|
188
|
+
FieldMetadata("name", "name", "_name", str, "", PredefinedSerializer()),
|
|
189
|
+
FieldMetadata("metadata", "metadata", "_metadata", object, None, PredefinedSerializer()),
|
|
190
|
+
FieldMetadata("done", "done", "_done", bool, False, PredefinedSerializer()),
|
|
191
|
+
FieldMetadata("error", "error", "_error", Operation.Status, None, KaggleObjectSerializer(), optional=True),
|
|
192
|
+
FieldMetadata("response", "response", "_response", object, None, PredefinedSerializer(), optional=True),
|
|
193
|
+
]
|
|
194
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from kagglesdk.kaggle_object import *
|
|
2
|
+
|
|
3
|
+
class GetOperationRequest(KaggleObject):
|
|
4
|
+
r"""
|
|
5
|
+
The request message for
|
|
6
|
+
[Operations.GetOperation][google.longrunning.Operations.GetOperation].
|
|
7
|
+
|
|
8
|
+
Attributes:
|
|
9
|
+
name (str)
|
|
10
|
+
The name of the operation resource.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self):
|
|
14
|
+
self._name = ""
|
|
15
|
+
self._freeze()
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def name(self) -> str:
|
|
19
|
+
"""The name of the operation resource."""
|
|
20
|
+
return self._name
|
|
21
|
+
|
|
22
|
+
@name.setter
|
|
23
|
+
def name(self, name: str):
|
|
24
|
+
if name is None:
|
|
25
|
+
del self.name
|
|
26
|
+
return
|
|
27
|
+
if not isinstance(name, str):
|
|
28
|
+
raise TypeError('name must be of type str')
|
|
29
|
+
self._name = name
|
|
30
|
+
|
|
31
|
+
def endpoint(self):
|
|
32
|
+
path = '/api/v1/operations/get'
|
|
33
|
+
return path.format_map(self.to_field_map(self))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def method():
|
|
38
|
+
return 'POST'
|
|
39
|
+
|
|
40
|
+
@staticmethod
|
|
41
|
+
def body_fields():
|
|
42
|
+
return '*'
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
GetOperationRequest._fields = [
|
|
46
|
+
FieldMetadata("name", "name", "_name", str, "", PredefinedSerializer()),
|
|
47
|
+
]
|
|
48
|
+
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
class ContentState(enum.Enum):
|
|
4
|
+
"""Keep synced with /Kaggle.Sdk/cloud/kaggle/moderation/sor.proto"""
|
|
5
|
+
CONTENT_STATE_UNSPECIFIED = 0
|
|
6
|
+
PENDING_CLASSIFICATION = 1
|
|
7
|
+
r"""
|
|
8
|
+
Awaiting abuse classification. This exists as a non-visible state prior to
|
|
9
|
+
classification.
|
|
10
|
+
"""
|
|
11
|
+
PUBLISHED = 2
|
|
12
|
+
r"""
|
|
13
|
+
Publicly viewable, although access may be restricted outside of its content
|
|
14
|
+
state.
|
|
15
|
+
"""
|
|
16
|
+
TEMPORARILY_QUARANTINED = 3
|
|
17
|
+
r"""
|
|
18
|
+
Quarantined by an admin or by the system. This means that the content is
|
|
19
|
+
only visible to the user and admins, however users are able to toggle their
|
|
20
|
+
content out of this state.
|
|
21
|
+
"""
|
|
22
|
+
PERMANENTLY_QUARANTINED = 4
|
|
23
|
+
r"""
|
|
24
|
+
Quarantined by an admin or by the system, the user cannot toggle their
|
|
25
|
+
content's state back to public.
|
|
26
|
+
"""
|
|
27
|
+
USER_DELETED = 5
|
|
28
|
+
"""Deleted by the user."""
|
|
29
|
+
SYSTEM_DELETED = 6
|
|
30
|
+
"""Deleted by an admin or by a system account."""
|
|
31
|
+
PENDING_PERMANENT_DELETE = 7
|
|
32
|
+
"""Awaiting hard deletion."""
|
|
33
|
+
DRAFT = 8
|
|
34
|
+
r"""
|
|
35
|
+
Initial state of entity that has never been previously published.
|
|
36
|
+
Unable to return back to Draft state once published.
|
|
37
|
+
State flow chart example: http://screen/8vDypV7HPeuHBFK
|
|
38
|
+
"""
|
|
39
|
+
UNPUBLISHED = 9
|
|
40
|
+
r"""
|
|
41
|
+
Intermediate stage that has either been upgraded from the Draft state or
|
|
42
|
+
downgraded from the Published state.
|
|
43
|
+
"""
|
|
44
|
+
|