diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-07-24 19:19:22 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-07-24 19:19:22 +0300 |
commit | 7b9b4fc72b6d18cca36f9243172b55e288ba013b (patch) | |
tree | 050a4b5f7bf3add6ab37ac1be15d1a8d83f862c0 /ick2 | |
parent | 99317344eef0e3abbbca6794339b5d4d396ac177 (diff) | |
download | ick2-7b9b4fc72b6d18cca36f9243172b55e288ba013b.tar.gz |
Change: use the libyaml bindings for yaml loading, dumping
For speed.
Diffstat (limited to 'ick2')
-rw-r--r-- | ick2/persistent.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ick2/persistent.py b/ick2/persistent.py index 52c5aa0..c5e2840 100644 --- a/ick2/persistent.py +++ b/ick2/persistent.py @@ -97,7 +97,7 @@ class FilePersistentState(PersistentStateInterface): if not os.path.exists(filename): raise ick2.NotFound(kind=kind, rid=rid) with open(filename, 'r') as f: - as_dict = yaml.safe_load(f) + as_dict = yaml.load(f, Loader=yaml.CSafeLoader) return resource_from_dict(as_dict) def write_resource(self, kind, rid, resource): @@ -107,7 +107,8 @@ class FilePersistentState(PersistentStateInterface): filename = self._filename(kind, rid) with open(filename, 'w') as f: - yaml.safe_dump(resource.as_dict(), stream=f) + yaml.dump( + resource.as_dict(), stream=f, Dumper=yaml.CSafeDumper) def remove_resource(self, kind, rid): filename = self._filename(kind, rid) |