ob-metaflow-stubs 2.11.4.1__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 (131) hide show
  1. metaflow-stubs/__init__.pyi +2753 -0
  2. metaflow-stubs/cards.pyi +266 -0
  3. metaflow-stubs/cli.pyi +137 -0
  4. metaflow-stubs/client/__init__.pyi +993 -0
  5. metaflow-stubs/client/core.pyi +1425 -0
  6. metaflow-stubs/client/filecache.pyi +87 -0
  7. metaflow-stubs/events.pyi +107 -0
  8. metaflow-stubs/exception.pyi +98 -0
  9. metaflow-stubs/flowspec.pyi +297 -0
  10. metaflow-stubs/generated_for.txt +1 -0
  11. metaflow-stubs/includefile.pyi +524 -0
  12. metaflow-stubs/metadata/metadata.pyi +377 -0
  13. metaflow-stubs/metadata/util.pyi +18 -0
  14. metaflow-stubs/metaflow_config.pyi +263 -0
  15. metaflow-stubs/metaflow_current.pyi +327 -0
  16. metaflow-stubs/mflog/mflog.pyi +22 -0
  17. metaflow-stubs/multicore_utils.pyi +62 -0
  18. metaflow-stubs/parameters.pyi +114 -0
  19. metaflow-stubs/plugins/__init__.pyi +209 -0
  20. metaflow-stubs/plugins/airflow/__init__.pyi +9 -0
  21. metaflow-stubs/plugins/airflow/airflow.pyi +179 -0
  22. metaflow-stubs/plugins/airflow/airflow_cli.pyi +90 -0
  23. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +50 -0
  24. metaflow-stubs/plugins/airflow/airflow_utils.pyi +137 -0
  25. metaflow-stubs/plugins/airflow/exception.pyi +27 -0
  26. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +26 -0
  27. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +60 -0
  28. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +54 -0
  29. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +50 -0
  30. metaflow-stubs/plugins/argo/__init__.pyi +9 -0
  31. metaflow-stubs/plugins/argo/argo_client.pyi +77 -0
  32. metaflow-stubs/plugins/argo/argo_events.pyi +79 -0
  33. metaflow-stubs/plugins/argo/argo_workflows.pyi +604 -0
  34. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +180 -0
  35. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +169 -0
  36. metaflow-stubs/plugins/aws/__init__.pyi +9 -0
  37. metaflow-stubs/plugins/aws/aws_client.pyi +22 -0
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +93 -0
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +9 -0
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +120 -0
  41. metaflow-stubs/plugins/aws/batch/batch_cli.pyi +42 -0
  42. metaflow-stubs/plugins/aws/batch/batch_client.pyi +159 -0
  43. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +145 -0
  44. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +9 -0
  45. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +73 -0
  46. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +9 -0
  47. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +22 -0
  48. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +27 -0
  49. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +18 -0
  50. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +17 -0
  51. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +220 -0
  52. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +139 -0
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +36 -0
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +49 -0
  55. metaflow-stubs/plugins/azure/__init__.pyi +9 -0
  56. metaflow-stubs/plugins/azure/azure_credential.pyi +28 -0
  57. metaflow-stubs/plugins/azure/azure_exceptions.pyi +28 -0
  58. metaflow-stubs/plugins/azure/azure_utils.pyi +76 -0
  59. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +52 -0
  60. metaflow-stubs/plugins/azure/includefile_support.pyi +63 -0
  61. metaflow-stubs/plugins/cards/__init__.pyi +9 -0
  62. metaflow-stubs/plugins/cards/card_cli.pyi +557 -0
  63. metaflow-stubs/plugins/cards/card_client.pyi +178 -0
  64. metaflow-stubs/plugins/cards/card_creator.pyi +26 -0
  65. metaflow-stubs/plugins/cards/card_datastore.pyi +111 -0
  66. metaflow-stubs/plugins/cards/card_decorator.pyi +133 -0
  67. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +67 -0
  68. metaflow-stubs/plugins/cards/card_modules/basic.pyi +263 -0
  69. metaflow-stubs/plugins/cards/card_modules/card.pyi +62 -0
  70. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +78 -0
  71. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +77 -0
  72. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +11 -0
  73. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +114 -0
  74. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +75 -0
  75. metaflow-stubs/plugins/cards/card_modules/components.pyi +251 -0
  76. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +45 -0
  77. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +24 -0
  78. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +155 -0
  79. metaflow-stubs/plugins/cards/card_resolver.pyi +60 -0
  80. metaflow-stubs/plugins/cards/component_serializer.pyi +227 -0
  81. metaflow-stubs/plugins/cards/exception.pyi +71 -0
  82. metaflow-stubs/plugins/catch_decorator.pyi +58 -0
  83. metaflow-stubs/plugins/datatools/__init__.pyi +339 -0
  84. metaflow-stubs/plugins/datatools/local.pyi +82 -0
  85. metaflow-stubs/plugins/datatools/s3/__init__.pyi +589 -0
  86. metaflow-stubs/plugins/datatools/s3/s3.pyi +875 -0
  87. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +34 -0
  88. metaflow-stubs/plugins/datatools/s3/s3util.pyi +45 -0
  89. metaflow-stubs/plugins/debug_logger.pyi +25 -0
  90. metaflow-stubs/plugins/debug_monitor.pyi +25 -0
  91. metaflow-stubs/plugins/environment_decorator.pyi +17 -0
  92. metaflow-stubs/plugins/events_decorator.pyi +34 -0
  93. metaflow-stubs/plugins/frameworks/__init__.pyi +9 -0
  94. metaflow-stubs/plugins/frameworks/pytorch.pyi +42 -0
  95. metaflow-stubs/plugins/gcp/__init__.pyi +9 -0
  96. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +22 -0
  97. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +26 -0
  98. metaflow-stubs/plugins/gcp/gs_utils.pyi +38 -0
  99. metaflow-stubs/plugins/gcp/includefile_support.pyi +63 -0
  100. metaflow-stubs/plugins/kubernetes/__init__.pyi +9 -0
  101. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +127 -0
  102. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +73 -0
  103. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +62 -0
  104. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +165 -0
  105. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +100 -0
  106. metaflow-stubs/plugins/package_cli.pyi +9 -0
  107. metaflow-stubs/plugins/parallel_decorator.pyi +34 -0
  108. metaflow-stubs/plugins/project_decorator.pyi +36 -0
  109. metaflow-stubs/plugins/pypi/__init__.pyi +18 -0
  110. metaflow-stubs/plugins/pypi/conda_decorator.pyi +59 -0
  111. metaflow-stubs/plugins/pypi/conda_environment.pyi +86 -0
  112. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +22 -0
  113. metaflow-stubs/plugins/pypi/pypi_environment.pyi +50 -0
  114. metaflow-stubs/plugins/pypi/utils.pyi +28 -0
  115. metaflow-stubs/plugins/resources_decorator.pyi +15 -0
  116. metaflow-stubs/plugins/retry_decorator.pyi +28 -0
  117. metaflow-stubs/plugins/secrets/__init__.pyi +21 -0
  118. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +30 -0
  119. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +75 -0
  120. metaflow-stubs/plugins/storage_executor.pyi +33 -0
  121. metaflow-stubs/plugins/tag_cli.pyi +370 -0
  122. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +54 -0
  123. metaflow-stubs/plugins/timeout_decorator.pyi +39 -0
  124. metaflow-stubs/procpoll.pyi +51 -0
  125. metaflow-stubs/py.typed +0 -0
  126. metaflow-stubs/pylint_wrapper.pyi +31 -0
  127. metaflow-stubs/tagging_util.pyi +52 -0
  128. ob_metaflow_stubs-2.11.4.1.dist-info/METADATA +22 -0
  129. ob_metaflow_stubs-2.11.4.1.dist-info/RECORD +131 -0
  130. ob_metaflow_stubs-2.11.4.1.dist-info/WHEEL +6 -0
  131. ob_metaflow_stubs-2.11.4.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,227 @@
1
+ ##################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.11.4.1 #
4
+ # Generated on 2024-02-28T05:30:43.975110 #
5
+ ##################################################################################
6
+
7
+ from __future__ import annotations
8
+
9
+ import typing
10
+ if typing.TYPE_CHECKING:
11
+ import metaflow.plugins.cards.card_modules.basic
12
+ import metaflow.exception
13
+ import metaflow.plugins.cards.card_modules.card
14
+ import metaflow.plugins.cards.card_modules.components
15
+
16
+ class MetaflowCardComponent(object, metaclass=type):
17
+ @property
18
+ def component_id(self):
19
+ ...
20
+ @component_id.setter
21
+ def component_id(self, value):
22
+ ...
23
+ def update(self, *args, **kwargs):
24
+ """
25
+ #FIXME document
26
+ """
27
+ ...
28
+ def render(self):
29
+ """
30
+ `render` returns a string or dictionary. This class can be called on the client side to dynamically add components to the `MetaflowCard`
31
+ """
32
+ ...
33
+ ...
34
+
35
+ class ErrorComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardComponent, metaclass=type):
36
+ def __init__(self, headline, error_message):
37
+ ...
38
+ def render(self):
39
+ ...
40
+ ...
41
+
42
+ class SectionComponent(metaflow.plugins.cards.card_modules.basic.DefaultComponent, metaclass=type):
43
+ def __init__(self, title = None, subtitle = None, columns = None, contents = []):
44
+ ...
45
+ @classmethod
46
+ def render_subcomponents(cls, component_array, additional_allowed_types = [str, dict], allow_unknowns = False):
47
+ ...
48
+ def render(self):
49
+ ...
50
+ ...
51
+
52
+ class UserComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardComponent, metaclass=type):
53
+ def update(self, *args, **kwargs):
54
+ ...
55
+ ...
56
+
57
+ def create_component_id(component):
58
+ ...
59
+
60
+ class StubComponent(metaflow.plugins.cards.card_modules.components.UserComponent, metaclass=type):
61
+ def __init__(self, component_id):
62
+ ...
63
+ def update(self, *args, **kwargs):
64
+ ...
65
+ ...
66
+
67
+ class ComponentOverwriteNotSupportedException(metaflow.exception.MetaflowException, metaclass=type):
68
+ def __init__(self, component_id, card_id, card_type):
69
+ ...
70
+ ...
71
+
72
+ RUNTIME_CARD_RENDER_INTERVAL: int
73
+
74
+ def get_card_class(card_type):
75
+ ...
76
+
77
+ def warning_message(message, logger = None, ts = False):
78
+ ...
79
+
80
+ class WarningComponent(metaflow.plugins.cards.card_modules.basic.ErrorComponent, metaclass=type):
81
+ def __init__(self, warning_message):
82
+ ...
83
+ ...
84
+
85
+ class ComponentStore(object, metaclass=type):
86
+ def __init__(self, logger, card_type = None, components = None, user_set_id = None):
87
+ ...
88
+ @property
89
+ def layout_last_changed_on(self):
90
+ """
91
+ This property helps the CardComponentManager identify when the layout of the card has changed so that it can trigger a re-render of the card.
92
+ """
93
+ ...
94
+ def __iter__(self):
95
+ ...
96
+ def __setitem__(self, key, value):
97
+ ...
98
+ def __getitem__(self, key):
99
+ ...
100
+ def __delitem__(self, key):
101
+ ...
102
+ def __contains__(self, key):
103
+ ...
104
+ def append(self, component, id = None):
105
+ ...
106
+ def extend(self, components):
107
+ ...
108
+ def clear(self):
109
+ ...
110
+ def keys(self):
111
+ ...
112
+ def values(self):
113
+ ...
114
+ def __str__(self):
115
+ ...
116
+ def __len__(self):
117
+ ...
118
+ ...
119
+
120
+ class CardComponentManager(object, metaclass=type):
121
+ def __init__(self, card_uuid, decorator_attributes, card_creator, components = None, logger = None, no_warnings = False, user_set_card_id = None, runtime_card = False, card_options = None, refresh_interval = 5):
122
+ ...
123
+ def append(self, component, id = None):
124
+ ...
125
+ def extend(self, components):
126
+ ...
127
+ def clear(self):
128
+ ...
129
+ def refresh(self, data = None, force = False):
130
+ ...
131
+ @property
132
+ def components(self):
133
+ ...
134
+ def __iter__(self):
135
+ ...
136
+ ...
137
+
138
+ class CardComponentCollector(object, metaclass=type):
139
+ def __init__(self, logger = None, card_creator = None):
140
+ ...
141
+ @staticmethod
142
+ def create_uuid():
143
+ ...
144
+ def get(self, type = None):
145
+ """
146
+ `get`
147
+ gets all the components arrays for a card `type`.
148
+ Since one `@step` can have many `@card` decorators, many decorators can have the same type. That is why this function returns a list of lists.
149
+
150
+ Args:
151
+ type ([str], optional): `type` of MetaflowCard. Defaults to None.
152
+
153
+ Returns: will return empty `list` if `type` is None or not found
154
+ List[List[MetaflowCardComponent]]
155
+ """
156
+ ...
157
+ def __getitem__(self, key):
158
+ """
159
+ Choose a specific card for manipulation.
160
+
161
+ When multiple @card decorators are present, you can add an
162
+ `ID` to distinguish between them, `@card(id=ID)`. This allows you
163
+ to add components to a specific card like this:
164
+ ```
165
+ current.card[ID].append(component)
166
+ ```
167
+
168
+ Parameters
169
+ ----------
170
+ key : str
171
+ Card ID.
172
+
173
+ Returns
174
+ -------
175
+ CardComponentManager
176
+ An object with `append` and `extend` calls which allow you to
177
+ add components to the chosen card.
178
+ """
179
+ ...
180
+ def __setitem__(self, key, value):
181
+ """
182
+ Specify components of the chosen card.
183
+
184
+ Instead of adding components to a card individually with `current.card[ID].append(component)`,
185
+ use this method to assign a list of components to a card, replacing the existing components:
186
+ ```
187
+ current.card[ID] = [FirstComponent, SecondComponent]
188
+ ```
189
+
190
+ Parameters
191
+ ----------
192
+ key: str
193
+ Card ID.
194
+
195
+ value: List[MetaflowCardComponent]
196
+ List of card components to assign to this card.
197
+ """
198
+ ...
199
+ def append(self, component, id = None):
200
+ """
201
+ Appends a component to the current card.
202
+
203
+ Parameters
204
+ ----------
205
+ component : MetaflowCardComponent
206
+ Card component to add to this card.
207
+ """
208
+ ...
209
+ def extend(self, components):
210
+ """
211
+ Appends many components to the current card.
212
+
213
+ Parameters
214
+ ----------
215
+ component : Iterator[MetaflowCardComponent]
216
+ Card components to add to this card.
217
+ """
218
+ ...
219
+ @property
220
+ def components(self):
221
+ ...
222
+ def clear(self):
223
+ ...
224
+ def refresh(self, *args, **kwargs):
225
+ ...
226
+ ...
227
+
@@ -0,0 +1,71 @@
1
+ ##################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.11.4.1 #
4
+ # Generated on 2024-02-28T05:30:43.973101 #
5
+ ##################################################################################
6
+
7
+ from __future__ import annotations
8
+
9
+ import typing
10
+ if typing.TYPE_CHECKING:
11
+ import metaflow.exception
12
+
13
+ class MetaflowException(Exception, metaclass=type):
14
+ def __init__(self, msg = "", lineno = None):
15
+ ...
16
+ def __str__(self):
17
+ ...
18
+ ...
19
+
20
+ TYPE_CHECK_REGEX: str
21
+
22
+ class CardClassFoundException(metaflow.exception.MetaflowException, metaclass=type):
23
+ def __init__(self, card_name):
24
+ ...
25
+ ...
26
+
27
+ class TypeRequiredException(metaflow.exception.MetaflowException, metaclass=type):
28
+ def __init__(self):
29
+ ...
30
+ ...
31
+
32
+ class CardNotPresentException(metaflow.exception.MetaflowException, metaclass=type):
33
+ def __init__(self, pathspec, card_type = None, card_hash = None, card_id = None):
34
+ ...
35
+ ...
36
+
37
+ class TaskNotFoundException(metaflow.exception.MetaflowException, metaclass=type):
38
+ def __init__(self, pathspec_query, resolved_from, run_id = None):
39
+ ...
40
+ ...
41
+
42
+ class IncorrectCardArgsException(metaflow.exception.MetaflowException, metaclass=type):
43
+ def __init__(self, card_type, args):
44
+ ...
45
+ ...
46
+
47
+ class UnrenderableCardException(metaflow.exception.MetaflowException, metaclass=type):
48
+ def __init__(self, card_type, args):
49
+ ...
50
+ ...
51
+
52
+ class UnresolvableDatastoreException(metaflow.exception.MetaflowException, metaclass=type):
53
+ def __init__(self, task):
54
+ ...
55
+ ...
56
+
57
+ class IncorrectArgumentException(metaflow.exception.MetaflowException, metaclass=type):
58
+ def __init__(self, obj_type):
59
+ ...
60
+ ...
61
+
62
+ class IncorrectPathspecException(metaflow.exception.MetaflowException, metaclass=type):
63
+ def __init__(self, pthspec):
64
+ ...
65
+ ...
66
+
67
+ class ComponentOverwriteNotSupportedException(metaflow.exception.MetaflowException, metaclass=type):
68
+ def __init__(self, component_id, card_id, card_type):
69
+ ...
70
+ ...
71
+
@@ -0,0 +1,58 @@
1
+ ##################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.11.4.1 #
4
+ # Generated on 2024-02-28T05:30:43.930456 #
5
+ ##################################################################################
6
+
7
+ from __future__ import annotations
8
+
9
+ import typing
10
+ if typing.TYPE_CHECKING:
11
+ import metaflow.metaflow_current
12
+ import metaflow.decorators
13
+ import metaflow.exception
14
+
15
+ class MetaflowException(Exception, metaclass=type):
16
+ def __init__(self, msg = "", lineno = None):
17
+ ...
18
+ def __str__(self):
19
+ ...
20
+ ...
21
+
22
+ class MetaflowExceptionWrapper(Exception, metaclass=type):
23
+ def __init__(self, exc = None):
24
+ ...
25
+ def __reduce__(self):
26
+ ...
27
+ def __getstate__(self):
28
+ ...
29
+ def __setstate__(self, state):
30
+ ...
31
+ def __repr__(self):
32
+ ...
33
+ def __str__(self):
34
+ ...
35
+ ...
36
+
37
+ current: metaflow.metaflow_current.Current
38
+
39
+ NUM_FALLBACK_RETRIES: int
40
+
41
+ class FailureHandledByCatch(metaflow.exception.MetaflowException, metaclass=type):
42
+ def __init__(self, retry_count):
43
+ ...
44
+ ...
45
+
46
+ class CatchDecorator(metaflow.decorators.StepDecorator, metaclass=type):
47
+ def step_init(self, flow, graph, step, decos, environment, flow_datastore, logger):
48
+ ...
49
+ def task_exception(self, exception, step, flow, graph, retry_count, max_user_code_retries):
50
+ ...
51
+ def task_post_step(self, step_name, flow, graph, retry_count, max_user_code_retries):
52
+ ...
53
+ def step_task_retry_count(self):
54
+ ...
55
+ def task_decorate(self, step_func, flow, graph, retry_count, max_user_code_retries, ubf_context):
56
+ ...
57
+ ...
58
+
@@ -0,0 +1,339 @@
1
+ ##################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.11.4.1 #
4
+ # Generated on 2024-02-28T05:30:43.932327 #
5
+ ##################################################################################
6
+
7
+ from __future__ import annotations
8
+
9
+ import typing
10
+ if typing.TYPE_CHECKING:
11
+ import io
12
+ import metaflow.plugins.datatools.s3.s3
13
+ import metaflow.exception
14
+
15
+ def read_in_chunks(dst, src, src_sz, max_chunk_size):
16
+ ...
17
+
18
+ class MetaflowLocalNotFound(metaflow.exception.MetaflowException, metaclass=type):
19
+ ...
20
+
21
+ class MetaflowLocalURLException(metaflow.exception.MetaflowException, metaclass=type):
22
+ ...
23
+
24
+ class Local(object, metaclass=type):
25
+ @classmethod
26
+ def get_root_from_config(cls, echo, create_on_absent = True):
27
+ ...
28
+ def __init__(self):
29
+ """
30
+ Initialize a new context for Local file operations. This object is based used as
31
+ a context manager for a with statement.
32
+ """
33
+ ...
34
+ def __enter__(self):
35
+ ...
36
+ def __exit__(self, *args):
37
+ ...
38
+ def get(self, key = None, return_missing = False):
39
+ ...
40
+ def put(self, key, obj, overwrite = True):
41
+ ...
42
+ def info(self, key = None, return_missing = False):
43
+ ...
44
+ ...
45
+
46
+ class MetaflowS3Exception(metaflow.exception.MetaflowException, metaclass=type):
47
+ ...
48
+
49
+ class S3(object, metaclass=type):
50
+ @classmethod
51
+ def get_root_from_config(cls, echo, create_on_absent = True):
52
+ ...
53
+ def __enter__(self) -> metaflow.plugins.datatools.s3.s3.S3:
54
+ ...
55
+ def __exit__(self, *args):
56
+ ...
57
+ def close(self):
58
+ """
59
+ Delete all temporary files downloaded in this context.
60
+ """
61
+ ...
62
+ def list_paths(self, keys: typing.Optional[typing.Iterable[str]] = None) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
63
+ """
64
+ List the next level of paths in S3.
65
+
66
+ If multiple keys are specified, listings are done in parallel. The returned
67
+ S3Objects have `.exists == False` if the path refers to a prefix, not an
68
+ existing S3 object.
69
+
70
+ For instance, if the directory hierarchy is
71
+ ```
72
+ a/0.txt
73
+ a/b/1.txt
74
+ a/c/2.txt
75
+ a/d/e/3.txt
76
+ f/4.txt
77
+ ```
78
+ The `list_paths(['a', 'f'])` call returns
79
+ ```
80
+ a/0.txt (exists == True)
81
+ a/b/ (exists == False)
82
+ a/c/ (exists == False)
83
+ a/d/ (exists == False)
84
+ f/4.txt (exists == True)
85
+ ```
86
+
87
+ Parameters
88
+ ----------
89
+ keys : Iterable[str], optional, default None
90
+ List of paths.
91
+
92
+ Returns
93
+ -------
94
+ List[S3Object]
95
+ S3Objects under the given paths, including prefixes (directories) that
96
+ do not correspond to leaf objects.
97
+ """
98
+ ...
99
+ def list_recursive(self, keys: typing.Optional[typing.Iterable[str]] = None) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
100
+ """
101
+ List all objects recursively under the given prefixes.
102
+
103
+ If multiple keys are specified, listings are done in parallel. All objects
104
+ returned have `.exists == True` as this call always returns leaf objects.
105
+
106
+ For instance, if the directory hierarchy is
107
+ ```
108
+ a/0.txt
109
+ a/b/1.txt
110
+ a/c/2.txt
111
+ a/d/e/3.txt
112
+ f/4.txt
113
+ ```
114
+ The `list_paths(['a', 'f'])` call returns
115
+ ```
116
+ a/0.txt (exists == True)
117
+ a/b/1.txt (exists == True)
118
+ a/c/2.txt (exists == True)
119
+ a/d/e/3.txt (exists == True)
120
+ f/4.txt (exists == True)
121
+ ```
122
+
123
+ Parameters
124
+ ----------
125
+ keys : Iterable[str], optional, default None
126
+ List of paths.
127
+
128
+ Returns
129
+ -------
130
+ List[S3Object]
131
+ S3Objects under the given paths.
132
+ """
133
+ ...
134
+ def info(self, key: typing.Optional[str] = None, return_missing: bool = False) -> metaflow.plugins.datatools.s3.s3.S3Object:
135
+ """
136
+ Get metadata about a single object in S3.
137
+
138
+ This call makes a single `HEAD` request to S3 which can be
139
+ much faster than downloading all data with `get`.
140
+
141
+ Parameters
142
+ ----------
143
+ key : str, optional, default None
144
+ Object to query. It can be an S3 url or a path suffix.
145
+ return_missing : bool, default False
146
+ If set to True, do not raise an exception for a missing key but
147
+ return it as an `S3Object` with `.exists == False`.
148
+
149
+ Returns
150
+ -------
151
+ S3Object
152
+ An S3Object corresponding to the object requested. The object
153
+ will have `.downloaded == False`.
154
+ """
155
+ ...
156
+ def info_many(self, keys: typing.Iterable[str], return_missing: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
157
+ """
158
+ Get metadata about many objects in S3 in parallel.
159
+
160
+ This call makes a single `HEAD` request to S3 which can be
161
+ much faster than downloading all data with `get`.
162
+
163
+ Parameters
164
+ ----------
165
+ keys : Iterable[str]
166
+ Objects to query. Each key can be an S3 url or a path suffix.
167
+ return_missing : bool, default False
168
+ If set to True, do not raise an exception for a missing key but
169
+ return it as an `S3Object` with `.exists == False`.
170
+
171
+ Returns
172
+ -------
173
+ List[S3Object]
174
+ A list of S3Objects corresponding to the paths requested. The
175
+ objects will have `.downloaded == False`.
176
+ """
177
+ ...
178
+ 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:
179
+ """
180
+ Get a single object from S3.
181
+
182
+ Parameters
183
+ ----------
184
+ key : Union[str, S3GetObject], optional, default None
185
+ Object to download. It can be an S3 url, a path suffix, or
186
+ an S3GetObject that defines a range of data to download. If None, or
187
+ not provided, gets the S3 root.
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
+ return_info : bool, default True
192
+ If set to True, fetch the content-type and user metadata associated
193
+ with the object at no extra cost, included for symmetry with `get_many`
194
+
195
+ Returns
196
+ -------
197
+ S3Object
198
+ An S3Object corresponding to the object requested.
199
+ """
200
+ ...
201
+ 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]:
202
+ """
203
+ Get many objects from S3 in parallel.
204
+
205
+ Parameters
206
+ ----------
207
+ keys : Iterable[Union[str, S3GetObject]]
208
+ Objects to download. Each object can be an S3 url, a path suffix, or
209
+ an S3GetObject that defines a range of data to download.
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
+ return_info : bool, default True
214
+ If set to True, fetch the content-type and user metadata associated
215
+ with the object at no extra cost, included for symmetry with `get_many`.
216
+
217
+ Returns
218
+ -------
219
+ List[S3Object]
220
+ S3Objects corresponding to the objects requested.
221
+ """
222
+ ...
223
+ def get_recursive(self, keys: typing.Iterable[str], return_info: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
224
+ """
225
+ Get many objects from S3 recursively in parallel.
226
+
227
+ Parameters
228
+ ----------
229
+ keys : Iterable[str]
230
+ Prefixes to download recursively. Each prefix can be an S3 url or a path suffix
231
+ which define the root prefix under which all objects are downloaded.
232
+ return_info : bool, default False
233
+ If set to True, fetch the content-type and user metadata associated
234
+ with the object.
235
+
236
+ Returns
237
+ -------
238
+ List[S3Object]
239
+ S3Objects stored under the given prefixes.
240
+ """
241
+ ...
242
+ def get_all(self, return_info: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
243
+ """
244
+ Get all objects under the prefix set in the `S3` constructor.
245
+
246
+ This method requires that the `S3` object is initialized either with `run` or
247
+ `s3root`.
248
+
249
+ Parameters
250
+ ----------
251
+ return_info : bool, default False
252
+ If set to True, fetch the content-type and user metadata associated
253
+ with the object.
254
+
255
+ Returns
256
+ -------
257
+ Iterable[S3Object]
258
+ S3Objects stored under the main prefix.
259
+ """
260
+ ...
261
+ 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:
262
+ """
263
+ Upload a single object to S3.
264
+
265
+ Parameters
266
+ ----------
267
+ key : Union[str, S3PutObject]
268
+ Object path. It can be an S3 url or a path suffix.
269
+ obj : PutValue
270
+ An object to store in S3. Strings are converted to UTF-8 encoding.
271
+ overwrite : bool, default True
272
+ Overwrite the object if it exists. If set to False, the operation
273
+ succeeds without uploading anything if the key already exists.
274
+ content_type : str, optional, default None
275
+ Optional MIME type for the object.
276
+ metadata : Dict[str, str], optional, default None
277
+ A JSON-encodable dictionary of additional headers to be stored
278
+ as metadata with the object.
279
+
280
+ Returns
281
+ -------
282
+ str
283
+ URL of the object stored.
284
+ """
285
+ ...
286
+ 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]]:
287
+ """
288
+ Upload many objects to S3.
289
+
290
+ Each object to be uploaded can be specified in two ways:
291
+
292
+ 1. As a `(key, obj)` tuple where `key` is a string specifying
293
+ the path and `obj` is a string or a bytes object.
294
+
295
+ 2. As a `S3PutObject` which contains additional metadata to be
296
+ stored with the object.
297
+
298
+ Parameters
299
+ ----------
300
+ key_objs : List[Union[Tuple[str, PutValue], S3PutObject]]
301
+ List of key-object pairs to upload.
302
+ overwrite : bool, default True
303
+ Overwrite the object if it exists. If set to False, the operation
304
+ succeeds without uploading anything if the key already exists.
305
+
306
+ Returns
307
+ -------
308
+ List[Tuple[str, str]]
309
+ List of `(key, url)` pairs corresponding to the objects uploaded.
310
+ """
311
+ ...
312
+ 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]]:
313
+ """
314
+ Upload many local files to S3.
315
+
316
+ Each file to be uploaded can be specified in two ways:
317
+
318
+ 1. As a `(key, path)` tuple where `key` is a string specifying
319
+ the S3 path and `path` is the path to a local file.
320
+
321
+ 2. As a `S3PutObject` which contains additional metadata to be
322
+ stored with the file.
323
+
324
+ Parameters
325
+ ----------
326
+ key_paths : List[Union[Tuple[str, PutValue], S3PutObject]]
327
+ List of files to upload.
328
+ overwrite : bool, default True
329
+ Overwrite the object if it exists. If set to False, the operation
330
+ succeeds without uploading anything if the key already exists.
331
+
332
+ Returns
333
+ -------
334
+ List[Tuple[str, str]]
335
+ List of `(key, url)` pairs corresponding to the files uploaded.
336
+ """
337
+ ...
338
+ ...
339
+