summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-12-03 11:06:38 +0100
committerAnthon van der Neut <anthon@mnt.org>2017-12-03 11:06:38 +0100
commit029e34d4f9054a53fb2cf914cec2fff7b217d761 (patch)
treeed220ff7b640ff5f83ab113e1c1c27af46c90764 /main.py
parenta1ec92faa38de632fbfeb3d23275223d759c8c22 (diff)
downloadruamel.yaml-029e34d4f9054a53fb2cf914cec2fff7b217d761.tar.gz
allow None stream if transforming0.15.35
If YAML.dump() is passed a transform function, specifying None will ignore the return value of that function.
Diffstat (limited to 'main.py')
-rw-r--r--main.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.py b/main.py
index 1b5c2d0..e933210 100644
--- a/main.py
+++ b/main.py
@@ -399,7 +399,10 @@ class YAML(object):
val = stream.getvalue() # type: ignore
if self.encoding:
val = val.decode(self.encoding)
- fstream.write(transform(val))
+ if fstream is None:
+ transform(val)
+ else:
+ fstream.write(transform(val))
return None
def get_serializer_representer_emitter(self, stream, tlca):