-
Notifications
You must be signed in to change notification settings - Fork 22
/
myyaml.py
34 lines (29 loc) · 884 Bytes
/
myyaml.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Yaml wrappers.
@note: Not yet working.
"""
import yaml
import sys
try:
sys.stderr.write("Sweet, we can use the libyaml C implementation.\n")
from yaml import CLoader as Loader
from yaml import CDumper as Dumper
except ImportError:
sys.stderr.write("WARNING: Could not load libyaml C implementation.\n")
from yaml import Loader, Dumper
def dump(var):
return yaml.dump(var, Dumper=Dumper)
def load(stream):
return yaml.load(stream, Loader=Loader)
#def load(*args, **kwargs):
# return yaml.load(args, kwargs, Loader=Loader)
def load_all(stream):
return yaml.load_all(stream, Loader=Loader)
#def load_all(*args, **kwargs):
# return yaml.load(args, kwargs, Loader=Loader)
#
#def dump(*args, **kwargs):
# return yaml.dump(args, kwargs, Dumper=Dumper)
#
#def dump_all(*args, **kwargs):
# return yaml.dump_all(args, kwargs, Dumper=Dumper)