summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-02-27 22:57:46 +0100
committerAnthon van der Neut <anthon@mnt.org>2019-02-27 22:57:46 +0100
commitc716679edf348ba59d7551600c9cf139e23961ef (patch)
tree853ee5edd3b44aa67e182bb36b983dbb4ecf8f45
parent17af0e7a084955b5c0bf4124bba87190ac16734d (diff)
downloadruamel.yaml-c716679edf348ba59d7551600c9cf139e23961ef.tar.gz
fix issue #279 block sequence elements with flow mapping collapsed0.15.89
*When this change indeed resolves your problem, please **Close** this issue*. *(You can do so using the WorkFlow pull-down (close to the top right of this page))*
-rw-r--r--CHANGES6
-rw-r--r--README.rst8
-rw-r--r--__init__.py4
-rw-r--r--_doc/_static/pypi.svg2
-rw-r--r--_test/test_issues.py23
-rw-r--r--emitter.py4
-rw-r--r--setup.py6
7 files changed, 42 insertions, 11 deletions
diff --git a/CHANGES b/CHANGES
index 272d72e..3d283ef 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+[0, 15, 89]: 2019-02-27
+ - fix for items with flow-mapping in block sequence output on single line
+ (reported by `Zahari Dim <https://bitbucket.org/zahari_dim/>`__)
+ - fix for safe dumping erroring in creation of representereror when dumping namedtuple
+ (reported and solution by `Jaakko Kantojärvi <https://bitbucket.org/raphendyr/>`__)
+
[0, 15, 88]: 2019-02-12
- fix inclusing of python code from the subpackage data (containing extra tests,
reported by `Florian Apolloner <https://bitbucket.org/apollo13/>`__)
diff --git a/README.rst b/README.rst
index 6a8cf16..4b43bc5 100644
--- a/README.rst
+++ b/README.rst
@@ -4,8 +4,8 @@ ruamel.yaml
``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python.
-:version: 0.15.88
-:updated: 2019-02-12
+:version: 0.15.89
+:updated: 2019-02-27
:documentation: http://yaml.readthedocs.io
:repository: https://bitbucket.org/ruamel/
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -54,7 +54,9 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key (with empty line)
-NEXT:
+0.15.89 (2019-02-27):
+ - fix for items with flow-mapping in block sequence output on single line
+ (reported by `Zahari Dim <https://bitbucket.org/zahari_dim/>`__)
- fix for safe dumping erroring in creation of representereror when dumping namedtuple
(reported and solution by `Jaakko Kantojärvi <https://bitbucket.org/raphendyr/>`__)
diff --git a/__init__.py b/__init__.py
index b94b3ff..c10c606 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, 88),
- __version__='0.15.88',
+ version_info=(0, 15, 89),
+ __version__='0.15.89',
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
diff --git a/_doc/_static/pypi.svg b/_doc/_static/pypi.svg
index 59e461f..c18afa1 100644
--- a/_doc/_static/pypi.svg
+++ b/_doc/_static/pypi.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h33v20H0z"/><path fill="#007ec6" d="M33 0h53v20H33z"/><path fill="url(#b)" d="M0 0h86v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">pypi</text><text x="175" y="140" transform="scale(.1)" textLength="230">pypi</text><text x="585" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">0.15.88</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.88</text></g> </svg>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h33v20H0z"/><path fill="#007ec6" d="M33 0h53v20H33z"/><path fill="url(#b)" d="M0 0h86v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">pypi</text><text x="175" y="140" transform="scale(.1)" textLength="230">pypi</text><text x="585" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">0.15.89</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.89</text></g> </svg>
diff --git a/_test/test_issues.py b/_test/test_issues.py
index d5913f6..4780da5 100644
--- a/_test/test_issues.py
+++ b/_test/test_issues.py
@@ -560,6 +560,26 @@ class TestIssues:
"""
d = round_trip(inp) # NOQA
+ # @pytest.mark.xfail(strict=True, reason='bla bla', raises=AssertionError)
+ def test_issue_279(self):
+ from ruamel.yaml import YAML
+ from ruamel.yaml.compat import StringIO
+
+ yaml = YAML()
+ yaml.indent(sequence=4, offset=2)
+ inp = dedent("""\
+ experiments:
+ - datasets:
+ # ATLAS EWK
+ - {dataset: ATLASWZRAP36PB, frac: 1.0}
+ - {dataset: ATLASZHIGHMASS49FB, frac: 1.0}
+ """)
+ a = yaml.load(inp)
+ buf = StringIO()
+ yaml.dump(a, buf)
+ print(buf.getvalue())
+ assert buf.getvalue() == inp
+
def test_issue_280(self):
from ruamel.yaml import YAML
from ruamel.yaml.representer import RepresenterError
@@ -576,6 +596,3 @@ class TestIssues:
# inp = """
# """
# d = round_trip(inp) # NOQA
-
-
-
diff --git a/emitter.py b/emitter.py
index 690cbc5..d4884bd 100644
--- a/emitter.py
+++ b/emitter.py
@@ -546,6 +546,8 @@ class Emitter(object):
if self.event.comment and self.event.comment[0]:
# eol comment on empty mapping
self.write_post_comment(self.event)
+ elif self.flow_level == 0:
+ self.write_line_break()
self.state = self.states.pop()
else:
if self.canonical or self.column > self.best_width:
@@ -574,6 +576,8 @@ class Emitter(object):
if self.event.comment and self.event.comment[0]:
# eol comment on flow mapping, never reached on empty mappings
self.write_post_comment(self.event)
+ else:
+ self.no_newline = False
self.state = self.states.pop()
else:
self.write_indicator(u',', False)
diff --git a/setup.py b/setup.py
index 5b60dd1..9b15f4e 100644
--- a/setup.py
+++ b/setup.py
@@ -434,7 +434,7 @@ class NameSpacePackager(object):
while fpn:
self._split.insert(0, '.'.join(fpn))
fpn = fpn[:-1]
- for d in os.listdir('.'):
+ for d in sorted(os.listdir('.')):
if not os.path.isdir(d) or d == self._split[0] or d[0] in '._':
continue
# prevent sub-packages in namespace from being included
@@ -450,7 +450,9 @@ class NameSpacePackager(object):
(y.encode('utf-8') if isinstance(y, unicode) else y) for y in self._split
]
if skip:
- print('skipping sub-packages:', ', '.join(skip))
+ # this interferes with output checking
+ # print('skipping sub-packages:', ', '.join(skip))
+ pass
return self._split
@property