From c0f02842ced2240ec35315b0b88c775ae5423be9 Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Sat, 18 Aug 2018 12:46:39 +0200 Subject: fix issue #219 breakage on single entry map as flow sequence element *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))* --- CHANGES | 5 +++++ README.rst | 11 +++++++++-- __init__.py | 4 ++-- _doc/_static/pypi.svg | 2 +- _test/test_issues.py | 12 +++++++++--- nodes.py | 3 ++- scanner.py | 3 ++- 7 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index 101b7ef..e6ef72a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +[0, 15, 60]: 2018-08-18 + - cleanup for mypy + - spurious print in library (reported by + `Lele Gaifax `__), now automatically checked + [0, 15, 59]: 2018-08-17 - issue with C based loader and leading zeros (reported by `Tom Hamilton Stubber `__) diff --git a/README.rst b/README.rst index 4a7cf00..5eed39e 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.59 -:updated: 2018-08-17 +:version: 0.15.60 +:updated: 2018-08-18 :documentation: http://yaml.readthedocs.io :repository: https://bitbucket.org/ruamel/ :pypi: https://pypi.org/project/ruamel.yaml/ @@ -54,6 +54,13 @@ ChangeLog .. should insert NEXT: at the beginning of line for next key (with empty line) +0.15.60 (2018-08-18): + - again allow single entry map in flow sequence context (reported by + `Lee Goolsbee `__) + - cleanup for mypy + - spurious print in library (reported by + `Lele Gaifax `__), now automatically checked + 0.15.59 (2018-08-17): - issue with C based loader and leading zeros (reported by `Tom Hamilton Stubber `__) diff --git a/__init__.py b/__init__.py index c513dec..71164d9 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, 59), - __version__='0.15.59', + version_info=(0, 15, 60), + __version__='0.15.60', 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 fbf4350..15dd630 100644 --- a/_doc/_static/pypi.svg +++ b/_doc/_static/pypi.svg @@ -1 +1 @@ - pypipypi0.15.590.15.59 + pypipypi0.15.600.15.60 diff --git a/_test/test_issues.py b/_test/test_issues.py index 0d1f0ca..ec793ea 100644 --- a/_test/test_issues.py +++ b/_test/test_issues.py @@ -233,13 +233,19 @@ class TestIssues: d.yaml_add_eol_comment('test1', 'bar') assert round_trip_dump(d) == yaml_str + 'bar: foo # test1\n' - @pytest.mark.xfail(strict=True) def test_issue_219(self): yaml_str = dedent("""\ [StackName: AWS::StackName] """) - d = round_trip_load(yaml_str) - + d = round_trip_load(yaml_str) # NOQA + + def test_issue_219a(self): + yaml_str = dedent("""\ + [StackName: + AWS::StackName] + """) + d = round_trip_load(yaml_str) # NOQA + def test_issue_220(self, tmpdir): program_src = r''' from ruamel.yaml import YAML diff --git a/nodes.py b/nodes.py index 0c39abd..0a35752 100644 --- a/nodes.py +++ b/nodes.py @@ -51,7 +51,8 @@ class Node(object): sys.stdout.write(' {}comment: {})\n'.format(' ' * indent, self.comment)) return sys.stdout.write( - '{}{}(tag={!r})\n'.format(' ' * indent, self.__class__.__name__, self.tag)) + '{}{}(tag={!r})\n'.format(' ' * indent, self.__class__.__name__, self.tag) + ) if self.comment: sys.stdout.write(' {}comment: {})\n'.format(' ' * indent, self.comment)) for v in self.value: diff --git a/scanner.py b/scanner.py index c989e6d..320dfe7 100644 --- a/scanner.py +++ b/scanner.py @@ -786,7 +786,8 @@ class Scanner(object): else: if bool(self.flow_level): if self.flow_context[-1] == '[': - return False + if self.reader.peek(1) not in _THE_END_SPACE_TAB: + return False # if self.reader.peek(1) in '\'"{[]}': return True # VALUE(block context): ':' (' '|'\n') -- cgit v1.2.1