mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-16 01:40:12 +00:00
15 lines
400 B
Python
15 lines
400 B
Python
|
import yaml
|
||
|
|
||
|
# Announcements contain unicode, because they come from JSON. We tell PyYAML
|
||
|
# to give us unicode instead of str/bytes.
|
||
|
def construct_unicode(loader, node):
|
||
|
return node.value
|
||
|
yaml.SafeLoader.add_constructor("tag:yaml.org,2002:str",
|
||
|
construct_unicode)
|
||
|
|
||
|
def safe_load(f):
|
||
|
return yaml.safe_load(f)
|
||
|
|
||
|
def safe_dump(obj):
|
||
|
return yaml.safe_dump(obj)
|