1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00
Files
vcrpy/vcr/serializers/yamlserializer.py
Kevin McCarthy e50f917cf4 Make Serializers Dumber
Let's have the serializer just worry about serializing the dict
that we hand it, and move the unicode stuff up to a serialize module.

This should hopefully let us move toward using a version string in
cassettes.
2014-05-10 11:52:35 -10:00

15 lines
342 B
Python

import yaml
# Use the libYAML versions if possible
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
def deserialize(cassette_string):
return yaml.load(cassette_string, Loader=Loader)
def serialize(cassette_dict):
return yaml.dump(cassette_dict, Dumper=Dumper)