kaggle 1.7.3b1__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/LICENSE +201 -0
- kaggle/__init__.py +6 -0
- kaggle/api/__init__.py +0 -0
- kaggle/api/kaggle_api.py +614 -0
- kaggle/api/kaggle_api_extended.py +4657 -0
- kaggle/cli.py +1606 -0
- kaggle/configuration.py +206 -0
- kaggle/models/__init__.py +0 -0
- kaggle/models/api_blob_type.py +4 -0
- kaggle/models/dataset_column.py +228 -0
- kaggle/models/dataset_new_request.py +385 -0
- kaggle/models/dataset_new_version_request.py +287 -0
- kaggle/models/dataset_update_settings_request.py +310 -0
- kaggle/models/kaggle_models_extended.py +276 -0
- kaggle/models/kernel_push_request.py +556 -0
- kaggle/models/model_instance_new_version_request.py +145 -0
- kaggle/models/model_instance_update_request.py +351 -0
- kaggle/models/model_new_instance_request.py +417 -0
- kaggle/models/model_new_request.py +314 -0
- kaggle/models/model_update_request.py +282 -0
- kaggle/models/start_blob_upload_request.py +232 -0
- kaggle/models/start_blob_upload_response.py +137 -0
- kaggle/models/upload_file.py +169 -0
- kaggle/test/__init__.py +0 -0
- kaggle/test/test_authenticate.py +43 -0
- kaggle-1.7.3b1.dist-info/METADATA +348 -0
- kaggle-1.7.3b1.dist-info/RECORD +89 -0
- kaggle-1.7.3b1.dist-info/WHEEL +4 -0
- kaggle-1.7.3b1.dist-info/entry_points.txt +2 -0
- kaggle-1.7.3b1.dist-info/licenses/LICENSE.txt +201 -0
- kagglesdk/LICENSE +201 -0
- kagglesdk/__init__.py +2 -0
- kagglesdk/admin/__init__.py +0 -0
- kagglesdk/admin/services/__init__.py +0 -0
- kagglesdk/admin/services/inbox_file_service.py +22 -0
- kagglesdk/admin/types/__init__.py +0 -0
- kagglesdk/admin/types/inbox_file_service.py +74 -0
- kagglesdk/blobs/__init__.py +0 -0
- kagglesdk/blobs/services/__init__.py +0 -0
- kagglesdk/blobs/services/blob_api_service.py +25 -0
- kagglesdk/blobs/types/__init__.py +0 -0
- kagglesdk/blobs/types/blob_api_service.py +177 -0
- kagglesdk/common/__init__.py +0 -0
- kagglesdk/common/types/__init__.py +0 -0
- kagglesdk/common/types/file_download.py +102 -0
- kagglesdk/common/types/http_redirect.py +105 -0
- kagglesdk/competitions/__init__.py +0 -0
- kagglesdk/competitions/services/__init__.py +0 -0
- kagglesdk/competitions/services/competition_api_service.py +129 -0
- kagglesdk/competitions/types/__init__.py +0 -0
- kagglesdk/competitions/types/competition_api_service.py +1874 -0
- kagglesdk/competitions/types/competition_enums.py +53 -0
- kagglesdk/competitions/types/submission_status.py +9 -0
- kagglesdk/datasets/__init__.py +0 -0
- kagglesdk/datasets/services/__init__.py +0 -0
- kagglesdk/datasets/services/dataset_api_service.py +170 -0
- kagglesdk/datasets/types/__init__.py +0 -0
- kagglesdk/datasets/types/dataset_api_service.py +2777 -0
- kagglesdk/datasets/types/dataset_enums.py +82 -0
- kagglesdk/datasets/types/dataset_types.py +646 -0
- kagglesdk/education/__init__.py +0 -0
- kagglesdk/education/services/__init__.py +0 -0
- kagglesdk/education/services/education_api_service.py +19 -0
- kagglesdk/education/types/__init__.py +0 -0
- kagglesdk/education/types/education_api_service.py +248 -0
- kagglesdk/education/types/education_service.py +139 -0
- kagglesdk/kaggle_client.py +66 -0
- kagglesdk/kaggle_env.py +42 -0
- kagglesdk/kaggle_http_client.py +316 -0
- kagglesdk/kaggle_object.py +293 -0
- kagglesdk/kernels/__init__.py +0 -0
- kagglesdk/kernels/services/__init__.py +0 -0
- kagglesdk/kernels/services/kernels_api_service.py +109 -0
- kagglesdk/kernels/types/__init__.py +0 -0
- kagglesdk/kernels/types/kernels_api_service.py +1951 -0
- kagglesdk/kernels/types/kernels_enums.py +33 -0
- kagglesdk/models/__init__.py +0 -0
- kagglesdk/models/services/__init__.py +0 -0
- kagglesdk/models/services/model_api_service.py +255 -0
- kagglesdk/models/services/model_service.py +19 -0
- kagglesdk/models/types/__init__.py +0 -0
- kagglesdk/models/types/model_api_service.py +3719 -0
- kagglesdk/models/types/model_enums.py +60 -0
- kagglesdk/models/types/model_service.py +275 -0
- kagglesdk/models/types/model_types.py +286 -0
- kagglesdk/test/test_client.py +45 -0
- kagglesdk/users/__init__.py +0 -0
- kagglesdk/users/types/__init__.py +0 -0
- kagglesdk/users/types/users_enums.py +22 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2024 Kaggle Inc
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# coding: utf-8
|
|
18
|
+
|
|
19
|
+
import pprint
|
|
20
|
+
import re # noqa: F401
|
|
21
|
+
|
|
22
|
+
import six
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class StartBlobUploadRequest(object):
|
|
26
|
+
"""
|
|
27
|
+
Attributes:
|
|
28
|
+
project_types (dict): The key is attribute name
|
|
29
|
+
and the value is attribute type.
|
|
30
|
+
attribute_map (dict): The key is attribute name
|
|
31
|
+
and the value is json key in definition.
|
|
32
|
+
"""
|
|
33
|
+
project_types = {
|
|
34
|
+
'type': 'object',
|
|
35
|
+
'name': 'str',
|
|
36
|
+
'content_length': 'int',
|
|
37
|
+
'content_type': 'str',
|
|
38
|
+
'last_modified_epoch_seconds': 'int'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
attribute_map = {
|
|
42
|
+
'type': 'type',
|
|
43
|
+
'name': 'name',
|
|
44
|
+
'content_length': 'contentLength',
|
|
45
|
+
'content_type': 'contentType',
|
|
46
|
+
'last_modified_epoch_seconds': 'lastModifiedEpochSeconds'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
def __init__(self,
|
|
50
|
+
type=None,
|
|
51
|
+
name=None,
|
|
52
|
+
content_length=None,
|
|
53
|
+
content_type=None,
|
|
54
|
+
last_modified_epoch_seconds=None): # noqa: E501
|
|
55
|
+
"""StartBlobUploadRequest - a model defined in Swagger""" # noqa: E501
|
|
56
|
+
|
|
57
|
+
self._type = None
|
|
58
|
+
self._name = None
|
|
59
|
+
self._content_length = None
|
|
60
|
+
self._content_type = None
|
|
61
|
+
self._last_modified_epoch_seconds = None
|
|
62
|
+
self.discriminator = None
|
|
63
|
+
|
|
64
|
+
if type is not None:
|
|
65
|
+
self.type = type
|
|
66
|
+
self.name = name
|
|
67
|
+
self.content_length = content_length
|
|
68
|
+
if content_type is not None:
|
|
69
|
+
self.content_type = content_type
|
|
70
|
+
if last_modified_epoch_seconds is not None:
|
|
71
|
+
self.last_modified_epoch_seconds = last_modified_epoch_seconds
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def type(self):
|
|
75
|
+
"""Gets the type of this StartBlobUploadRequest. # noqa: E501
|
|
76
|
+
|
|
77
|
+
The type of the blob (one of \"dataset\", \"model\", \"inbox\") # noqa: E501
|
|
78
|
+
|
|
79
|
+
:return: The type of this StartBlobUploadRequest. # noqa: E501
|
|
80
|
+
:rtype: object
|
|
81
|
+
"""
|
|
82
|
+
return self._type
|
|
83
|
+
|
|
84
|
+
@type.setter
|
|
85
|
+
def type(self, type):
|
|
86
|
+
"""Sets the type of this StartBlobUploadRequest.
|
|
87
|
+
|
|
88
|
+
The type of the blob (one of \"dataset\", \"model\", \"inbox\") # noqa: E501
|
|
89
|
+
|
|
90
|
+
:param type: The type of this StartBlobUploadRequest. # noqa: E501
|
|
91
|
+
:type: object
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
self._type = type
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def name(self):
|
|
98
|
+
"""Gets the name of this StartBlobUploadRequest. # noqa: E501
|
|
99
|
+
|
|
100
|
+
Name of the file # noqa: E501
|
|
101
|
+
|
|
102
|
+
:return: The name of this StartBlobUploadRequest. # noqa: E501
|
|
103
|
+
:rtype: str
|
|
104
|
+
"""
|
|
105
|
+
return self._name
|
|
106
|
+
|
|
107
|
+
@name.setter
|
|
108
|
+
def name(self, name):
|
|
109
|
+
"""Sets the name of this StartBlobUploadRequest.
|
|
110
|
+
|
|
111
|
+
Name of the file # noqa: E501
|
|
112
|
+
|
|
113
|
+
:param name: The name of this StartBlobUploadRequest. # noqa: E501
|
|
114
|
+
:type: str
|
|
115
|
+
"""
|
|
116
|
+
if name is None:
|
|
117
|
+
raise ValueError(
|
|
118
|
+
"Invalid value for `name`, must not be `None`") # noqa: E501
|
|
119
|
+
|
|
120
|
+
self._name = name
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def content_length(self):
|
|
124
|
+
"""Gets the content_length of this StartBlobUploadRequest. # noqa: E501
|
|
125
|
+
|
|
126
|
+
Content length of the file in bytes # noqa: E501
|
|
127
|
+
|
|
128
|
+
:return: The content_length of this StartBlobUploadRequest. # noqa: E501
|
|
129
|
+
:rtype: int
|
|
130
|
+
"""
|
|
131
|
+
return self._content_length
|
|
132
|
+
|
|
133
|
+
@content_length.setter
|
|
134
|
+
def content_length(self, content_length):
|
|
135
|
+
"""Sets the content_length of this StartBlobUploadRequest.
|
|
136
|
+
|
|
137
|
+
Content length of the file in bytes # noqa: E501
|
|
138
|
+
|
|
139
|
+
:param content_length: The content_length of this StartBlobUploadRequest. # noqa: E501
|
|
140
|
+
:type: int
|
|
141
|
+
"""
|
|
142
|
+
if content_length is None:
|
|
143
|
+
raise ValueError("Invalid value for `content_length`, must not be `None`"
|
|
144
|
+
) # noqa: E501
|
|
145
|
+
|
|
146
|
+
self._content_length = content_length
|
|
147
|
+
|
|
148
|
+
@property
|
|
149
|
+
def content_type(self):
|
|
150
|
+
"""Gets the content_type of this StartBlobUploadRequest. # noqa: E501
|
|
151
|
+
|
|
152
|
+
Content/MIME type (e.g. \"text/plain\") of the file # noqa: E501
|
|
153
|
+
|
|
154
|
+
:return: The content_type of this StartBlobUploadRequest. # noqa: E501
|
|
155
|
+
:rtype: str
|
|
156
|
+
"""
|
|
157
|
+
return self._content_type
|
|
158
|
+
|
|
159
|
+
@content_type.setter
|
|
160
|
+
def content_type(self, content_type):
|
|
161
|
+
"""Sets the content_type of this StartBlobUploadRequest.
|
|
162
|
+
|
|
163
|
+
Content/MIME type (e.g. \"text/plain\") of the file # noqa: E501
|
|
164
|
+
|
|
165
|
+
:param content_type: The content_type of this StartBlobUploadRequest. # noqa: E501
|
|
166
|
+
:type: str
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
self._content_type = content_type
|
|
170
|
+
|
|
171
|
+
@property
|
|
172
|
+
def last_modified_epoch_seconds(self):
|
|
173
|
+
"""Gets the last_modified_epoch_seconds of this StartBlobUploadRequest. # noqa: E501
|
|
174
|
+
|
|
175
|
+
Last modified date of file in seconds since epoch in UTC # noqa: E501
|
|
176
|
+
|
|
177
|
+
:return: The last_modified_epoch_seconds of this StartBlobUploadRequest. # noqa: E501
|
|
178
|
+
:rtype: int
|
|
179
|
+
"""
|
|
180
|
+
return self._last_modified_epoch_seconds
|
|
181
|
+
|
|
182
|
+
@last_modified_epoch_seconds.setter
|
|
183
|
+
def last_modified_epoch_seconds(self, last_modified_epoch_seconds):
|
|
184
|
+
"""Sets the last_modified_epoch_seconds of this StartBlobUploadRequest.
|
|
185
|
+
|
|
186
|
+
Last modified date of file in seconds since epoch in UTC # noqa: E501
|
|
187
|
+
|
|
188
|
+
:param last_modified_epoch_seconds: The last_modified_epoch_seconds of this StartBlobUploadRequest. # noqa: E501
|
|
189
|
+
:type: int
|
|
190
|
+
"""
|
|
191
|
+
|
|
192
|
+
self._last_modified_epoch_seconds = last_modified_epoch_seconds
|
|
193
|
+
|
|
194
|
+
def to_dict(self):
|
|
195
|
+
"""Returns the model properties as a dict"""
|
|
196
|
+
result = {}
|
|
197
|
+
|
|
198
|
+
for attr, _ in six.iteritems(self.project_types):
|
|
199
|
+
value = getattr(self, attr)
|
|
200
|
+
if isinstance(value, list):
|
|
201
|
+
result[attr] = list(
|
|
202
|
+
map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
|
|
203
|
+
elif hasattr(value, "to_dict"):
|
|
204
|
+
result[attr] = value.to_dict()
|
|
205
|
+
elif isinstance(value, dict):
|
|
206
|
+
result[attr] = dict(
|
|
207
|
+
map(
|
|
208
|
+
lambda item: (item[0], item[1].to_dict())
|
|
209
|
+
if hasattr(item[1], "to_dict") else item, value.items()))
|
|
210
|
+
else:
|
|
211
|
+
result[attr] = value
|
|
212
|
+
|
|
213
|
+
return result
|
|
214
|
+
|
|
215
|
+
def to_str(self):
|
|
216
|
+
"""Returns the string representation of the model"""
|
|
217
|
+
return pprint.pformat(self.to_dict())
|
|
218
|
+
|
|
219
|
+
def __repr__(self):
|
|
220
|
+
"""For `print` and `pprint`"""
|
|
221
|
+
return self.to_str()
|
|
222
|
+
|
|
223
|
+
def __eq__(self, other):
|
|
224
|
+
"""Returns true if both objects are equal"""
|
|
225
|
+
if not isinstance(other, StartBlobUploadRequest):
|
|
226
|
+
return False
|
|
227
|
+
|
|
228
|
+
return self.__dict__ == other.__dict__
|
|
229
|
+
|
|
230
|
+
def __ne__(self, other):
|
|
231
|
+
"""Returns true if both objects are not equal"""
|
|
232
|
+
return not self == other
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2024 Kaggle Inc
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# coding: utf-8
|
|
18
|
+
|
|
19
|
+
import pprint
|
|
20
|
+
import re # noqa: F401
|
|
21
|
+
|
|
22
|
+
import six
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class StartBlobUploadResponse(object):
|
|
26
|
+
"""
|
|
27
|
+
Attributes:
|
|
28
|
+
project_types (dict): The key is attribute name
|
|
29
|
+
and the value is attribute type.
|
|
30
|
+
attribute_map (dict): The key is attribute name
|
|
31
|
+
and the value is json key in definition.
|
|
32
|
+
"""
|
|
33
|
+
project_types = {'token': 'str', 'create_url': 'str'}
|
|
34
|
+
|
|
35
|
+
attribute_map = {'token': 'token', 'create_url': 'createUrl'}
|
|
36
|
+
|
|
37
|
+
def __init__(self, token=None, create_url=None): # noqa: E501
|
|
38
|
+
"""StartBlobUploadResponse - a model defined in Swagger""" # noqa: E501
|
|
39
|
+
|
|
40
|
+
self._token = None
|
|
41
|
+
self._create_url = None
|
|
42
|
+
self.discriminator = None
|
|
43
|
+
|
|
44
|
+
self.token = token
|
|
45
|
+
self.create_url = create_url
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def token(self):
|
|
49
|
+
"""Gets the token of this StartBlobUploadResponse. # noqa: E501
|
|
50
|
+
|
|
51
|
+
Opaque string token used to reference the new blob/file. # noqa: E501
|
|
52
|
+
|
|
53
|
+
:return: The token of this StartBlobUploadResponse. # noqa: E501
|
|
54
|
+
:rtype: str
|
|
55
|
+
"""
|
|
56
|
+
return self._token
|
|
57
|
+
|
|
58
|
+
@token.setter
|
|
59
|
+
def token(self, token):
|
|
60
|
+
"""Sets the token of this StartBlobUploadResponse.
|
|
61
|
+
|
|
62
|
+
Opaque string token used to reference the new blob/file. # noqa: E501
|
|
63
|
+
|
|
64
|
+
:param token: The token of this StartBlobUploadResponse. # noqa: E501
|
|
65
|
+
:type: str
|
|
66
|
+
"""
|
|
67
|
+
if token is None:
|
|
68
|
+
raise ValueError(
|
|
69
|
+
"Invalid value for `token`, must not be `None`") # noqa: E501
|
|
70
|
+
|
|
71
|
+
self._token = token
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def create_url(self):
|
|
75
|
+
"""Gets the create_url of this StartBlobUploadResponse. # noqa: E501
|
|
76
|
+
|
|
77
|
+
URL to use to start the upload. # noqa: E501
|
|
78
|
+
|
|
79
|
+
:return: The create_url of this StartBlobUploadResponse. # noqa: E501
|
|
80
|
+
:rtype: str
|
|
81
|
+
"""
|
|
82
|
+
return self._create_url
|
|
83
|
+
|
|
84
|
+
@create_url.setter
|
|
85
|
+
def create_url(self, create_url):
|
|
86
|
+
"""Sets the create_url of this StartBlobUploadResponse.
|
|
87
|
+
|
|
88
|
+
URL to use to start the upload. # noqa: E501
|
|
89
|
+
|
|
90
|
+
:param create_url: The create_url of this StartBlobUploadResponse. # noqa: E501
|
|
91
|
+
:type: str
|
|
92
|
+
"""
|
|
93
|
+
if create_url is None:
|
|
94
|
+
raise ValueError(
|
|
95
|
+
"Invalid value for `create_url`, must not be `None`") # noqa: E501
|
|
96
|
+
|
|
97
|
+
self._create_url = create_url
|
|
98
|
+
|
|
99
|
+
def to_dict(self):
|
|
100
|
+
"""Returns the model properties as a dict"""
|
|
101
|
+
result = {}
|
|
102
|
+
|
|
103
|
+
for attr, _ in six.iteritems(self.project_types):
|
|
104
|
+
value = getattr(self, attr)
|
|
105
|
+
if isinstance(value, list):
|
|
106
|
+
result[attr] = list(
|
|
107
|
+
map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
|
|
108
|
+
elif hasattr(value, "to_dict"):
|
|
109
|
+
result[attr] = value.to_dict()
|
|
110
|
+
elif isinstance(value, dict):
|
|
111
|
+
result[attr] = dict(
|
|
112
|
+
map(
|
|
113
|
+
lambda item: (item[0], item[1].to_dict())
|
|
114
|
+
if hasattr(item[1], "to_dict") else item, value.items()))
|
|
115
|
+
else:
|
|
116
|
+
result[attr] = value
|
|
117
|
+
|
|
118
|
+
return result
|
|
119
|
+
|
|
120
|
+
def to_str(self):
|
|
121
|
+
"""Returns the string representation of the model"""
|
|
122
|
+
return pprint.pformat(self.to_dict())
|
|
123
|
+
|
|
124
|
+
def __repr__(self):
|
|
125
|
+
"""For `print` and `pprint`"""
|
|
126
|
+
return self.to_str()
|
|
127
|
+
|
|
128
|
+
def __eq__(self, other):
|
|
129
|
+
"""Returns true if both objects are equal"""
|
|
130
|
+
if not isinstance(other, StartBlobUploadResponse):
|
|
131
|
+
return False
|
|
132
|
+
|
|
133
|
+
return self.__dict__ == other.__dict__
|
|
134
|
+
|
|
135
|
+
def __ne__(self, other):
|
|
136
|
+
"""Returns true if both objects are not equal"""
|
|
137
|
+
return not self == other
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2024 Kaggle Inc
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# coding: utf-8
|
|
18
|
+
|
|
19
|
+
import pprint
|
|
20
|
+
import re # noqa: F401
|
|
21
|
+
|
|
22
|
+
import six
|
|
23
|
+
|
|
24
|
+
from kaggle.models.dataset_column import DatasetColumn # noqa: F401,E501
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class UploadFile(object):
|
|
28
|
+
"""
|
|
29
|
+
Attributes:
|
|
30
|
+
column_types (dict): The key is attribute name
|
|
31
|
+
and the value is attribute type.
|
|
32
|
+
attribute_map (dict): The key is attribute name
|
|
33
|
+
and the value is json key in definition.
|
|
34
|
+
"""
|
|
35
|
+
column_types = {
|
|
36
|
+
'token': 'str',
|
|
37
|
+
'description': 'str',
|
|
38
|
+
'columns': 'list[DatasetColumn]'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
attribute_map = {
|
|
42
|
+
'token': 'token',
|
|
43
|
+
'description': 'description',
|
|
44
|
+
'columns': 'columns'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
def __init__(self, token=None, description=None, columns=None): # noqa: E501
|
|
48
|
+
"""UploadFile - a model defined in Swagger""" # noqa: E501
|
|
49
|
+
|
|
50
|
+
self._token = None
|
|
51
|
+
self._description = None
|
|
52
|
+
self._columns = None
|
|
53
|
+
self.discriminator = None
|
|
54
|
+
|
|
55
|
+
if token is not None:
|
|
56
|
+
self.token = token
|
|
57
|
+
if description is not None:
|
|
58
|
+
self.description = description
|
|
59
|
+
if columns is not None:
|
|
60
|
+
self.columns = columns
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def token(self):
|
|
64
|
+
"""Gets the token of this UploadFile. # noqa: E501
|
|
65
|
+
|
|
66
|
+
A token referencing a specific file upload that can be used across requests # noqa: E501
|
|
67
|
+
|
|
68
|
+
:return: The token of this UploadFile. # noqa: E501
|
|
69
|
+
:rtype: str
|
|
70
|
+
"""
|
|
71
|
+
return self._token
|
|
72
|
+
|
|
73
|
+
@token.setter
|
|
74
|
+
def token(self, token):
|
|
75
|
+
"""Sets the token of this UploadFile.
|
|
76
|
+
|
|
77
|
+
A token referencing a specific file upload that can be used across requests # noqa: E501
|
|
78
|
+
|
|
79
|
+
:param token: The token of this UploadFile. # noqa: E501
|
|
80
|
+
:type: str
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
self._token = token
|
|
84
|
+
|
|
85
|
+
@property
|
|
86
|
+
def description(self):
|
|
87
|
+
"""Gets the description of this UploadFile. # noqa: E501
|
|
88
|
+
|
|
89
|
+
The file description # noqa: E501
|
|
90
|
+
|
|
91
|
+
:return: The description of this UploadFile. # noqa: E501
|
|
92
|
+
:rtype: str
|
|
93
|
+
"""
|
|
94
|
+
return self._description
|
|
95
|
+
|
|
96
|
+
@description.setter
|
|
97
|
+
def description(self, description):
|
|
98
|
+
"""Sets the description of this UploadFile.
|
|
99
|
+
|
|
100
|
+
The file description # noqa: E501
|
|
101
|
+
|
|
102
|
+
:param description: The description of this UploadFile. # noqa: E501
|
|
103
|
+
:type: str
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
self._description = description
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
def columns(self):
|
|
110
|
+
"""Gets the columns of this UploadFile. # noqa: E501
|
|
111
|
+
|
|
112
|
+
A list of dataset column metadata # noqa: E501
|
|
113
|
+
|
|
114
|
+
:return: The columns of this UploadFile. # noqa: E501
|
|
115
|
+
:rtype: list[DatasetColumn]
|
|
116
|
+
"""
|
|
117
|
+
return self._columns
|
|
118
|
+
|
|
119
|
+
@columns.setter
|
|
120
|
+
def columns(self, columns):
|
|
121
|
+
"""Sets the columns of this UploadFile.
|
|
122
|
+
|
|
123
|
+
A list of dataset column metadata # noqa: E501
|
|
124
|
+
|
|
125
|
+
:param columns: The columns of this UploadFile. # noqa: E501
|
|
126
|
+
:type: list[DatasetColumn]
|
|
127
|
+
"""
|
|
128
|
+
|
|
129
|
+
self._columns = columns
|
|
130
|
+
|
|
131
|
+
def to_dict(self):
|
|
132
|
+
"""Returns the model properties as a dict"""
|
|
133
|
+
result = {}
|
|
134
|
+
|
|
135
|
+
for attr, _ in six.iteritems(self.column_types):
|
|
136
|
+
value = getattr(self, attr)
|
|
137
|
+
if isinstance(value, list):
|
|
138
|
+
result[attr] = list(
|
|
139
|
+
map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
|
|
140
|
+
elif hasattr(value, "to_dict"):
|
|
141
|
+
result[attr] = value.to_dict()
|
|
142
|
+
elif isinstance(value, dict):
|
|
143
|
+
result[attr] = dict(
|
|
144
|
+
map(
|
|
145
|
+
lambda item: (item[0], item[1].to_dict())
|
|
146
|
+
if hasattr(item[1], "to_dict") else item, value.items()))
|
|
147
|
+
else:
|
|
148
|
+
result[attr] = value
|
|
149
|
+
|
|
150
|
+
return result
|
|
151
|
+
|
|
152
|
+
def to_str(self):
|
|
153
|
+
"""Returns the string representation of the model"""
|
|
154
|
+
return pprint.pformat(self.to_dict())
|
|
155
|
+
|
|
156
|
+
def __repr__(self):
|
|
157
|
+
"""For `print` and `pprint`"""
|
|
158
|
+
return self.to_str()
|
|
159
|
+
|
|
160
|
+
def __eq__(self, other):
|
|
161
|
+
"""Returns true if both objects are equal"""
|
|
162
|
+
if not isinstance(other, UploadFile):
|
|
163
|
+
return False
|
|
164
|
+
|
|
165
|
+
return self.__dict__ == other.__dict__
|
|
166
|
+
|
|
167
|
+
def __ne__(self, other):
|
|
168
|
+
"""Returns true if both objects are not equal"""
|
|
169
|
+
return not self == other
|
kaggle/test/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from kaggle.api.kaggle_api_extended import KaggleApi
|
|
2
|
+
|
|
3
|
+
# python -m unittest tests.test_authenticate
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import unittest
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TestAuthenticate(unittest.TestCase):
|
|
10
|
+
|
|
11
|
+
def setUp(self):
|
|
12
|
+
print("setup class:%s" % self)
|
|
13
|
+
|
|
14
|
+
def tearDown(self):
|
|
15
|
+
print("teardown class:TestStuff")
|
|
16
|
+
|
|
17
|
+
# Environment
|
|
18
|
+
|
|
19
|
+
def test_environment_variables(self):
|
|
20
|
+
os.environ['KAGGLE_USERNAME'] = 'dinosaur'
|
|
21
|
+
os.environ['KAGGLE_KEY'] = 'xxxxxxxxxxxx'
|
|
22
|
+
api = KaggleApi()
|
|
23
|
+
|
|
24
|
+
# We haven't authenticated yet
|
|
25
|
+
self.assertTrue("key" not in api.config_values)
|
|
26
|
+
self.assertTrue("username" not in api.config_values)
|
|
27
|
+
api.authenticate()
|
|
28
|
+
|
|
29
|
+
# Should be set from the environment
|
|
30
|
+
self.assertEqual(api.config_values['key'], 'xxxxxxxxxxxx')
|
|
31
|
+
self.assertEqual(api.config_values['username'], 'dinosaur')
|
|
32
|
+
|
|
33
|
+
# Configuration Actions
|
|
34
|
+
|
|
35
|
+
def test_config_actions(self):
|
|
36
|
+
api = KaggleApi()
|
|
37
|
+
|
|
38
|
+
self.assertTrue(api.config_dir.endswith('kaggle'))
|
|
39
|
+
self.assertEqual(api.get_config_value('doesntexist'), None)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if __name__ == '__main__':
|
|
43
|
+
unittest.main()
|