diff options
author | Anthon van der Neut <anthon@mnt.org> | 2017-12-03 11:06:38 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2017-12-03 11:06:38 +0100 |
commit | 029e34d4f9054a53fb2cf914cec2fff7b217d761 (patch) | |
tree | ed220ff7b640ff5f83ab113e1c1c27af46c90764 | |
parent | a1ec92faa38de632fbfeb3d23275223d759c8c22 (diff) | |
download | ruamel.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.
-rw-r--r-- | CHANGES | 7 | ||||
-rw-r--r-- | README.rst | 11 | ||||
-rw-r--r-- | __init__.py | 4 | ||||
-rw-r--r-- | main.py | 5 |
4 files changed, 22 insertions, 5 deletions
@@ -1,3 +1,10 @@ +[0, 15, 35]: 2017-12-03 + - allow ``None`` as stream when specifying ``transform`` parameters to + ``YAML.dump()``. + This is useful if the transforming function doesn't return a meaningful value + (inspired by `StackOverflow <https://stackoverflow.com/q/47614862/1307905>`__ by + `rsaw <https://stackoverflow.com/users/406281/rsaw>`__). + [0, 15, 34]: 2017-09-17 - fix for issue 157: CDumper not dumping floats (reported by Jan Smitka) @@ -33,7 +33,14 @@ when the status of the API is stable enough to make the transition. ChangeLog ========= -.. should insert NEXT: at the beginning of line for next key +.. should insert NEXT: at the beginning of line for next key (with empty line) + +0.15.35 (2017-12-03): + - allow ``None`` as stream when specifying ``transform`` parameters to + ``YAML.dump()``. + This is useful if the transforming function doesn't return a meaningful value + (inspired by `StackOverflow <https://stackoverflow.com/q/47614862/1307905>`__ by + `rsaw <https://stackoverflow.com/users/406281/rsaw>`__). 0.15.34 (2017-09-17): - fix for issue 157: CDumper not dumping floats (reported by Jan Smitka) @@ -99,7 +106,7 @@ ChangeLog - fix for round_tripping singe excl. mark tags doubling (reported and fix by Jan Brezina) 0.15.21 (2017-07-25): - - fix for writing unicode in new API, (reported on + - fix for writing unicode in new API, (reported on `StackOverflow <https://stackoverflow.com/a/45281922/1307905>`__ 0.15.20 (2017-07-23): diff --git a/__init__.py b/__init__.py index 9da7f51..7b190f3 100644 --- a/__init__.py +++ b/__init__.py @@ -7,8 +7,8 @@ if False: # MYPY _package_data = dict( full_package_name='ruamel.yaml', - version_info=(0, 15, 34), - __version__='0.15.34', + version_info=(0, 15, 35), + __version__='0.15.35', author='Anthon van der Neut', author_email='a.van.der.neut@ruamel.eu', description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA @@ -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): |