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.
Files changed (89) hide show
  1. kaggle/LICENSE +201 -0
  2. kaggle/__init__.py +6 -0
  3. kaggle/api/__init__.py +0 -0
  4. kaggle/api/kaggle_api.py +614 -0
  5. kaggle/api/kaggle_api_extended.py +4657 -0
  6. kaggle/cli.py +1606 -0
  7. kaggle/configuration.py +206 -0
  8. kaggle/models/__init__.py +0 -0
  9. kaggle/models/api_blob_type.py +4 -0
  10. kaggle/models/dataset_column.py +228 -0
  11. kaggle/models/dataset_new_request.py +385 -0
  12. kaggle/models/dataset_new_version_request.py +287 -0
  13. kaggle/models/dataset_update_settings_request.py +310 -0
  14. kaggle/models/kaggle_models_extended.py +276 -0
  15. kaggle/models/kernel_push_request.py +556 -0
  16. kaggle/models/model_instance_new_version_request.py +145 -0
  17. kaggle/models/model_instance_update_request.py +351 -0
  18. kaggle/models/model_new_instance_request.py +417 -0
  19. kaggle/models/model_new_request.py +314 -0
  20. kaggle/models/model_update_request.py +282 -0
  21. kaggle/models/start_blob_upload_request.py +232 -0
  22. kaggle/models/start_blob_upload_response.py +137 -0
  23. kaggle/models/upload_file.py +169 -0
  24. kaggle/test/__init__.py +0 -0
  25. kaggle/test/test_authenticate.py +43 -0
  26. kaggle-1.7.3b1.dist-info/METADATA +348 -0
  27. kaggle-1.7.3b1.dist-info/RECORD +89 -0
  28. kaggle-1.7.3b1.dist-info/WHEEL +4 -0
  29. kaggle-1.7.3b1.dist-info/entry_points.txt +2 -0
  30. kaggle-1.7.3b1.dist-info/licenses/LICENSE.txt +201 -0
  31. kagglesdk/LICENSE +201 -0
  32. kagglesdk/__init__.py +2 -0
  33. kagglesdk/admin/__init__.py +0 -0
  34. kagglesdk/admin/services/__init__.py +0 -0
  35. kagglesdk/admin/services/inbox_file_service.py +22 -0
  36. kagglesdk/admin/types/__init__.py +0 -0
  37. kagglesdk/admin/types/inbox_file_service.py +74 -0
  38. kagglesdk/blobs/__init__.py +0 -0
  39. kagglesdk/blobs/services/__init__.py +0 -0
  40. kagglesdk/blobs/services/blob_api_service.py +25 -0
  41. kagglesdk/blobs/types/__init__.py +0 -0
  42. kagglesdk/blobs/types/blob_api_service.py +177 -0
  43. kagglesdk/common/__init__.py +0 -0
  44. kagglesdk/common/types/__init__.py +0 -0
  45. kagglesdk/common/types/file_download.py +102 -0
  46. kagglesdk/common/types/http_redirect.py +105 -0
  47. kagglesdk/competitions/__init__.py +0 -0
  48. kagglesdk/competitions/services/__init__.py +0 -0
  49. kagglesdk/competitions/services/competition_api_service.py +129 -0
  50. kagglesdk/competitions/types/__init__.py +0 -0
  51. kagglesdk/competitions/types/competition_api_service.py +1874 -0
  52. kagglesdk/competitions/types/competition_enums.py +53 -0
  53. kagglesdk/competitions/types/submission_status.py +9 -0
  54. kagglesdk/datasets/__init__.py +0 -0
  55. kagglesdk/datasets/services/__init__.py +0 -0
  56. kagglesdk/datasets/services/dataset_api_service.py +170 -0
  57. kagglesdk/datasets/types/__init__.py +0 -0
  58. kagglesdk/datasets/types/dataset_api_service.py +2777 -0
  59. kagglesdk/datasets/types/dataset_enums.py +82 -0
  60. kagglesdk/datasets/types/dataset_types.py +646 -0
  61. kagglesdk/education/__init__.py +0 -0
  62. kagglesdk/education/services/__init__.py +0 -0
  63. kagglesdk/education/services/education_api_service.py +19 -0
  64. kagglesdk/education/types/__init__.py +0 -0
  65. kagglesdk/education/types/education_api_service.py +248 -0
  66. kagglesdk/education/types/education_service.py +139 -0
  67. kagglesdk/kaggle_client.py +66 -0
  68. kagglesdk/kaggle_env.py +42 -0
  69. kagglesdk/kaggle_http_client.py +316 -0
  70. kagglesdk/kaggle_object.py +293 -0
  71. kagglesdk/kernels/__init__.py +0 -0
  72. kagglesdk/kernels/services/__init__.py +0 -0
  73. kagglesdk/kernels/services/kernels_api_service.py +109 -0
  74. kagglesdk/kernels/types/__init__.py +0 -0
  75. kagglesdk/kernels/types/kernels_api_service.py +1951 -0
  76. kagglesdk/kernels/types/kernels_enums.py +33 -0
  77. kagglesdk/models/__init__.py +0 -0
  78. kagglesdk/models/services/__init__.py +0 -0
  79. kagglesdk/models/services/model_api_service.py +255 -0
  80. kagglesdk/models/services/model_service.py +19 -0
  81. kagglesdk/models/types/__init__.py +0 -0
  82. kagglesdk/models/types/model_api_service.py +3719 -0
  83. kagglesdk/models/types/model_enums.py +60 -0
  84. kagglesdk/models/types/model_service.py +275 -0
  85. kagglesdk/models/types/model_types.py +286 -0
  86. kagglesdk/test/test_client.py +45 -0
  87. kagglesdk/users/__init__.py +0 -0
  88. kagglesdk/users/types/__init__.py +0 -0
  89. kagglesdk/users/types/users_enums.py +22 -0
kagglesdk/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2018 Kaggle Inc
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
kagglesdk/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ from kagglesdk.kaggle_client import KaggleClient
2
+ from kagglesdk.kaggle_env import KaggleEnv
File without changes
File without changes
@@ -0,0 +1,22 @@
1
+ from kagglesdk.admin.types.inbox_file_service import CreateInboxFileRequest, CreateInboxFileResponse
2
+ from kagglesdk.kaggle_http_client import KaggleHttpClient
3
+
4
+ class InboxFileClient(object):
5
+ """File drop/pickup functionality."""
6
+
7
+ def __init__(self, client: KaggleHttpClient):
8
+ self._client = client
9
+
10
+ def create_inbox_file(self, request: CreateInboxFileRequest = None) -> CreateInboxFileResponse:
11
+ r"""
12
+ Creates (aka 'drops') a new file into the inbox.
13
+
14
+ Args:
15
+ request (CreateInboxFileRequest):
16
+ The request object; initialized to empty instance if not specified.
17
+ """
18
+
19
+ if request is None:
20
+ request = CreateInboxFileRequest()
21
+
22
+ return self._client.call("admin.InboxFileService", "CreateInboxFile", request, CreateInboxFileResponse)
File without changes
@@ -0,0 +1,74 @@
1
+ from kagglesdk.kaggle_object import *
2
+
3
+ class CreateInboxFileRequest(KaggleObject):
4
+ r"""
5
+ Attributes:
6
+ virtual_directory (str)
7
+ Directory name used for tagging the uploaded file.
8
+ blob_file_token (str)
9
+ Token representing the uploaded file.
10
+ """
11
+
12
+ def __init__(self):
13
+ self._virtual_directory = ""
14
+ self._blob_file_token = ""
15
+ self._freeze()
16
+
17
+ @property
18
+ def virtual_directory(self) -> str:
19
+ """Directory name used for tagging the uploaded file."""
20
+ return self._virtual_directory
21
+
22
+ @virtual_directory.setter
23
+ def virtual_directory(self, virtual_directory: str):
24
+ if virtual_directory is None:
25
+ del self.virtual_directory
26
+ return
27
+ if not isinstance(virtual_directory, str):
28
+ raise TypeError('virtual_directory must be of type str')
29
+ self._virtual_directory = virtual_directory
30
+
31
+ @property
32
+ def blob_file_token(self) -> str:
33
+ """Token representing the uploaded file."""
34
+ return self._blob_file_token
35
+
36
+ @blob_file_token.setter
37
+ def blob_file_token(self, blob_file_token: str):
38
+ if blob_file_token is None:
39
+ del self.blob_file_token
40
+ return
41
+ if not isinstance(blob_file_token, str):
42
+ raise TypeError('blob_file_token must be of type str')
43
+ self._blob_file_token = blob_file_token
44
+
45
+ def endpoint(self):
46
+ path = '/api/v1/inbox/files/create'
47
+ return path.format_map(self.to_field_map(self))
48
+
49
+
50
+ @staticmethod
51
+ def method():
52
+ return 'POST'
53
+
54
+ @staticmethod
55
+ def body_fields():
56
+ return '*'
57
+
58
+
59
+ class CreateInboxFileResponse(KaggleObject):
60
+ r"""
61
+ NOTE: This is sent to non-admins, so we're intentionally *NOT* sending back
62
+ the full InboxFile (with its URL for a direct download).
63
+
64
+ """
65
+
66
+ pass
67
+
68
+ CreateInboxFileRequest._fields = [
69
+ FieldMetadata("virtualDirectory", "virtual_directory", "_virtual_directory", str, "", PredefinedSerializer()),
70
+ FieldMetadata("blobFileToken", "blob_file_token", "_blob_file_token", str, "", PredefinedSerializer()),
71
+ ]
72
+
73
+ CreateInboxFileResponse._fields = []
74
+
File without changes
File without changes
@@ -0,0 +1,25 @@
1
+ from kagglesdk.blobs.types.blob_api_service import ApiStartBlobUploadRequest, ApiStartBlobUploadResponse
2
+ from kagglesdk.kaggle_http_client import KaggleHttpClient
3
+
4
+ class BlobApiClient(object):
5
+ r"""
6
+ Binary Large OBject (BLOB) service used for uploading files to Google Cloud
7
+ Storage (GCS).
8
+ """
9
+
10
+ def __init__(self, client: KaggleHttpClient):
11
+ self._client = client
12
+
13
+ def start_blob_upload(self, request: ApiStartBlobUploadRequest = None) -> ApiStartBlobUploadResponse:
14
+ r"""
15
+ Starts a blob upload (i.e. reserves a spot for the upload on GCS).
16
+
17
+ Args:
18
+ request (ApiStartBlobUploadRequest):
19
+ The request object; initialized to empty instance if not specified.
20
+ """
21
+
22
+ if request is None:
23
+ request = ApiStartBlobUploadRequest()
24
+
25
+ return self._client.call("blobs.BlobApiService", "ApiStartBlobUpload", request, ApiStartBlobUploadResponse)
File without changes
@@ -0,0 +1,177 @@
1
+ import enum
2
+ from kagglesdk.kaggle_object import *
3
+ from typing import Optional
4
+
5
+ class ApiBlobType(enum.Enum):
6
+ API_BLOB_TYPE_UNSPECIFIED = 0
7
+ DATASET = 1
8
+ MODEL = 2
9
+ INBOX = 3
10
+
11
+ class ApiStartBlobUploadRequest(KaggleObject):
12
+ r"""
13
+ Attributes:
14
+ type (ApiBlobType)
15
+ The type of the blob.
16
+ name (str)
17
+ Name (e.g. file name) of the blob.
18
+ content_type (str)
19
+ Content/MIME type (e.g. 'text/plain').
20
+ content_length (int)
21
+ Size in bytes of the blob.
22
+ last_modified_epoch_seconds (int)
23
+ Optional user-reported time when the blob was last updated/modified.
24
+ """
25
+
26
+ def __init__(self):
27
+ self._type = ApiBlobType.API_BLOB_TYPE_UNSPECIFIED
28
+ self._name = ""
29
+ self._content_type = None
30
+ self._content_length = 0
31
+ self._last_modified_epoch_seconds = None
32
+ self._freeze()
33
+
34
+ @property
35
+ def type(self) -> 'ApiBlobType':
36
+ """The type of the blob."""
37
+ return self._type
38
+
39
+ @type.setter
40
+ def type(self, type: 'ApiBlobType'):
41
+ if type is None:
42
+ del self.type
43
+ return
44
+ if not isinstance(type, ApiBlobType):
45
+ raise TypeError('type must be of type ApiBlobType')
46
+ self._type = type
47
+
48
+ @property
49
+ def name(self) -> str:
50
+ """Name (e.g. file name) of the blob."""
51
+ return self._name
52
+
53
+ @name.setter
54
+ def name(self, name: str):
55
+ if name is None:
56
+ del self.name
57
+ return
58
+ if not isinstance(name, str):
59
+ raise TypeError('name must be of type str')
60
+ self._name = name
61
+
62
+ @property
63
+ def content_type(self) -> str:
64
+ """Content/MIME type (e.g. 'text/plain')."""
65
+ return self._content_type or ""
66
+
67
+ @content_type.setter
68
+ def content_type(self, content_type: str):
69
+ if content_type is None:
70
+ del self.content_type
71
+ return
72
+ if not isinstance(content_type, str):
73
+ raise TypeError('content_type must be of type str')
74
+ self._content_type = content_type
75
+
76
+ @property
77
+ def content_length(self) -> int:
78
+ """Size in bytes of the blob."""
79
+ return self._content_length
80
+
81
+ @content_length.setter
82
+ def content_length(self, content_length: int):
83
+ if content_length is None:
84
+ del self.content_length
85
+ return
86
+ if not isinstance(content_length, int):
87
+ raise TypeError('content_length must be of type int')
88
+ self._content_length = content_length
89
+
90
+ @property
91
+ def last_modified_epoch_seconds(self) -> int:
92
+ """Optional user-reported time when the blob was last updated/modified."""
93
+ return self._last_modified_epoch_seconds or 0
94
+
95
+ @last_modified_epoch_seconds.setter
96
+ def last_modified_epoch_seconds(self, last_modified_epoch_seconds: int):
97
+ if last_modified_epoch_seconds is None:
98
+ del self.last_modified_epoch_seconds
99
+ return
100
+ if not isinstance(last_modified_epoch_seconds, int):
101
+ raise TypeError('last_modified_epoch_seconds must be of type int')
102
+ self._last_modified_epoch_seconds = last_modified_epoch_seconds
103
+
104
+ def endpoint(self):
105
+ path = '/api/v1/blobs/upload'
106
+ return path.format_map(self.to_field_map(self))
107
+
108
+
109
+ @staticmethod
110
+ def method():
111
+ return 'POST'
112
+
113
+ @staticmethod
114
+ def body_fields():
115
+ return '*'
116
+
117
+
118
+ class ApiStartBlobUploadResponse(KaggleObject):
119
+ r"""
120
+ Attributes:
121
+ token (str)
122
+ Opaque string token used to reference the new blob/file.
123
+ create_url (str)
124
+ URL to use to start the upload.
125
+ """
126
+
127
+ def __init__(self):
128
+ self._token = ""
129
+ self._create_url = ""
130
+ self._freeze()
131
+
132
+ @property
133
+ def token(self) -> str:
134
+ """Opaque string token used to reference the new blob/file."""
135
+ return self._token
136
+
137
+ @token.setter
138
+ def token(self, token: str):
139
+ if token is None:
140
+ del self.token
141
+ return
142
+ if not isinstance(token, str):
143
+ raise TypeError('token must be of type str')
144
+ self._token = token
145
+
146
+ @property
147
+ def create_url(self) -> str:
148
+ """URL to use to start the upload."""
149
+ return self._create_url
150
+
151
+ @create_url.setter
152
+ def create_url(self, create_url: str):
153
+ if create_url is None:
154
+ del self.create_url
155
+ return
156
+ if not isinstance(create_url, str):
157
+ raise TypeError('create_url must be of type str')
158
+ self._create_url = create_url
159
+
160
+ @property
161
+ def createUrl(self):
162
+ return self.create_url
163
+
164
+
165
+ ApiStartBlobUploadRequest._fields = [
166
+ FieldMetadata("type", "type", "_type", ApiBlobType, ApiBlobType.API_BLOB_TYPE_UNSPECIFIED, EnumSerializer()),
167
+ FieldMetadata("name", "name", "_name", str, "", PredefinedSerializer()),
168
+ FieldMetadata("contentType", "content_type", "_content_type", str, None, PredefinedSerializer(), optional=True),
169
+ FieldMetadata("contentLength", "content_length", "_content_length", int, 0, PredefinedSerializer()),
170
+ FieldMetadata("lastModifiedEpochSeconds", "last_modified_epoch_seconds", "_last_modified_epoch_seconds", int, None, PredefinedSerializer(), optional=True),
171
+ ]
172
+
173
+ ApiStartBlobUploadResponse._fields = [
174
+ FieldMetadata("token", "token", "_token", str, "", PredefinedSerializer()),
175
+ FieldMetadata("createUrl", "create_url", "_create_url", str, "", PredefinedSerializer()),
176
+ ]
177
+
File without changes
File without changes
@@ -0,0 +1,102 @@
1
+ from kagglesdk.kaggle_object import *
2
+ from typing import Optional
3
+
4
+ class FileDownload(KaggleObject):
5
+ r"""
6
+ Standard response object representing a file download.
7
+ See http://go/kaggle-proto-handler-file-downloads
8
+ Some field names/descriptions borrowed from
9
+ google3/gdata/rosy/proto/data.proto
10
+
11
+ Attributes:
12
+ content_type (str)
13
+ MIME type of the data
14
+ TODO(aip.dev/143): (-- api-linter: core::0143::standardized-codes=disabled
15
+ --)
16
+ file_name (str)
17
+ Original file name
18
+ token (str)
19
+ A unique fingerprint for the file/media data
20
+ content_length (int)
21
+ Size of the data, in bytes (if known)
22
+ """
23
+
24
+ def __init__(self):
25
+ self._content_type = ""
26
+ self._file_name = ""
27
+ self._token = ""
28
+ self._content_length = None
29
+ self._freeze()
30
+
31
+ @property
32
+ def content_type(self) -> str:
33
+ r"""
34
+ MIME type of the data
35
+ TODO(aip.dev/143): (-- api-linter: core::0143::standardized-codes=disabled
36
+ --)
37
+ """
38
+ return self._content_type
39
+
40
+ @content_type.setter
41
+ def content_type(self, content_type: str):
42
+ if content_type is None:
43
+ del self.content_type
44
+ return
45
+ if not isinstance(content_type, str):
46
+ raise TypeError('content_type must be of type str')
47
+ self._content_type = content_type
48
+
49
+ @property
50
+ def file_name(self) -> str:
51
+ """Original file name"""
52
+ return self._file_name
53
+
54
+ @file_name.setter
55
+ def file_name(self, file_name: str):
56
+ if file_name is None:
57
+ del self.file_name
58
+ return
59
+ if not isinstance(file_name, str):
60
+ raise TypeError('file_name must be of type str')
61
+ self._file_name = file_name
62
+
63
+ @property
64
+ def token(self) -> str:
65
+ """A unique fingerprint for the file/media data"""
66
+ return self._token
67
+
68
+ @token.setter
69
+ def token(self, token: str):
70
+ if token is None:
71
+ del self.token
72
+ return
73
+ if not isinstance(token, str):
74
+ raise TypeError('token must be of type str')
75
+ self._token = token
76
+
77
+ @property
78
+ def content_length(self) -> int:
79
+ """Size of the data, in bytes (if known)"""
80
+ return self._content_length or 0
81
+
82
+ @content_length.setter
83
+ def content_length(self, content_length: int):
84
+ if content_length is None:
85
+ del self.content_length
86
+ return
87
+ if not isinstance(content_length, int):
88
+ raise TypeError('content_length must be of type int')
89
+ self._content_length = content_length
90
+
91
+ @classmethod
92
+ def prepare_from(cls, http_response):
93
+ return http_response
94
+
95
+
96
+ FileDownload._fields = [
97
+ FieldMetadata("contentType", "content_type", "_content_type", str, "", PredefinedSerializer()),
98
+ FieldMetadata("fileName", "file_name", "_file_name", str, "", PredefinedSerializer()),
99
+ FieldMetadata("token", "token", "_token", str, "", PredefinedSerializer()),
100
+ FieldMetadata("contentLength", "content_length", "_content_length", int, None, PredefinedSerializer(), optional=True),
101
+ ]
102
+