Skip to content

Commit 83ad073

Browse files
Merge pull request #441 from melanger/patch-1
feat: allow loading of tuples from YAML configs
2 parents d5cac7f + 5debe48 commit 83ad073

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/satosa/yaml.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,21 @@ def _constructor_envfile_variables(loader, node):
4343
return new_value
4444

4545

46+
def _constructor_tuple_variables(loader, node):
47+
"""
48+
Extracts the tuple variable from the node's value.
49+
:param yaml.Loader loader: the yaml loader
50+
:param node: the current node in the yaml
51+
:return: value of the tuple
52+
"""
53+
return tuple(loader.construct_sequence(node))
54+
55+
4656
TAG_ENV = "!ENV"
4757
TAG_ENVFILE = "!ENVFILE"
58+
TAG_TUPLE = "tag:yaml.org,2002:python/tuple"
4859

4960

5061
_safe_loader.add_constructor(TAG_ENV, _constructor_env_variables)
5162
_safe_loader.add_constructor(TAG_ENVFILE, _constructor_envfile_variables)
63+
_safe_loader.add_constructor(TAG_TUPLE, _constructor_tuple_variables)

0 commit comments

Comments
 (0)