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.
- metaflow-stubs/__init__.pyi +2753 -0
- metaflow-stubs/cards.pyi +266 -0
- metaflow-stubs/cli.pyi +137 -0
- metaflow-stubs/client/__init__.pyi +993 -0
- metaflow-stubs/client/core.pyi +1425 -0
- metaflow-stubs/client/filecache.pyi +87 -0
- metaflow-stubs/events.pyi +107 -0
- metaflow-stubs/exception.pyi +98 -0
- metaflow-stubs/flowspec.pyi +297 -0
- metaflow-stubs/generated_for.txt +1 -0
- metaflow-stubs/includefile.pyi +524 -0
- metaflow-stubs/metadata/metadata.pyi +377 -0
- metaflow-stubs/metadata/util.pyi +18 -0
- metaflow-stubs/metaflow_config.pyi +263 -0
- metaflow-stubs/metaflow_current.pyi +327 -0
- metaflow-stubs/mflog/mflog.pyi +22 -0
- metaflow-stubs/multicore_utils.pyi +62 -0
- metaflow-stubs/parameters.pyi +114 -0
- metaflow-stubs/plugins/__init__.pyi +209 -0
- metaflow-stubs/plugins/airflow/__init__.pyi +9 -0
- metaflow-stubs/plugins/airflow/airflow.pyi +179 -0
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +90 -0
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +50 -0
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +137 -0
- metaflow-stubs/plugins/airflow/exception.pyi +27 -0
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +26 -0
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +60 -0
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +54 -0
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +50 -0
- metaflow-stubs/plugins/argo/__init__.pyi +9 -0
- metaflow-stubs/plugins/argo/argo_client.pyi +77 -0
- metaflow-stubs/plugins/argo/argo_events.pyi +79 -0
- metaflow-stubs/plugins/argo/argo_workflows.pyi +604 -0
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +180 -0
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +169 -0
- metaflow-stubs/plugins/aws/__init__.pyi +9 -0
- metaflow-stubs/plugins/aws/aws_client.pyi +22 -0
- metaflow-stubs/plugins/aws/aws_utils.pyi +93 -0
- metaflow-stubs/plugins/aws/batch/__init__.pyi +9 -0
- metaflow-stubs/plugins/aws/batch/batch.pyi +120 -0
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +42 -0
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +159 -0
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +145 -0
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +9 -0
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +73 -0
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +9 -0
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +22 -0
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +27 -0
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +18 -0
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +17 -0
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +220 -0
- metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +139 -0
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +36 -0
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +49 -0
- metaflow-stubs/plugins/azure/__init__.pyi +9 -0
- metaflow-stubs/plugins/azure/azure_credential.pyi +28 -0
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +28 -0
- metaflow-stubs/plugins/azure/azure_utils.pyi +76 -0
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +52 -0
- metaflow-stubs/plugins/azure/includefile_support.pyi +63 -0
- metaflow-stubs/plugins/cards/__init__.pyi +9 -0
- metaflow-stubs/plugins/cards/card_cli.pyi +557 -0
- metaflow-stubs/plugins/cards/card_client.pyi +178 -0
- metaflow-stubs/plugins/cards/card_creator.pyi +26 -0
- metaflow-stubs/plugins/cards/card_datastore.pyi +111 -0
- metaflow-stubs/plugins/cards/card_decorator.pyi +133 -0
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +67 -0
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +263 -0
- metaflow-stubs/plugins/cards/card_modules/card.pyi +62 -0
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +78 -0
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +77 -0
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +11 -0
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +114 -0
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +75 -0
- metaflow-stubs/plugins/cards/card_modules/components.pyi +251 -0
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +45 -0
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +24 -0
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +155 -0
- metaflow-stubs/plugins/cards/card_resolver.pyi +60 -0
- metaflow-stubs/plugins/cards/component_serializer.pyi +227 -0
- metaflow-stubs/plugins/cards/exception.pyi +71 -0
- metaflow-stubs/plugins/catch_decorator.pyi +58 -0
- metaflow-stubs/plugins/datatools/__init__.pyi +339 -0
- metaflow-stubs/plugins/datatools/local.pyi +82 -0
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +589 -0
- metaflow-stubs/plugins/datatools/s3/s3.pyi +875 -0
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +34 -0
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +45 -0
- metaflow-stubs/plugins/debug_logger.pyi +25 -0
- metaflow-stubs/plugins/debug_monitor.pyi +25 -0
- metaflow-stubs/plugins/environment_decorator.pyi +17 -0
- metaflow-stubs/plugins/events_decorator.pyi +34 -0
- metaflow-stubs/plugins/frameworks/__init__.pyi +9 -0
- metaflow-stubs/plugins/frameworks/pytorch.pyi +42 -0
- metaflow-stubs/plugins/gcp/__init__.pyi +9 -0
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +22 -0
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +26 -0
- metaflow-stubs/plugins/gcp/gs_utils.pyi +38 -0
- metaflow-stubs/plugins/gcp/includefile_support.pyi +63 -0
- metaflow-stubs/plugins/kubernetes/__init__.pyi +9 -0
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +127 -0
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +73 -0
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +62 -0
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +165 -0
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +100 -0
- metaflow-stubs/plugins/package_cli.pyi +9 -0
- metaflow-stubs/plugins/parallel_decorator.pyi +34 -0
- metaflow-stubs/plugins/project_decorator.pyi +36 -0
- metaflow-stubs/plugins/pypi/__init__.pyi +18 -0
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +59 -0
- metaflow-stubs/plugins/pypi/conda_environment.pyi +86 -0
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +22 -0
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +50 -0
- metaflow-stubs/plugins/pypi/utils.pyi +28 -0
- metaflow-stubs/plugins/resources_decorator.pyi +15 -0
- metaflow-stubs/plugins/retry_decorator.pyi +28 -0
- metaflow-stubs/plugins/secrets/__init__.pyi +21 -0
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +30 -0
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +75 -0
- metaflow-stubs/plugins/storage_executor.pyi +33 -0
- metaflow-stubs/plugins/tag_cli.pyi +370 -0
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +54 -0
- metaflow-stubs/plugins/timeout_decorator.pyi +39 -0
- metaflow-stubs/procpoll.pyi +51 -0
- metaflow-stubs/py.typed +0 -0
- metaflow-stubs/pylint_wrapper.pyi +31 -0
- metaflow-stubs/tagging_util.pyi +52 -0
- ob_metaflow_stubs-2.11.4.1.dist-info/METADATA +22 -0
- ob_metaflow_stubs-2.11.4.1.dist-info/RECORD +131 -0
- ob_metaflow_stubs-2.11.4.1.dist-info/WHEEL +6 -0
- ob_metaflow_stubs-2.11.4.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,263 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.11.4.1 #
|
4
|
+
# Generated on 2024-02-28T05:30:43.937993 #
|
5
|
+
##################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import typing
|
10
|
+
if typing.TYPE_CHECKING:
|
11
|
+
import metaflow
|
12
|
+
import metaflow.plugins.cards.card_modules.basic
|
13
|
+
import metaflow.plugins.cards.card_modules.card
|
14
|
+
|
15
|
+
class MetaflowCard(object, metaclass=type):
|
16
|
+
def __init__(self, options = {}, components = [], graph = None):
|
17
|
+
...
|
18
|
+
def render(self, task: "metaflow.Task") -> str:
|
19
|
+
"""
|
20
|
+
Produce custom card contents in HTML.
|
21
|
+
|
22
|
+
Subclasses override this method to customize the card contents.
|
23
|
+
|
24
|
+
Parameters
|
25
|
+
----------
|
26
|
+
task : Task
|
27
|
+
A `Task` object that allows you to access data from the finished task and tasks
|
28
|
+
preceding it.
|
29
|
+
|
30
|
+
Returns
|
31
|
+
-------
|
32
|
+
str
|
33
|
+
Card contents as an HTML string.
|
34
|
+
"""
|
35
|
+
...
|
36
|
+
def render_runtime(self, task, data):
|
37
|
+
...
|
38
|
+
def refresh(self, task, data):
|
39
|
+
...
|
40
|
+
def reload_content_token(self, task, data):
|
41
|
+
...
|
42
|
+
...
|
43
|
+
|
44
|
+
class MetaflowCardComponent(object, metaclass=type):
|
45
|
+
@property
|
46
|
+
def component_id(self):
|
47
|
+
...
|
48
|
+
@component_id.setter
|
49
|
+
def component_id(self, value):
|
50
|
+
...
|
51
|
+
def update(self, *args, **kwargs):
|
52
|
+
"""
|
53
|
+
#FIXME document
|
54
|
+
"""
|
55
|
+
...
|
56
|
+
def render(self):
|
57
|
+
"""
|
58
|
+
`render` returns a string or dictionary. This class can be called on the client side to dynamically add components to the `MetaflowCard`
|
59
|
+
"""
|
60
|
+
...
|
61
|
+
...
|
62
|
+
|
63
|
+
class TaskToDict(object, metaclass=type):
|
64
|
+
def __init__(self, only_repr = False, runtime = False):
|
65
|
+
...
|
66
|
+
def __call__(self, task, graph = None):
|
67
|
+
...
|
68
|
+
def object_type(self, object):
|
69
|
+
...
|
70
|
+
def parse_image(self, data_object):
|
71
|
+
...
|
72
|
+
def infer_object(self, artifact_object):
|
73
|
+
...
|
74
|
+
...
|
75
|
+
|
76
|
+
ABS_DIR_PATH: str
|
77
|
+
|
78
|
+
RENDER_TEMPLATE_PATH: str
|
79
|
+
|
80
|
+
JS_PATH: str
|
81
|
+
|
82
|
+
CSS_PATH: str
|
83
|
+
|
84
|
+
def transform_flow_graph(step_info):
|
85
|
+
...
|
86
|
+
|
87
|
+
def read_file(path):
|
88
|
+
...
|
89
|
+
|
90
|
+
class DefaultComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardComponent, metaclass=type):
|
91
|
+
def __init__(self, title = None, subtitle = None):
|
92
|
+
...
|
93
|
+
def render(self):
|
94
|
+
...
|
95
|
+
...
|
96
|
+
|
97
|
+
class TitleComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardComponent, metaclass=type):
|
98
|
+
def __init__(self, text = None):
|
99
|
+
...
|
100
|
+
def render(self):
|
101
|
+
...
|
102
|
+
...
|
103
|
+
|
104
|
+
class SubTitleComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardComponent, metaclass=type):
|
105
|
+
def __init__(self, text = None):
|
106
|
+
...
|
107
|
+
def render(self):
|
108
|
+
...
|
109
|
+
...
|
110
|
+
|
111
|
+
class SectionComponent(DefaultComponent, metaclass=type):
|
112
|
+
def __init__(self, title = None, subtitle = None, columns = None, contents = []):
|
113
|
+
...
|
114
|
+
@classmethod
|
115
|
+
def render_subcomponents(cls, component_array, additional_allowed_types = [str, dict], allow_unknowns = False):
|
116
|
+
...
|
117
|
+
def render(self):
|
118
|
+
...
|
119
|
+
...
|
120
|
+
|
121
|
+
class ImageComponent(DefaultComponent, metaclass=type):
|
122
|
+
def __init__(self, src = None, label = None, title = None, subtitle = None):
|
123
|
+
...
|
124
|
+
def render(self):
|
125
|
+
...
|
126
|
+
...
|
127
|
+
|
128
|
+
class TableComponent(DefaultComponent, metaclass=type):
|
129
|
+
def __init__(self, title = None, subtitle = None, headers = [], data = [[]], vertical = False):
|
130
|
+
...
|
131
|
+
@classmethod
|
132
|
+
def validate(cls, headers, data):
|
133
|
+
...
|
134
|
+
def render(self):
|
135
|
+
...
|
136
|
+
...
|
137
|
+
|
138
|
+
class DagComponent(DefaultComponent, metaclass=type):
|
139
|
+
def __init__(self, title = None, subtitle = None, data = {}):
|
140
|
+
...
|
141
|
+
def render(self):
|
142
|
+
...
|
143
|
+
...
|
144
|
+
|
145
|
+
class TextComponent(DefaultComponent, metaclass=type):
|
146
|
+
def __init__(self, text = None):
|
147
|
+
...
|
148
|
+
def render(self):
|
149
|
+
...
|
150
|
+
...
|
151
|
+
|
152
|
+
class LogComponent(DefaultComponent, metaclass=type):
|
153
|
+
def __init__(self, data = None):
|
154
|
+
...
|
155
|
+
def render(self):
|
156
|
+
...
|
157
|
+
...
|
158
|
+
|
159
|
+
class HTMLComponent(DefaultComponent, metaclass=type):
|
160
|
+
def __init__(self, data = None):
|
161
|
+
...
|
162
|
+
def render(self):
|
163
|
+
...
|
164
|
+
...
|
165
|
+
|
166
|
+
class PageComponent(DefaultComponent, metaclass=type):
|
167
|
+
def __init__(self, title = None, subtitle = None, contents = []):
|
168
|
+
...
|
169
|
+
def render(self):
|
170
|
+
...
|
171
|
+
...
|
172
|
+
|
173
|
+
class ErrorComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardComponent, metaclass=type):
|
174
|
+
def __init__(self, headline, error_message):
|
175
|
+
...
|
176
|
+
def render(self):
|
177
|
+
...
|
178
|
+
...
|
179
|
+
|
180
|
+
class SerializationErrorComponent(ErrorComponent, metaclass=type):
|
181
|
+
def __init__(self, component_name, error_message):
|
182
|
+
...
|
183
|
+
...
|
184
|
+
|
185
|
+
class ArtifactsComponent(DefaultComponent, metaclass=type):
|
186
|
+
def __init__(self, title = None, subtitle = None, data = {}):
|
187
|
+
...
|
188
|
+
def render(self):
|
189
|
+
...
|
190
|
+
...
|
191
|
+
|
192
|
+
class MarkdownComponent(DefaultComponent, metaclass=type):
|
193
|
+
def __init__(self, text = None):
|
194
|
+
...
|
195
|
+
def render(self):
|
196
|
+
...
|
197
|
+
...
|
198
|
+
|
199
|
+
class TaskInfoComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardComponent, metaclass=type):
|
200
|
+
def __init__(self, task, page_title = "Task Info", only_repr = True, graph = None, components = [], runtime = False):
|
201
|
+
...
|
202
|
+
def render(self):
|
203
|
+
"""
|
204
|
+
Returns:
|
205
|
+
a dictionary of form:
|
206
|
+
dict(metadata = {},components= [])
|
207
|
+
"""
|
208
|
+
...
|
209
|
+
...
|
210
|
+
|
211
|
+
class ErrorCard(metaflow.plugins.cards.card_modules.card.MetaflowCard, metaclass=type):
|
212
|
+
def __init__(self, options = {}, components = [], graph = None):
|
213
|
+
...
|
214
|
+
def render(self, task, stack_trace = None):
|
215
|
+
...
|
216
|
+
...
|
217
|
+
|
218
|
+
class DefaultCardJSON(metaflow.plugins.cards.card_modules.card.MetaflowCard, metaclass=type):
|
219
|
+
def __init__(self, options = {"only_repr": True}, components = [], graph = None):
|
220
|
+
...
|
221
|
+
def render(self, task):
|
222
|
+
...
|
223
|
+
...
|
224
|
+
|
225
|
+
class DefaultCard(metaflow.plugins.cards.card_modules.card.MetaflowCard, metaclass=type):
|
226
|
+
def __init__(self, options = {"only_repr": True}, components = [], graph = None):
|
227
|
+
...
|
228
|
+
def render(self, task, runtime = False):
|
229
|
+
...
|
230
|
+
def render_runtime(self, task, data):
|
231
|
+
...
|
232
|
+
def refresh(self, task, data):
|
233
|
+
...
|
234
|
+
def reload_content_token(self, task, data):
|
235
|
+
"""
|
236
|
+
The reload token will change when the component array has changed in the Metaflow card.
|
237
|
+
The change in the component array is signified by the change in the component_update_ts.
|
238
|
+
"""
|
239
|
+
...
|
240
|
+
...
|
241
|
+
|
242
|
+
class BlankCard(metaflow.plugins.cards.card_modules.card.MetaflowCard, metaclass=type):
|
243
|
+
def __init__(self, options = {"title": ""}, components = [], graph = None):
|
244
|
+
...
|
245
|
+
def render(self, task, components = [], runtime = False):
|
246
|
+
...
|
247
|
+
def render_runtime(self, task, data):
|
248
|
+
...
|
249
|
+
def refresh(self, task, data):
|
250
|
+
...
|
251
|
+
def reload_content_token(self, task, data):
|
252
|
+
"""
|
253
|
+
The reload token will change when the component array has changed in the Metaflow card.
|
254
|
+
The change in the component array is signified by the change in the component_update_ts.
|
255
|
+
"""
|
256
|
+
...
|
257
|
+
...
|
258
|
+
|
259
|
+
class TaskSpecCard(metaflow.plugins.cards.card_modules.card.MetaflowCard, metaclass=type):
|
260
|
+
def render(self, task):
|
261
|
+
...
|
262
|
+
...
|
263
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.11.4.1 #
|
4
|
+
# Generated on 2024-02-28T05:30:43.946774 #
|
5
|
+
##################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import typing
|
10
|
+
if typing.TYPE_CHECKING:
|
11
|
+
import metaflow
|
12
|
+
|
13
|
+
TYPE_CHECKING: bool
|
14
|
+
|
15
|
+
class MetaflowCard(object, metaclass=type):
|
16
|
+
def __init__(self, options = {}, components = [], graph = None):
|
17
|
+
...
|
18
|
+
def render(self, task: "metaflow.Task") -> str:
|
19
|
+
"""
|
20
|
+
Produce custom card contents in HTML.
|
21
|
+
|
22
|
+
Subclasses override this method to customize the card contents.
|
23
|
+
|
24
|
+
Parameters
|
25
|
+
----------
|
26
|
+
task : Task
|
27
|
+
A `Task` object that allows you to access data from the finished task and tasks
|
28
|
+
preceding it.
|
29
|
+
|
30
|
+
Returns
|
31
|
+
-------
|
32
|
+
str
|
33
|
+
Card contents as an HTML string.
|
34
|
+
"""
|
35
|
+
...
|
36
|
+
def render_runtime(self, task, data):
|
37
|
+
...
|
38
|
+
def refresh(self, task, data):
|
39
|
+
...
|
40
|
+
def reload_content_token(self, task, data):
|
41
|
+
...
|
42
|
+
...
|
43
|
+
|
44
|
+
class MetaflowCardComponent(object, metaclass=type):
|
45
|
+
@property
|
46
|
+
def component_id(self):
|
47
|
+
...
|
48
|
+
@component_id.setter
|
49
|
+
def component_id(self, value):
|
50
|
+
...
|
51
|
+
def update(self, *args, **kwargs):
|
52
|
+
"""
|
53
|
+
#FIXME document
|
54
|
+
"""
|
55
|
+
...
|
56
|
+
def render(self):
|
57
|
+
"""
|
58
|
+
`render` returns a string or dictionary. This class can be called on the client side to dynamically add components to the `MetaflowCard`
|
59
|
+
"""
|
60
|
+
...
|
61
|
+
...
|
62
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.11.4.1 #
|
4
|
+
# Generated on 2024-02-28T05:30:44.011975 #
|
5
|
+
##################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
|
10
|
+
def main(template, data = None, **kwargs):
|
11
|
+
...
|
12
|
+
|
13
|
+
def cli_main():
|
14
|
+
"""
|
15
|
+
Render mustache templates using json files
|
16
|
+
"""
|
17
|
+
...
|
18
|
+
|
19
|
+
def render(template = "", data = {}, partials_path = ".", partials_ext = "mustache", partials_dict = {}, padding = "", def_ldel = "{{", def_rdel = "}}", scopes = None, warn = False, keep = False):
|
20
|
+
"""
|
21
|
+
Render a mustache template.
|
22
|
+
|
23
|
+
Renders a mustache template with a data scope and partial capability.
|
24
|
+
Given the file structure...
|
25
|
+
╷
|
26
|
+
├─╼ main.py
|
27
|
+
├─╼ main.ms
|
28
|
+
└─┮ partials
|
29
|
+
└── part.ms
|
30
|
+
|
31
|
+
then main.py would make the following call:
|
32
|
+
|
33
|
+
render(open('main.ms', 'r'), {...}, 'partials', 'ms')
|
34
|
+
|
35
|
+
|
36
|
+
Arguments:
|
37
|
+
|
38
|
+
template -- A file-like object or a string containing the template
|
39
|
+
|
40
|
+
data -- A python dictionary with your data scope
|
41
|
+
|
42
|
+
partials_path -- The path to where your partials are stored
|
43
|
+
If set to None, then partials won't be loaded from the file system
|
44
|
+
(defaults to '.')
|
45
|
+
|
46
|
+
partials_ext -- The extension that you want the parser to look for
|
47
|
+
(defaults to 'mustache')
|
48
|
+
|
49
|
+
partials_dict -- A python dictionary which will be search for partials
|
50
|
+
before the filesystem is. {'include': 'foo'} is the same
|
51
|
+
as a file called include.mustache
|
52
|
+
(defaults to {})
|
53
|
+
|
54
|
+
padding -- This is for padding partials, and shouldn't be used
|
55
|
+
(but can be if you really want to)
|
56
|
+
|
57
|
+
def_ldel -- The default left delimiter
|
58
|
+
("{{" by default, as in spec compliant mustache)
|
59
|
+
|
60
|
+
def_rdel -- The default right delimiter
|
61
|
+
("}}" by default, as in spec compliant mustache)
|
62
|
+
|
63
|
+
scopes -- The list of scopes that get_key will look through
|
64
|
+
|
65
|
+
warn -- Issue a warning to stderr when a template substitution isn't found in the data
|
66
|
+
|
67
|
+
keep -- Keep unreplaced tags when a template substitution isn't found in the data
|
68
|
+
|
69
|
+
|
70
|
+
Returns:
|
71
|
+
|
72
|
+
A string containing the rendered template.
|
73
|
+
"""
|
74
|
+
...
|
75
|
+
|
76
|
+
class ChevronError(SyntaxError, metaclass=type):
|
77
|
+
...
|
78
|
+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.11.4.1 #
|
4
|
+
# Generated on 2024-02-28T05:30:44.015794 #
|
5
|
+
##################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
|
10
|
+
def render(template = "", data = {}, partials_path = ".", partials_ext = "mustache", partials_dict = {}, padding = "", def_ldel = "{{", def_rdel = "}}", scopes = None, warn = False, keep = False):
|
11
|
+
"""
|
12
|
+
Render a mustache template.
|
13
|
+
|
14
|
+
Renders a mustache template with a data scope and partial capability.
|
15
|
+
Given the file structure...
|
16
|
+
╷
|
17
|
+
├─╼ main.py
|
18
|
+
├─╼ main.ms
|
19
|
+
└─┮ partials
|
20
|
+
└── part.ms
|
21
|
+
|
22
|
+
then main.py would make the following call:
|
23
|
+
|
24
|
+
render(open('main.ms', 'r'), {...}, 'partials', 'ms')
|
25
|
+
|
26
|
+
|
27
|
+
Arguments:
|
28
|
+
|
29
|
+
template -- A file-like object or a string containing the template
|
30
|
+
|
31
|
+
data -- A python dictionary with your data scope
|
32
|
+
|
33
|
+
partials_path -- The path to where your partials are stored
|
34
|
+
If set to None, then partials won't be loaded from the file system
|
35
|
+
(defaults to '.')
|
36
|
+
|
37
|
+
partials_ext -- The extension that you want the parser to look for
|
38
|
+
(defaults to 'mustache')
|
39
|
+
|
40
|
+
partials_dict -- A python dictionary which will be search for partials
|
41
|
+
before the filesystem is. {'include': 'foo'} is the same
|
42
|
+
as a file called include.mustache
|
43
|
+
(defaults to {})
|
44
|
+
|
45
|
+
padding -- This is for padding partials, and shouldn't be used
|
46
|
+
(but can be if you really want to)
|
47
|
+
|
48
|
+
def_ldel -- The default left delimiter
|
49
|
+
("{{" by default, as in spec compliant mustache)
|
50
|
+
|
51
|
+
def_rdel -- The default right delimiter
|
52
|
+
("}}" by default, as in spec compliant mustache)
|
53
|
+
|
54
|
+
scopes -- The list of scopes that get_key will look through
|
55
|
+
|
56
|
+
warn -- Issue a warning to stderr when a template substitution isn't found in the data
|
57
|
+
|
58
|
+
keep -- Keep unreplaced tags when a template substitution isn't found in the data
|
59
|
+
|
60
|
+
|
61
|
+
Returns:
|
62
|
+
|
63
|
+
A string containing the rendered template.
|
64
|
+
"""
|
65
|
+
...
|
66
|
+
|
67
|
+
version: str
|
68
|
+
|
69
|
+
def main(template, data = None, **kwargs):
|
70
|
+
...
|
71
|
+
|
72
|
+
def cli_main():
|
73
|
+
"""
|
74
|
+
Render mustache templates using json files
|
75
|
+
"""
|
76
|
+
...
|
77
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.11.4.1 #
|
4
|
+
# Generated on 2024-02-28T05:30:44.015425 #
|
5
|
+
##################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
|
10
|
+
version: str
|
11
|
+
|
@@ -0,0 +1,114 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.11.4.1 #
|
4
|
+
# Generated on 2024-02-28T05:30:44.015309 #
|
5
|
+
##################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
|
10
|
+
linesep: str
|
11
|
+
|
12
|
+
def tokenize(template, def_ldel = "{{", def_rdel = "}}"):
|
13
|
+
"""
|
14
|
+
Tokenize a mustache template
|
15
|
+
|
16
|
+
Tokenizes a mustache template in a generator fashion,
|
17
|
+
using file-like objects. It also accepts a string containing
|
18
|
+
the template.
|
19
|
+
|
20
|
+
|
21
|
+
Arguments:
|
22
|
+
|
23
|
+
template -- a file-like object, or a string of a mustache template
|
24
|
+
|
25
|
+
def_ldel -- The default left delimiter
|
26
|
+
("{{" by default, as in spec compliant mustache)
|
27
|
+
|
28
|
+
def_rdel -- The default right delimiter
|
29
|
+
("}}" by default, as in spec compliant mustache)
|
30
|
+
|
31
|
+
|
32
|
+
Returns:
|
33
|
+
|
34
|
+
A generator of mustache tags in the form of a tuple
|
35
|
+
|
36
|
+
-- (tag_type, tag_key)
|
37
|
+
|
38
|
+
Where tag_type is one of:
|
39
|
+
* literal
|
40
|
+
* section
|
41
|
+
* inverted section
|
42
|
+
* end
|
43
|
+
* partial
|
44
|
+
* no escape
|
45
|
+
|
46
|
+
And tag_key is either the key or in the case of a literal tag,
|
47
|
+
the literal itself.
|
48
|
+
"""
|
49
|
+
...
|
50
|
+
|
51
|
+
python3: bool
|
52
|
+
|
53
|
+
def unicode(x, y):
|
54
|
+
...
|
55
|
+
|
56
|
+
g_token_cache: dict
|
57
|
+
|
58
|
+
def render(template = "", data = {}, partials_path = ".", partials_ext = "mustache", partials_dict = {}, padding = "", def_ldel = "{{", def_rdel = "}}", scopes = None, warn = False, keep = False):
|
59
|
+
"""
|
60
|
+
Render a mustache template.
|
61
|
+
|
62
|
+
Renders a mustache template with a data scope and partial capability.
|
63
|
+
Given the file structure...
|
64
|
+
╷
|
65
|
+
├─╼ main.py
|
66
|
+
├─╼ main.ms
|
67
|
+
└─┮ partials
|
68
|
+
└── part.ms
|
69
|
+
|
70
|
+
then main.py would make the following call:
|
71
|
+
|
72
|
+
render(open('main.ms', 'r'), {...}, 'partials', 'ms')
|
73
|
+
|
74
|
+
|
75
|
+
Arguments:
|
76
|
+
|
77
|
+
template -- A file-like object or a string containing the template
|
78
|
+
|
79
|
+
data -- A python dictionary with your data scope
|
80
|
+
|
81
|
+
partials_path -- The path to where your partials are stored
|
82
|
+
If set to None, then partials won't be loaded from the file system
|
83
|
+
(defaults to '.')
|
84
|
+
|
85
|
+
partials_ext -- The extension that you want the parser to look for
|
86
|
+
(defaults to 'mustache')
|
87
|
+
|
88
|
+
partials_dict -- A python dictionary which will be search for partials
|
89
|
+
before the filesystem is. {'include': 'foo'} is the same
|
90
|
+
as a file called include.mustache
|
91
|
+
(defaults to {})
|
92
|
+
|
93
|
+
padding -- This is for padding partials, and shouldn't be used
|
94
|
+
(but can be if you really want to)
|
95
|
+
|
96
|
+
def_ldel -- The default left delimiter
|
97
|
+
("{{" by default, as in spec compliant mustache)
|
98
|
+
|
99
|
+
def_rdel -- The default right delimiter
|
100
|
+
("}}" by default, as in spec compliant mustache)
|
101
|
+
|
102
|
+
scopes -- The list of scopes that get_key will look through
|
103
|
+
|
104
|
+
warn -- Issue a warning to stderr when a template substitution isn't found in the data
|
105
|
+
|
106
|
+
keep -- Keep unreplaced tags when a template substitution isn't found in the data
|
107
|
+
|
108
|
+
|
109
|
+
Returns:
|
110
|
+
|
111
|
+
A string containing the rendered template.
|
112
|
+
"""
|
113
|
+
...
|
114
|
+
|
@@ -0,0 +1,75 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.11.4.1 #
|
4
|
+
# Generated on 2024-02-28T05:30:44.014781 #
|
5
|
+
##################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
|
10
|
+
class ChevronError(SyntaxError, metaclass=type):
|
11
|
+
...
|
12
|
+
|
13
|
+
def grab_literal(template, l_del):
|
14
|
+
"""
|
15
|
+
Parse a literal from the template
|
16
|
+
"""
|
17
|
+
...
|
18
|
+
|
19
|
+
def l_sa_check(template, literal, is_standalone):
|
20
|
+
"""
|
21
|
+
Do a preliminary check to see if a tag could be a standalone
|
22
|
+
"""
|
23
|
+
...
|
24
|
+
|
25
|
+
def r_sa_check(template, tag_type, is_standalone):
|
26
|
+
"""
|
27
|
+
Do a final checkto see if a tag could be a standalone
|
28
|
+
"""
|
29
|
+
...
|
30
|
+
|
31
|
+
def parse_tag(template, l_del, r_del):
|
32
|
+
"""
|
33
|
+
Parse a tag from a template
|
34
|
+
"""
|
35
|
+
...
|
36
|
+
|
37
|
+
def tokenize(template, def_ldel = "{{", def_rdel = "}}"):
|
38
|
+
"""
|
39
|
+
Tokenize a mustache template
|
40
|
+
|
41
|
+
Tokenizes a mustache template in a generator fashion,
|
42
|
+
using file-like objects. It also accepts a string containing
|
43
|
+
the template.
|
44
|
+
|
45
|
+
|
46
|
+
Arguments:
|
47
|
+
|
48
|
+
template -- a file-like object, or a string of a mustache template
|
49
|
+
|
50
|
+
def_ldel -- The default left delimiter
|
51
|
+
("{{" by default, as in spec compliant mustache)
|
52
|
+
|
53
|
+
def_rdel -- The default right delimiter
|
54
|
+
("}}" by default, as in spec compliant mustache)
|
55
|
+
|
56
|
+
|
57
|
+
Returns:
|
58
|
+
|
59
|
+
A generator of mustache tags in the form of a tuple
|
60
|
+
|
61
|
+
-- (tag_type, tag_key)
|
62
|
+
|
63
|
+
Where tag_type is one of:
|
64
|
+
* literal
|
65
|
+
* section
|
66
|
+
* inverted section
|
67
|
+
* end
|
68
|
+
* partial
|
69
|
+
* no escape
|
70
|
+
|
71
|
+
And tag_key is either the key or in the case of a literal tag,
|
72
|
+
the literal itself.
|
73
|
+
"""
|
74
|
+
...
|
75
|
+
|