Exemplo n.º 1
0
 def to_yaml(self, stream=None):
     d = self.to_dict()
     out = yaml_safe_dump(d)
     if stream is None:
         return out
     try:
         stream.write(bytes(out, encoding="utf-8"))
     except TypeError:
         stream.write(out)
Exemplo n.º 2
0
 def to_yaml(self, stream=None):
     d = self.to_dict()
     out = compat.u(yaml_safe_dump(d))
     if stream is None:
         return out
     stream.write(compat.b(out, encoding="utf-8"))