diff options
author | Anthon van der Neut <anthon@mnt.org> | 2019-01-22 22:24:56 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2019-01-22 22:24:56 +0100 |
commit | 51d26b878717cf00bee0b961f39e0f14a7e9cdab (patch) | |
tree | 7e1b0f4eed20f76c0a95fb7e9ddf096ef25f8cde | |
parent | 5028398ac1150a43f4c6eae39b8260ea9cc22a19 (diff) | |
download | ruamel.yaml-51d26b878717cf00bee0b961f39e0f14a7e9cdab.tar.gz |
fix indexing error on empty list for merge-key position0.15.87
-rw-r--r-- | CHANGES | 8 | ||||
-rw-r--r-- | README.rst | 8 | ||||
-rw-r--r-- | __init__.py | 4 | ||||
-rw-r--r-- | _doc/_static/pypi.svg | 2 | ||||
-rw-r--r-- | main.py | 2 | ||||
-rw-r--r-- | representer.py | 5 |
6 files changed, 22 insertions, 7 deletions
@@ -1,3 +1,11 @@ +[0, 15, 87]: 2019-01-22 + - fix problem with empty lists and the code to reinsert merge keys (reported via email + by Zaloo) + +[0, 15, 87]: 2019-01-22 + - fix problem with empty lists and the code to reinsert merge keys (reported via email + by Zaloo) + [0, 15, 86]: 2019-01-16 - reinsert merge key in its old position (reported by grumbler on <Stackoverflow <https://stackoverflow.com/a/54206512/1307905>`__) @@ -4,8 +4,8 @@ ruamel.yaml ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. -:version: 0.15.86 -:updated: 2019-01-16 +:version: 0.15.87 +:updated: 2019-01-22 :documentation: http://yaml.readthedocs.io :repository: https://bitbucket.org/ruamel/ :pypi: https://pypi.org/project/ruamel.yaml/ @@ -54,6 +54,10 @@ ChangeLog .. should insert NEXT: at the beginning of line for next key (with empty line) +0.15.87 (2019-01-22): + - fix problem with empty lists and the code to reinsert merge keys (reported via email + by Zaloo) + 0.15.86 (2019-01-16): - reinsert merge key in its old position (reported by grumbler on <Stackoverflow <https://stackoverflow.com/a/54206512/1307905>`__) diff --git a/__init__.py b/__init__.py index 1cb3f30..f03f94d 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, 86), - __version__='0.15.86', + version_info=(0, 15, 87), + __version__='0.15.87', 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 23fc356..a142d11 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.86</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.86</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.87</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.87</text></g> </svg> @@ -324,7 +324,7 @@ class YAML(object): """ if not hasattr(stream, 'read') and hasattr(stream, 'open'): # pathlib.Path() instance - with stream.open('r') as fp: # type: ignore + with stream.open('rb') as fp: # type: ignore return self.load(fp) constructor, parser = self.get_constructor_parser(stream) try: diff --git a/representer.py b/representer.py index 7b2f007..859887c 100644 --- a/representer.py +++ b/representer.py @@ -1002,7 +1002,10 @@ class RoundTripRepresenter(SafeRepresenter): except AttributeError: item_comments = {} merge_list = [m[1] for m in getattr(mapping, merge_attrib, [])] - merge_pos = getattr(mapping, merge_attrib, [[0]])[0][0] + try: + merge_pos = getattr(mapping, merge_attrib, [[0]])[0][0] + except IndexError: + merge_pos = 0 item_count = 0 if bool(merge_list): items = mapping.non_merged_items() |