Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VERIFY
CIF
Commits
84f0d787
Commit
84f0d787
authored
Aug 25, 2021
by
Jean Matthieu Haussaire
Browse files
Add some yml functionality implemented in the master branch
parent
ec2fd106
Changes
1
Hide whitespace changes
Inline
Side-by-side
pycif/utils/yml.py
View file @
84f0d787
...
...
@@ -15,4 +15,16 @@ def ordered_load(stream, Loader=yaml.SafeLoader, object_pairs_hook=OrderedDict):
OrderedLoader
.
add_constructor
(
yaml
.
resolver
.
BaseResolver
.
DEFAULT_MAPPING_TAG
,
construct_mapping
)
# define custom tag handler
def
join
(
loader
,
node
):
seq
=
loader
.
construct_sequence
(
node
)
return
''
.
join
([
str
(
i
)
for
i
in
seq
])
# end function join
# register the tag handler
OrderedLoader
.
add_constructor
(
'!join'
,
join
)
return
yaml
.
load
(
stream
,
OrderedLoader
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment