metaflow-stubs 2.12.27__py2.py3-none-any.whl → 2.12.29__py2.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 (159) hide show
  1. metaflow-stubs/__init__.pyi +217 -2921
  2. metaflow-stubs/cards.pyi +19 -473
  3. metaflow-stubs/cli.pyi +17 -81
  4. metaflow-stubs/client/__init__.pyi +19 -1113
  5. metaflow-stubs/client/core.pyi +19 -159
  6. metaflow-stubs/client/filecache.pyi +8 -12
  7. metaflow-stubs/clone_util.pyi +6 -26
  8. metaflow-stubs/events.pyi +7 -6
  9. metaflow-stubs/exception.pyi +8 -6
  10. metaflow-stubs/flowspec.pyi +22 -106
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +16 -564
  13. metaflow-stubs/info_file.pyi +6 -5
  14. metaflow-stubs/metadata_provider/__init__.pyi +16 -0
  15. metaflow-stubs/metadata_provider/heartbeat.pyi +34 -0
  16. metaflow-stubs/{metadata → metadata_provider}/metadata.pyi +10 -22
  17. metaflow-stubs/metadata_provider/util.pyi +19 -0
  18. metaflow-stubs/metaflow_config.pyi +8 -11
  19. metaflow-stubs/metaflow_current.pyi +8 -7
  20. metaflow-stubs/mflog/__init__.pyi +6 -0
  21. metaflow-stubs/mflog/mflog.pyi +52 -5
  22. metaflow-stubs/multicore_utils.pyi +6 -5
  23. metaflow-stubs/parameters.pyi +13 -23
  24. metaflow-stubs/plugins/__init__.pyi +51 -163
  25. metaflow-stubs/plugins/airflow/__init__.pyi +12 -5
  26. metaflow-stubs/plugins/airflow/airflow.pyi +19 -130
  27. metaflow-stubs/plugins/airflow/airflow_cli.pyi +17 -136
  28. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +7 -26
  29. metaflow-stubs/plugins/airflow/airflow_utils.pyi +7 -6
  30. metaflow-stubs/plugins/airflow/exception.pyi +7 -11
  31. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +10 -97
  32. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +9 -30
  33. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +9 -40
  34. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +9 -40
  35. metaflow-stubs/plugins/argo/__init__.pyi +12 -5
  36. metaflow-stubs/plugins/argo/argo_client.pyi +8 -26
  37. metaflow-stubs/plugins/argo/argo_events.pyi +7 -11
  38. metaflow-stubs/plugins/argo/argo_workflows.pyi +17 -121
  39. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +22 -460
  40. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +13 -405
  41. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +65 -322
  42. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +165 -0
  43. metaflow-stubs/plugins/aws/__init__.pyi +11 -5
  44. metaflow-stubs/plugins/aws/aws_client.pyi +6 -5
  45. metaflow-stubs/plugins/aws/aws_utils.pyi +6 -11
  46. metaflow-stubs/plugins/aws/batch/__init__.pyi +10 -5
  47. metaflow-stubs/plugins/aws/batch/batch.pyi +10 -55
  48. metaflow-stubs/plugins/aws/batch/batch_cli.pyi +10 -31
  49. metaflow-stubs/plugins/aws/batch/batch_client.pyi +7 -11
  50. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +15 -140
  51. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +7 -5
  52. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +10 -21
  53. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +15 -5
  54. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +6 -5
  55. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +6 -5
  56. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +6 -5
  57. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +7 -5
  58. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +11 -65
  59. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +19 -175
  60. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +6 -5
  61. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +8 -37
  62. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +53 -290
  63. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +127 -0
  64. metaflow-stubs/plugins/azure/__init__.pyi +12 -7
  65. metaflow-stubs/plugins/azure/azure_credential.pyi +6 -5
  66. metaflow-stubs/plugins/azure/azure_exceptions.pyi +7 -11
  67. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +11 -24
  68. metaflow-stubs/plugins/azure/azure_utils.pyi +11 -29
  69. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +8 -23
  70. metaflow-stubs/plugins/azure/includefile_support.pyi +7 -17
  71. metaflow-stubs/plugins/cards/__init__.pyi +15 -5
  72. metaflow-stubs/plugins/cards/card_cli.pyi +22 -491
  73. metaflow-stubs/plugins/cards/card_client.pyi +14 -76
  74. metaflow-stubs/plugins/cards/card_creator.pyi +7 -10
  75. metaflow-stubs/plugins/cards/card_datastore.pyi +10 -18
  76. metaflow-stubs/plugins/cards/card_decorator.pyi +10 -126
  77. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +14 -81
  78. metaflow-stubs/plugins/cards/card_modules/basic.pyi +13 -96
  79. metaflow-stubs/plugins/cards/card_modules/card.pyi +6 -5
  80. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +12 -73
  81. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +6 -61
  82. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +6 -5
  83. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +8 -45
  84. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +7 -6
  85. metaflow-stubs/plugins/cards/card_modules/components.pyi +24 -107
  86. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +6 -5
  87. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +6 -12
  88. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +11 -88
  89. metaflow-stubs/plugins/cards/card_resolver.pyi +6 -49
  90. metaflow-stubs/plugins/cards/component_serializer.pyi +13 -63
  91. metaflow-stubs/plugins/cards/exception.pyi +7 -11
  92. metaflow-stubs/plugins/catch_decorator.pyi +9 -29
  93. metaflow-stubs/plugins/datatools/__init__.pyi +13 -392
  94. metaflow-stubs/plugins/datatools/local.pyi +7 -11
  95. metaflow-stubs/plugins/datatools/s3/__init__.pyi +19 -653
  96. metaflow-stubs/plugins/datatools/s3/s3.pyi +16 -264
  97. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +7 -10
  98. metaflow-stubs/plugins/datatools/s3/s3util.pyi +6 -11
  99. metaflow-stubs/plugins/debug_logger.pyi +7 -5
  100. metaflow-stubs/plugins/debug_monitor.pyi +7 -5
  101. metaflow-stubs/plugins/environment_decorator.pyi +7 -5
  102. metaflow-stubs/plugins/events_decorator.pyi +8 -14
  103. metaflow-stubs/plugins/frameworks/__init__.pyi +7 -5
  104. metaflow-stubs/plugins/frameworks/pytorch.pyi +8 -45
  105. metaflow-stubs/plugins/gcp/__init__.pyi +11 -7
  106. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +11 -24
  107. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +7 -11
  108. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +6 -5
  109. metaflow-stubs/plugins/gcp/gs_utils.pyi +8 -20
  110. metaflow-stubs/plugins/gcp/includefile_support.pyi +7 -17
  111. metaflow-stubs/plugins/kubernetes/__init__.pyi +13 -5
  112. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +6 -10
  113. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +9 -29
  114. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +16 -155
  115. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +9 -72
  116. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +19 -142
  117. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +8 -41
  118. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +7 -11
  119. metaflow-stubs/plugins/logs_cli.pyi +10 -9
  120. metaflow-stubs/plugins/package_cli.pyi +7 -5
  121. metaflow-stubs/plugins/parallel_decorator.pyi +11 -59
  122. metaflow-stubs/plugins/project_decorator.pyi +8 -14
  123. metaflow-stubs/plugins/pypi/__init__.pyi +12 -11
  124. metaflow-stubs/plugins/pypi/conda_decorator.pyi +8 -27
  125. metaflow-stubs/plugins/pypi/conda_environment.pyi +12 -18
  126. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +7 -5
  127. metaflow-stubs/plugins/pypi/pypi_environment.pyi +7 -39
  128. metaflow-stubs/plugins/pypi/utils.pyi +7 -11
  129. metaflow-stubs/plugins/resources_decorator.pyi +7 -5
  130. metaflow-stubs/plugins/retry_decorator.pyi +7 -11
  131. metaflow-stubs/plugins/secrets/__init__.pyi +9 -5
  132. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +8 -13
  133. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +7 -11
  134. metaflow-stubs/plugins/storage_executor.pyi +6 -11
  135. metaflow-stubs/plugins/tag_cli.pyi +14 -396
  136. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +9 -34
  137. metaflow-stubs/plugins/timeout_decorator.pyi +7 -11
  138. metaflow-stubs/procpoll.pyi +7 -5
  139. metaflow-stubs/pylint_wrapper.pyi +7 -11
  140. metaflow-stubs/runner/__init__.pyi +13 -5
  141. metaflow-stubs/runner/deployer.pyi +102 -210
  142. metaflow-stubs/runner/deployer_impl.pyi +87 -0
  143. metaflow-stubs/runner/metaflow_runner.pyi +24 -508
  144. metaflow-stubs/runner/nbdeploy.pyi +16 -60
  145. metaflow-stubs/runner/nbrun.pyi +11 -148
  146. metaflow-stubs/runner/subprocess_manager.pyi +9 -10
  147. metaflow-stubs/runner/utils.pyi +44 -9
  148. metaflow-stubs/system/__init__.pyi +9 -107
  149. metaflow-stubs/system/system_logger.pyi +6 -15
  150. metaflow-stubs/system/system_monitor.pyi +6 -16
  151. metaflow-stubs/tagging_util.pyi +6 -10
  152. metaflow-stubs/tuple_util.pyi +6 -5
  153. metaflow-stubs/version.pyi +6 -5
  154. {metaflow_stubs-2.12.27.dist-info → metaflow_stubs-2.12.29.dist-info}/METADATA +2 -2
  155. metaflow_stubs-2.12.29.dist-info/RECORD +158 -0
  156. {metaflow_stubs-2.12.27.dist-info → metaflow_stubs-2.12.29.dist-info}/WHEEL +1 -1
  157. metaflow-stubs/metadata/util.pyi +0 -18
  158. metaflow_stubs-2.12.27.dist-info/RECORD +0 -152
  159. {metaflow_stubs-2.12.27.dist-info → metaflow_stubs-2.12.29.dist-info}/top_level.txt +0 -0
@@ -1,658 +1,24 @@
1
- ##################################################################################
2
- # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.27 #
4
- # Generated on 2024-10-24T19:27:17.974797 #
5
- ##################################################################################
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.29 #
4
+ # Generated on 2024-11-07T22:19:34.613847 #
5
+ ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
- import typing
10
- if typing.TYPE_CHECKING:
11
- import metaflow.plugins.datatools.s3.s3
12
- import metaflow.exception
13
- import io
14
9
 
15
- class RangeInfo(tuple, metaclass=type):
16
- """
17
- RangeInfo(total_size, request_offset, request_length)
18
- """
19
- @staticmethod
20
- def __new__(_cls, total_size: int, request_offset: int = 0, request_length: int = -1):
21
- """
22
- Create new instance of RangeInfo(total_size, request_offset, request_length)
23
- """
24
- ...
25
- def __repr__(self):
26
- """
27
- Return a nicely formatted representation string
28
- """
29
- ...
30
- def __getnewargs__(self):
31
- """
32
- Return self as a plain tuple. Used by copy and pickle.
33
- """
34
- ...
35
- def __init__(self, total_size: int, request_offset: int, request_length: int):
36
- ...
37
- ...
38
-
39
- class S3(object, metaclass=type):
40
- """
41
- The Metaflow S3 client.
42
-
43
- This object manages the connection to S3 and a temporary diretory that is used
44
- to download objects. Note that in most cases when the data fits in memory, no local
45
- disk IO is needed as operations are cached by the operating system, which makes
46
- operations fast as long as there is enough memory available.
47
-
48
- The easiest way is to use this object as a context manager:
49
- ```
50
- with S3() as s3:
51
- data = [obj.blob for obj in s3.get_many(urls)]
52
- print(data)
53
- ```
54
- The context manager takes care of creating and deleting a temporary directory
55
- automatically. Without a context manager, you must call `.close()` to delete
56
- the directory explicitly:
57
- ```
58
- s3 = S3()
59
- data = [obj.blob for obj in s3.get_many(urls)]
60
- s3.close()
61
- ```
62
- You can customize the location of the temporary directory with `tmproot`. It
63
- defaults to the current working directory.
64
-
65
- To make it easier to deal with object locations, the client can be initialized
66
- with an S3 path prefix. There are three ways to handle locations:
67
-
68
- 1. Use a `metaflow.Run` object or `self`, e.g. `S3(run=self)` which
69
- initializes the prefix with the global `DATATOOLS_S3ROOT` path, combined
70
- with the current run ID. This mode makes it easy to version data based
71
- on the run ID consistently. You can use the `bucket` and `prefix` to
72
- override parts of `DATATOOLS_S3ROOT`.
73
-
74
- 2. Specify an S3 prefix explicitly with `s3root`,
75
- e.g. `S3(s3root='s3://mybucket/some/path')`.
76
-
77
- 3. Specify nothing, i.e. `S3()`, in which case all operations require
78
- a full S3 url prefixed with `s3://`.
79
-
80
- Parameters
81
- ----------
82
- tmproot : str, default: '.'
83
- Where to store the temporary directory.
84
- bucket : str, optional
85
- Override the bucket from `DATATOOLS_S3ROOT` when `run` is specified.
86
- prefix : str, optional
87
- Override the path from `DATATOOLS_S3ROOT` when `run` is specified.
88
- run : FlowSpec or Run, optional
89
- Derive path prefix from the current or a past run ID, e.g. S3(run=self).
90
- s3root : str, optional
91
- If `run` is not specified, use this as the S3 prefix.
92
- """
93
- @classmethod
94
- def get_root_from_config(cls, echo, create_on_absent = True):
95
- ...
96
- def __enter__(self) -> metaflow.plugins.datatools.s3.s3.S3:
97
- ...
98
- def __exit__(self, *args):
99
- ...
100
- def close(self):
101
- """
102
- Delete all temporary files downloaded in this context.
103
- """
104
- ...
105
- def list_paths(self, keys: typing.Optional[typing.Iterable[str]] = None) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
106
- """
107
- List the next level of paths in S3.
108
-
109
- If multiple keys are specified, listings are done in parallel. The returned
110
- S3Objects have `.exists == False` if the path refers to a prefix, not an
111
- existing S3 object.
112
-
113
- For instance, if the directory hierarchy is
114
- ```
115
- a/0.txt
116
- a/b/1.txt
117
- a/c/2.txt
118
- a/d/e/3.txt
119
- f/4.txt
120
- ```
121
- The `list_paths(['a', 'f'])` call returns
122
- ```
123
- a/0.txt (exists == True)
124
- a/b/ (exists == False)
125
- a/c/ (exists == False)
126
- a/d/ (exists == False)
127
- f/4.txt (exists == True)
128
- ```
129
-
130
- Parameters
131
- ----------
132
- keys : Iterable[str], optional, default None
133
- List of paths.
134
-
135
- Returns
136
- -------
137
- List[S3Object]
138
- S3Objects under the given paths, including prefixes (directories) that
139
- do not correspond to leaf objects.
140
- """
141
- ...
142
- def list_recursive(self, keys: typing.Optional[typing.Iterable[str]] = None) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
143
- """
144
- List all objects recursively under the given prefixes.
145
-
146
- If multiple keys are specified, listings are done in parallel. All objects
147
- returned have `.exists == True` as this call always returns leaf objects.
148
-
149
- For instance, if the directory hierarchy is
150
- ```
151
- a/0.txt
152
- a/b/1.txt
153
- a/c/2.txt
154
- a/d/e/3.txt
155
- f/4.txt
156
- ```
157
- The `list_paths(['a', 'f'])` call returns
158
- ```
159
- a/0.txt (exists == True)
160
- a/b/1.txt (exists == True)
161
- a/c/2.txt (exists == True)
162
- a/d/e/3.txt (exists == True)
163
- f/4.txt (exists == True)
164
- ```
165
-
166
- Parameters
167
- ----------
168
- keys : Iterable[str], optional, default None
169
- List of paths.
170
-
171
- Returns
172
- -------
173
- List[S3Object]
174
- S3Objects under the given paths.
175
- """
176
- ...
177
- def info(self, key: typing.Optional[str] = None, return_missing: bool = False) -> metaflow.plugins.datatools.s3.s3.S3Object:
178
- """
179
- Get metadata about a single object in S3.
180
-
181
- This call makes a single `HEAD` request to S3 which can be
182
- much faster than downloading all data with `get`.
183
-
184
- Parameters
185
- ----------
186
- key : str, optional, default None
187
- Object to query. It can be an S3 url or a path suffix.
188
- return_missing : bool, default False
189
- If set to True, do not raise an exception for a missing key but
190
- return it as an `S3Object` with `.exists == False`.
191
-
192
- Returns
193
- -------
194
- S3Object
195
- An S3Object corresponding to the object requested. The object
196
- will have `.downloaded == False`.
197
- """
198
- ...
199
- def info_many(self, keys: typing.Iterable[str], return_missing: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
200
- """
201
- Get metadata about many objects in S3 in parallel.
202
-
203
- This call makes a single `HEAD` request to S3 which can be
204
- much faster than downloading all data with `get`.
205
-
206
- Parameters
207
- ----------
208
- keys : Iterable[str]
209
- Objects to query. Each key can be an S3 url or a path suffix.
210
- return_missing : bool, default False
211
- If set to True, do not raise an exception for a missing key but
212
- return it as an `S3Object` with `.exists == False`.
213
-
214
- Returns
215
- -------
216
- List[S3Object]
217
- A list of S3Objects corresponding to the paths requested. The
218
- objects will have `.downloaded == False`.
219
- """
220
- ...
221
- def get(self, key: typing.Union[str, metaflow.plugins.datatools.s3.s3.S3GetObject, None] = None, return_missing: bool = False, return_info: bool = True) -> metaflow.plugins.datatools.s3.s3.S3Object:
222
- """
223
- Get a single object from S3.
224
-
225
- Parameters
226
- ----------
227
- key : Union[str, S3GetObject], optional, default None
228
- Object to download. It can be an S3 url, a path suffix, or
229
- an S3GetObject that defines a range of data to download. If None, or
230
- not provided, gets the S3 root.
231
- return_missing : bool, default False
232
- If set to True, do not raise an exception for a missing key but
233
- return it as an `S3Object` with `.exists == False`.
234
- return_info : bool, default True
235
- If set to True, fetch the content-type and user metadata associated
236
- with the object at no extra cost, included for symmetry with `get_many`
237
-
238
- Returns
239
- -------
240
- S3Object
241
- An S3Object corresponding to the object requested.
242
- """
243
- ...
244
- def get_many(self, keys: typing.Iterable[typing.Union[str, metaflow.plugins.datatools.s3.s3.S3GetObject]], return_missing: bool = False, return_info: bool = True) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
245
- """
246
- Get many objects from S3 in parallel.
247
-
248
- Parameters
249
- ----------
250
- keys : Iterable[Union[str, S3GetObject]]
251
- Objects to download. Each object can be an S3 url, a path suffix, or
252
- an S3GetObject that defines a range of data to download.
253
- return_missing : bool, default False
254
- If set to True, do not raise an exception for a missing key but
255
- return it as an `S3Object` with `.exists == False`.
256
- return_info : bool, default True
257
- If set to True, fetch the content-type and user metadata associated
258
- with the object at no extra cost, included for symmetry with `get_many`.
259
-
260
- Returns
261
- -------
262
- List[S3Object]
263
- S3Objects corresponding to the objects requested.
264
- """
265
- ...
266
- def get_recursive(self, keys: typing.Iterable[str], return_info: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
267
- """
268
- Get many objects from S3 recursively in parallel.
269
-
270
- Parameters
271
- ----------
272
- keys : Iterable[str]
273
- Prefixes to download recursively. Each prefix can be an S3 url or a path suffix
274
- which define the root prefix under which all objects are downloaded.
275
- return_info : bool, default False
276
- If set to True, fetch the content-type and user metadata associated
277
- with the object.
278
-
279
- Returns
280
- -------
281
- List[S3Object]
282
- S3Objects stored under the given prefixes.
283
- """
284
- ...
285
- def get_all(self, return_info: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
286
- """
287
- Get all objects under the prefix set in the `S3` constructor.
288
-
289
- This method requires that the `S3` object is initialized either with `run` or
290
- `s3root`.
291
-
292
- Parameters
293
- ----------
294
- return_info : bool, default False
295
- If set to True, fetch the content-type and user metadata associated
296
- with the object.
297
-
298
- Returns
299
- -------
300
- Iterable[S3Object]
301
- S3Objects stored under the main prefix.
302
- """
303
- ...
304
- def put(self, key: typing.Union[str, metaflow.plugins.datatools.s3.s3.S3PutObject], obj: typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes], overwrite: bool = True, content_type: typing.Optional[str] = None, metadata: typing.Optional[typing.Dict[str, str]] = None) -> str:
305
- """
306
- Upload a single object to S3.
307
-
308
- Parameters
309
- ----------
310
- key : Union[str, S3PutObject]
311
- Object path. It can be an S3 url or a path suffix.
312
- obj : PutValue
313
- An object to store in S3. Strings are converted to UTF-8 encoding.
314
- overwrite : bool, default True
315
- Overwrite the object if it exists. If set to False, the operation
316
- succeeds without uploading anything if the key already exists.
317
- content_type : str, optional, default None
318
- Optional MIME type for the object.
319
- metadata : Dict[str, str], optional, default None
320
- A JSON-encodable dictionary of additional headers to be stored
321
- as metadata with the object.
322
-
323
- Returns
324
- -------
325
- str
326
- URL of the object stored.
327
- """
328
- ...
329
- def put_many(self, key_objs: typing.List[typing.Union[typing.Tuple[str, typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes]], metaflow.plugins.datatools.s3.s3.S3PutObject]], overwrite: bool = True) -> typing.List[typing.Tuple[str, str]]:
330
- """
331
- Upload many objects to S3.
332
-
333
- Each object to be uploaded can be specified in two ways:
334
-
335
- 1. As a `(key, obj)` tuple where `key` is a string specifying
336
- the path and `obj` is a string or a bytes object.
337
-
338
- 2. As a `S3PutObject` which contains additional metadata to be
339
- stored with the object.
340
-
341
- Parameters
342
- ----------
343
- key_objs : List[Union[Tuple[str, PutValue], S3PutObject]]
344
- List of key-object pairs to upload.
345
- overwrite : bool, default True
346
- Overwrite the object if it exists. If set to False, the operation
347
- succeeds without uploading anything if the key already exists.
348
-
349
- Returns
350
- -------
351
- List[Tuple[str, str]]
352
- List of `(key, url)` pairs corresponding to the objects uploaded.
353
- """
354
- ...
355
- def put_files(self, key_paths: typing.List[typing.Union[typing.Tuple[str, typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes]], metaflow.plugins.datatools.s3.s3.S3PutObject]], overwrite: bool = True) -> typing.List[typing.Tuple[str, str]]:
356
- """
357
- Upload many local files to S3.
358
-
359
- Each file to be uploaded can be specified in two ways:
360
-
361
- 1. As a `(key, path)` tuple where `key` is a string specifying
362
- the S3 path and `path` is the path to a local file.
363
-
364
- 2. As a `S3PutObject` which contains additional metadata to be
365
- stored with the file.
366
-
367
- Parameters
368
- ----------
369
- key_paths : List[Union[Tuple[str, PutValue], S3PutObject]]
370
- List of files to upload.
371
- overwrite : bool, default True
372
- Overwrite the object if it exists. If set to False, the operation
373
- succeeds without uploading anything if the key already exists.
374
-
375
- Returns
376
- -------
377
- List[Tuple[str, str]]
378
- List of `(key, url)` pairs corresponding to the files uploaded.
379
- """
380
- ...
381
- ...
382
-
383
- class S3GetObject(tuple, metaclass=type):
384
- """
385
- S3GetObject(key, offset, length)
386
- """
387
- @staticmethod
388
- def __new__(_cls, key: str, offset: int, length: int):
389
- """
390
- Create new instance of S3GetObject(key, offset, length)
391
- """
392
- ...
393
- def __repr__(self):
394
- """
395
- Return a nicely formatted representation string
396
- """
397
- ...
398
- def __getnewargs__(self):
399
- """
400
- Return self as a plain tuple. Used by copy and pickle.
401
- """
402
- ...
403
- def __init__(self, key: str, offset: int, length: int):
404
- ...
405
- ...
406
-
407
- class S3Object(object, metaclass=type):
408
- """
409
- This object represents a path or an object in S3,
410
- with an optional local copy.
411
-
412
- `S3Object`s are not instantiated directly, but they are returned
413
- by many methods of the `S3` client.
414
- """
415
- def __init__(self, prefix: str, url: str, path: str, size: typing.Optional[int] = None, content_type: typing.Optional[str] = None, metadata: typing.Optional[typing.Dict[str, str]] = None, range_info: typing.Optional[metaflow.plugins.datatools.s3.s3.RangeInfo] = None, last_modified: typing.Optional[int] = None, encryption: typing.Optional[str] = None):
416
- ...
417
- @property
418
- def exists(self) -> bool:
419
- """
420
- Does this key correspond to an object in S3?
421
-
422
- Returns
423
- -------
424
- bool
425
- True if this object points at an existing object (file) in S3.
426
- """
427
- ...
428
- @property
429
- def downloaded(self) -> bool:
430
- """
431
- Has this object been downloaded?
432
-
433
- If True, the contents can be accessed through `path`, `blob`,
434
- and `text` properties.
435
-
436
- Returns
437
- -------
438
- bool
439
- True if the contents of this object have been downloaded.
440
- """
441
- ...
442
- @property
443
- def url(self) -> str:
444
- """
445
- S3 location of the object
446
-
447
- Returns
448
- -------
449
- str
450
- The S3 location of this object.
451
- """
452
- ...
453
- @property
454
- def prefix(self) -> str:
455
- """
456
- Prefix requested that matches this object.
457
-
458
- Returns
459
- -------
460
- str
461
- Requested prefix
462
- """
463
- ...
464
- @property
465
- def key(self) -> str:
466
- """
467
- Key corresponds to the key given to the get call that produced
468
- this object.
469
-
470
- This may be a full S3 URL or a suffix based on what
471
- was requested.
472
-
473
- Returns
474
- -------
475
- str
476
- Key requested.
477
- """
478
- ...
479
- @property
480
- def path(self) -> typing.Optional[str]:
481
- """
482
- Path to a local temporary file corresponding to the object downloaded.
483
-
484
- This file gets deleted automatically when a S3 scope exits.
485
- Returns None if this S3Object has not been downloaded.
486
-
487
- Returns
488
- -------
489
- str
490
- Local path, if the object has been downloaded.
491
- """
492
- ...
493
- @property
494
- def blob(self) -> typing.Optional[bytes]:
495
- """
496
- Contents of the object as a byte string or None if the
497
- object hasn't been downloaded.
498
-
499
- Returns
500
- -------
501
- bytes
502
- Contents of the object as bytes.
503
- """
504
- ...
505
- @property
506
- def text(self) -> typing.Optional[str]:
507
- """
508
- Contents of the object as a string or None if the
509
- object hasn't been downloaded.
510
-
511
- The object is assumed to contain UTF-8 encoded data.
512
-
513
- Returns
514
- -------
515
- str
516
- Contents of the object as text.
517
- """
518
- ...
519
- @property
520
- def size(self) -> typing.Optional[int]:
521
- """
522
- Size of the object in bytes.
523
-
524
- Returns None if the key does not correspond to an object in S3.
525
-
526
- Returns
527
- -------
528
- int
529
- Size of the object in bytes, if the object exists.
530
- """
531
- ...
532
- @property
533
- def has_info(self) -> bool:
534
- """
535
- Returns true if this `S3Object` contains the content-type MIME header or
536
- user-defined metadata.
537
-
538
- If False, this means that `content_type`, `metadata`, `range_info` and
539
- `last_modified` will return None.
540
-
541
- Returns
542
- -------
543
- bool
544
- True if additional metadata is available.
545
- """
546
- ...
547
- @property
548
- def metadata(self) -> typing.Optional[typing.Dict[str, str]]:
549
- """
550
- Returns a dictionary of user-defined metadata, or None if no metadata
551
- is defined.
552
-
553
- Returns
554
- -------
555
- Dict
556
- User-defined metadata.
557
- """
558
- ...
559
- @property
560
- def content_type(self) -> typing.Optional[str]:
561
- """
562
- Returns the content-type of the S3 object or None if it is not defined.
563
-
564
- Returns
565
- -------
566
- str
567
- Content type or None if the content type is undefined.
568
- """
569
- ...
570
- @property
571
- def encryption(self) -> typing.Optional[str]:
572
- """
573
- Returns the encryption type of the S3 object or None if it is not defined.
574
-
575
- Returns
576
- -------
577
- str
578
- Server-side-encryption type or None if parameter is not set.
579
- """
580
- ...
581
- @property
582
- def range_info(self) -> typing.Optional[metaflow.plugins.datatools.s3.s3.RangeInfo]:
583
- """
584
- If the object corresponds to a partially downloaded object, returns
585
- information of what was downloaded.
586
-
587
- The returned object has the following fields:
588
- - `total_size`: Size of the object in S3.
589
- - `request_offset`: The starting offset.
590
- - `request_length`: The number of bytes downloaded.
591
-
592
- Returns
593
- -------
594
- namedtuple
595
- An object containing information about the partial download. If
596
- the `S3Object` doesn't correspond to a partially downloaded file,
597
- returns None.
598
- """
599
- ...
600
- @property
601
- def last_modified(self) -> typing.Optional[int]:
602
- """
603
- Returns the last modified unix timestamp of the object.
604
-
605
- Returns
606
- -------
607
- int
608
- Unix timestamp corresponding to the last modified time.
609
- """
610
- ...
611
- def __str__(self):
612
- ...
613
- def __repr__(self):
614
- ...
615
- ...
616
-
617
- class S3PutObject(tuple, metaclass=type):
618
- """
619
- S3PutObject(key, value, path, content_type, encryption, metadata)
620
- """
621
- @staticmethod
622
- def __new__(_cls, key: str, value: typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes, None] = None, path: typing.Optional[str] = None, content_type: typing.Optional[str] = None, encryption: typing.Optional[str] = None, metadata: typing.Optional[typing.Dict[str, str]] = None):
623
- """
624
- Create new instance of S3PutObject(key, value, path, content_type, encryption, metadata)
625
- """
626
- ...
627
- def __repr__(self):
628
- """
629
- Return a nicely formatted representation string
630
- """
631
- ...
632
- def __getnewargs__(self):
633
- """
634
- Return self as a plain tuple. Used by copy and pickle.
635
- """
636
- ...
637
- def __init__(self, key: str, value: typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes, None], path: typing.Optional[str], content_type: typing.Optional[str], encryption: typing.Optional[str], metadata: typing.Optional[typing.Dict[str, str]]):
638
- ...
639
- ...
640
-
641
- class MetaflowS3InvalidObject(metaflow.exception.MetaflowException, metaclass=type):
642
- ...
643
-
644
- class MetaflowS3URLException(metaflow.exception.MetaflowException, metaclass=type):
645
- ...
646
-
647
- class MetaflowS3Exception(metaflow.exception.MetaflowException, metaclass=type):
648
- ...
649
-
650
- class MetaflowS3NotFound(metaflow.exception.MetaflowException, metaclass=type):
651
- ...
652
-
653
- class MetaflowS3AccessDenied(metaflow.exception.MetaflowException, metaclass=type):
654
- ...
655
-
656
- class MetaflowS3InvalidRange(metaflow.exception.MetaflowException, metaclass=type):
657
- ...
10
+ from . import s3util as s3util
11
+ from . import s3 as s3
12
+ from .s3 import RangeInfo as RangeInfo
13
+ from .s3 import S3 as S3
14
+ from .s3 import S3GetObject as S3GetObject
15
+ from .s3 import S3Object as S3Object
16
+ from .s3 import S3PutObject as S3PutObject
17
+ from .s3 import MetaflowS3InvalidObject as MetaflowS3InvalidObject
18
+ from .s3 import MetaflowS3URLException as MetaflowS3URLException
19
+ from .s3 import MetaflowS3Exception as MetaflowS3Exception
20
+ from .s3 import MetaflowS3NotFound as MetaflowS3NotFound
21
+ from .s3 import MetaflowS3AccessDenied as MetaflowS3AccessDenied
22
+ from .s3 import MetaflowS3InvalidRange as MetaflowS3InvalidRange
23
+ from . import s3tail as s3tail
658
24