outerbounds 0.3.71__py3-none-any.whl → 0.3.75__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 (51) hide show
  1. outerbounds/_vendor/PyYAML.LICENSE +20 -0
  2. outerbounds/_vendor/__init__.py +0 -0
  3. outerbounds/_vendor/_yaml/__init__.py +34 -0
  4. outerbounds/_vendor/click/__init__.py +73 -0
  5. outerbounds/_vendor/click/_compat.py +626 -0
  6. outerbounds/_vendor/click/_termui_impl.py +717 -0
  7. outerbounds/_vendor/click/_textwrap.py +49 -0
  8. outerbounds/_vendor/click/_winconsole.py +279 -0
  9. outerbounds/_vendor/click/core.py +2998 -0
  10. outerbounds/_vendor/click/decorators.py +497 -0
  11. outerbounds/_vendor/click/exceptions.py +287 -0
  12. outerbounds/_vendor/click/formatting.py +301 -0
  13. outerbounds/_vendor/click/globals.py +68 -0
  14. outerbounds/_vendor/click/parser.py +529 -0
  15. outerbounds/_vendor/click/py.typed +0 -0
  16. outerbounds/_vendor/click/shell_completion.py +580 -0
  17. outerbounds/_vendor/click/termui.py +787 -0
  18. outerbounds/_vendor/click/testing.py +479 -0
  19. outerbounds/_vendor/click/types.py +1073 -0
  20. outerbounds/_vendor/click/utils.py +580 -0
  21. outerbounds/_vendor/click.LICENSE +28 -0
  22. outerbounds/_vendor/vendor_any.txt +2 -0
  23. outerbounds/_vendor/yaml/__init__.py +471 -0
  24. outerbounds/_vendor/yaml/composer.py +146 -0
  25. outerbounds/_vendor/yaml/constructor.py +862 -0
  26. outerbounds/_vendor/yaml/cyaml.py +177 -0
  27. outerbounds/_vendor/yaml/dumper.py +138 -0
  28. outerbounds/_vendor/yaml/emitter.py +1239 -0
  29. outerbounds/_vendor/yaml/error.py +94 -0
  30. outerbounds/_vendor/yaml/events.py +104 -0
  31. outerbounds/_vendor/yaml/loader.py +62 -0
  32. outerbounds/_vendor/yaml/nodes.py +51 -0
  33. outerbounds/_vendor/yaml/parser.py +629 -0
  34. outerbounds/_vendor/yaml/reader.py +208 -0
  35. outerbounds/_vendor/yaml/representer.py +378 -0
  36. outerbounds/_vendor/yaml/resolver.py +245 -0
  37. outerbounds/_vendor/yaml/scanner.py +1555 -0
  38. outerbounds/_vendor/yaml/serializer.py +127 -0
  39. outerbounds/_vendor/yaml/tokens.py +129 -0
  40. outerbounds/command_groups/cli.py +1 -1
  41. outerbounds/command_groups/local_setup_cli.py +1 -2
  42. outerbounds/command_groups/perimeters_cli.py +1 -2
  43. outerbounds/command_groups/workstations_cli.py +2 -2
  44. outerbounds/utils/kubeconfig.py +2 -2
  45. outerbounds/utils/metaflowconfig.py +1 -1
  46. outerbounds/vendor.py +159 -0
  47. {outerbounds-0.3.71.dist-info → outerbounds-0.3.75.dist-info}/METADATA +1 -3
  48. outerbounds-0.3.75.dist-info/RECORD +55 -0
  49. outerbounds-0.3.71.dist-info/RECORD +0 -15
  50. {outerbounds-0.3.71.dist-info → outerbounds-0.3.75.dist-info}/WHEEL +0 -0
  51. {outerbounds-0.3.71.dist-info → outerbounds-0.3.75.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,245 @@
1
+ __all__ = ["BaseResolver", "Resolver"]
2
+
3
+ from .error import *
4
+ from .nodes import *
5
+
6
+ import re
7
+
8
+
9
+ class ResolverError(YAMLError):
10
+ pass
11
+
12
+
13
+ class BaseResolver:
14
+
15
+ DEFAULT_SCALAR_TAG = "tag:yaml.org,2002:str"
16
+ DEFAULT_SEQUENCE_TAG = "tag:yaml.org,2002:seq"
17
+ DEFAULT_MAPPING_TAG = "tag:yaml.org,2002:map"
18
+
19
+ yaml_implicit_resolvers = {}
20
+ yaml_path_resolvers = {}
21
+
22
+ def __init__(self):
23
+ self.resolver_exact_paths = []
24
+ self.resolver_prefix_paths = []
25
+
26
+ @classmethod
27
+ def add_implicit_resolver(cls, tag, regexp, first):
28
+ if not "yaml_implicit_resolvers" in cls.__dict__:
29
+ implicit_resolvers = {}
30
+ for key in cls.yaml_implicit_resolvers:
31
+ implicit_resolvers[key] = cls.yaml_implicit_resolvers[key][:]
32
+ cls.yaml_implicit_resolvers = implicit_resolvers
33
+ if first is None:
34
+ first = [None]
35
+ for ch in first:
36
+ cls.yaml_implicit_resolvers.setdefault(ch, []).append((tag, regexp))
37
+
38
+ @classmethod
39
+ def add_path_resolver(cls, tag, path, kind=None):
40
+ # Note: `add_path_resolver` is experimental. The API could be changed.
41
+ # `new_path` is a pattern that is matched against the path from the
42
+ # root to the node that is being considered. `node_path` elements are
43
+ # tuples `(node_check, index_check)`. `node_check` is a node class:
44
+ # `ScalarNode`, `SequenceNode`, `MappingNode` or `None`. `None`
45
+ # matches any kind of a node. `index_check` could be `None`, a boolean
46
+ # value, a string value, or a number. `None` and `False` match against
47
+ # any _value_ of sequence and mapping nodes. `True` matches against
48
+ # any _key_ of a mapping node. A string `index_check` matches against
49
+ # a mapping value that corresponds to a scalar key which content is
50
+ # equal to the `index_check` value. An integer `index_check` matches
51
+ # against a sequence value with the index equal to `index_check`.
52
+ if not "yaml_path_resolvers" in cls.__dict__:
53
+ cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy()
54
+ new_path = []
55
+ for element in path:
56
+ if isinstance(element, (list, tuple)):
57
+ if len(element) == 2:
58
+ node_check, index_check = element
59
+ elif len(element) == 1:
60
+ node_check = element[0]
61
+ index_check = True
62
+ else:
63
+ raise ResolverError("Invalid path element: %s" % element)
64
+ else:
65
+ node_check = None
66
+ index_check = element
67
+ if node_check is str:
68
+ node_check = ScalarNode
69
+ elif node_check is list:
70
+ node_check = SequenceNode
71
+ elif node_check is dict:
72
+ node_check = MappingNode
73
+ elif (
74
+ node_check not in [ScalarNode, SequenceNode, MappingNode]
75
+ and not isinstance(node_check, str)
76
+ and node_check is not None
77
+ ):
78
+ raise ResolverError("Invalid node checker: %s" % node_check)
79
+ if not isinstance(index_check, (str, int)) and index_check is not None:
80
+ raise ResolverError("Invalid index checker: %s" % index_check)
81
+ new_path.append((node_check, index_check))
82
+ if kind is str:
83
+ kind = ScalarNode
84
+ elif kind is list:
85
+ kind = SequenceNode
86
+ elif kind is dict:
87
+ kind = MappingNode
88
+ elif kind not in [ScalarNode, SequenceNode, MappingNode] and kind is not None:
89
+ raise ResolverError("Invalid node kind: %s" % kind)
90
+ cls.yaml_path_resolvers[tuple(new_path), kind] = tag
91
+
92
+ def descend_resolver(self, current_node, current_index):
93
+ if not self.yaml_path_resolvers:
94
+ return
95
+ exact_paths = {}
96
+ prefix_paths = []
97
+ if current_node:
98
+ depth = len(self.resolver_prefix_paths)
99
+ for path, kind in self.resolver_prefix_paths[-1]:
100
+ if self.check_resolver_prefix(
101
+ depth, path, kind, current_node, current_index
102
+ ):
103
+ if len(path) > depth:
104
+ prefix_paths.append((path, kind))
105
+ else:
106
+ exact_paths[kind] = self.yaml_path_resolvers[path, kind]
107
+ else:
108
+ for path, kind in self.yaml_path_resolvers:
109
+ if not path:
110
+ exact_paths[kind] = self.yaml_path_resolvers[path, kind]
111
+ else:
112
+ prefix_paths.append((path, kind))
113
+ self.resolver_exact_paths.append(exact_paths)
114
+ self.resolver_prefix_paths.append(prefix_paths)
115
+
116
+ def ascend_resolver(self):
117
+ if not self.yaml_path_resolvers:
118
+ return
119
+ self.resolver_exact_paths.pop()
120
+ self.resolver_prefix_paths.pop()
121
+
122
+ def check_resolver_prefix(self, depth, path, kind, current_node, current_index):
123
+ node_check, index_check = path[depth - 1]
124
+ if isinstance(node_check, str):
125
+ if current_node.tag != node_check:
126
+ return
127
+ elif node_check is not None:
128
+ if not isinstance(current_node, node_check):
129
+ return
130
+ if index_check is True and current_index is not None:
131
+ return
132
+ if (index_check is False or index_check is None) and current_index is None:
133
+ return
134
+ if isinstance(index_check, str):
135
+ if not (
136
+ isinstance(current_index, ScalarNode)
137
+ and index_check == current_index.value
138
+ ):
139
+ return
140
+ elif isinstance(index_check, int) and not isinstance(index_check, bool):
141
+ if index_check != current_index:
142
+ return
143
+ return True
144
+
145
+ def resolve(self, kind, value, implicit):
146
+ if kind is ScalarNode and implicit[0]:
147
+ if value == "":
148
+ resolvers = self.yaml_implicit_resolvers.get("", [])
149
+ else:
150
+ resolvers = self.yaml_implicit_resolvers.get(value[0], [])
151
+ wildcard_resolvers = self.yaml_implicit_resolvers.get(None, [])
152
+ for tag, regexp in resolvers + wildcard_resolvers:
153
+ if regexp.match(value):
154
+ return tag
155
+ implicit = implicit[1]
156
+ if self.yaml_path_resolvers:
157
+ exact_paths = self.resolver_exact_paths[-1]
158
+ if kind in exact_paths:
159
+ return exact_paths[kind]
160
+ if None in exact_paths:
161
+ return exact_paths[None]
162
+ if kind is ScalarNode:
163
+ return self.DEFAULT_SCALAR_TAG
164
+ elif kind is SequenceNode:
165
+ return self.DEFAULT_SEQUENCE_TAG
166
+ elif kind is MappingNode:
167
+ return self.DEFAULT_MAPPING_TAG
168
+
169
+
170
+ class Resolver(BaseResolver):
171
+ pass
172
+
173
+
174
+ Resolver.add_implicit_resolver(
175
+ "tag:yaml.org,2002:bool",
176
+ re.compile(
177
+ r"""^(?:yes|Yes|YES|no|No|NO
178
+ |true|True|TRUE|false|False|FALSE
179
+ |on|On|ON|off|Off|OFF)$""",
180
+ re.X,
181
+ ),
182
+ list("yYnNtTfFoO"),
183
+ )
184
+
185
+ Resolver.add_implicit_resolver(
186
+ "tag:yaml.org,2002:float",
187
+ re.compile(
188
+ r"""^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)?
189
+ |\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?
190
+ |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*
191
+ |[-+]?\.(?:inf|Inf|INF)
192
+ |\.(?:nan|NaN|NAN))$""",
193
+ re.X,
194
+ ),
195
+ list("-+0123456789."),
196
+ )
197
+
198
+ Resolver.add_implicit_resolver(
199
+ "tag:yaml.org,2002:int",
200
+ re.compile(
201
+ r"""^(?:[-+]?0b[0-1_]+
202
+ |[-+]?0[0-7_]+
203
+ |[-+]?(?:0|[1-9][0-9_]*)
204
+ |[-+]?0x[0-9a-fA-F_]+
205
+ |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$""",
206
+ re.X,
207
+ ),
208
+ list("-+0123456789"),
209
+ )
210
+
211
+ Resolver.add_implicit_resolver(
212
+ "tag:yaml.org,2002:merge", re.compile(r"^(?:<<)$"), ["<"]
213
+ )
214
+
215
+ Resolver.add_implicit_resolver(
216
+ "tag:yaml.org,2002:null",
217
+ re.compile(
218
+ r"""^(?: ~
219
+ |null|Null|NULL
220
+ | )$""",
221
+ re.X,
222
+ ),
223
+ ["~", "n", "N", ""],
224
+ )
225
+
226
+ Resolver.add_implicit_resolver(
227
+ "tag:yaml.org,2002:timestamp",
228
+ re.compile(
229
+ r"""^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]
230
+ |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?
231
+ (?:[Tt]|[ \t]+)[0-9][0-9]?
232
+ :[0-9][0-9] :[0-9][0-9] (?:\.[0-9]*)?
233
+ (?:[ \t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$""",
234
+ re.X,
235
+ ),
236
+ list("0123456789"),
237
+ )
238
+
239
+ Resolver.add_implicit_resolver("tag:yaml.org,2002:value", re.compile(r"^(?:=)$"), ["="])
240
+
241
+ # The following resolver is only for documentation purposes. It cannot work
242
+ # because plain scalars cannot start with '!', '&', or '*'.
243
+ Resolver.add_implicit_resolver(
244
+ "tag:yaml.org,2002:yaml", re.compile(r"^(?:!|&|\*)$"), list("!&*")
245
+ )