diff options
-rw-r--r-- | CHANGES | 15 | ||||
-rw-r--r-- | README.rst | 9 | ||||
-rw-r--r-- | __init__.py | 4 | ||||
-rw-r--r-- | _doc/_static/pypi.svg | 2 | ||||
-rw-r--r-- | _test/test_z_data.py | 2 | ||||
-rw-r--r-- | anchor.py | 7 | ||||
-rw-r--r-- | comments.py | 2 | ||||
-rw-r--r-- | constructor.py | 4 | ||||
-rw-r--r-- | main.py | 12 |
9 files changed, 42 insertions, 15 deletions
@@ -1,3 +1,18 @@ +[0, 16, 7]: 2020-01-30 + - fix typchecking issue on TaggedScalar (reported by Jens Nielsen) + - fix error in dumping literal scalar in sequence with comments before element + (reported by `EJ Etherington <https://sourceforge.net/u/ejether/>`__) + +[0, 16, 7]: 2020-01-30 + - fix typchecking issue on TaggedScalar (reported by Jens Nielsen) + - fix error in dumping literal scalar in sequence with comments before element + (reported by `EJ Etherington <https://sourceforge.net/u/ejether/>`__) + +[0, 16, 7]: 2020-01-30 + - fix typchecking issue on TaggedScalar (reported by Jens Nielsen) + - fix error in dumping literal scalar in sequence with comments before element + (reported by `EJ Etherington <https://sourceforge.net/u/ejether/>`__) + [0, 16, 6]: 2020-01-20 - fix empty string mapping key roundtripping with preservation of quotes as `? ''` (reported via email by Tomer Aharoni). @@ -4,8 +4,8 @@ ruamel.yaml ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. -:version: 0.16.6 -:updated: 2020-01-20 +:version: 0.16.7 +:updated: 2020-01-30 :documentation: http://yaml.readthedocs.io :repository: https://bitbucket.org/ruamel/yaml :pypi: https://pypi.org/project/ruamel.yaml/ @@ -54,6 +54,11 @@ ChangeLog .. should insert NEXT: at the beginning of line for next key (with empty line) +0.16.7 (2020-01-30): + - fix typchecking issue on TaggedScalar (reported by Jens Nielsen) + - fix error in dumping literal scalar in sequence with comments before element + (reported by `EJ Etherington <https://sourceforge.net/u/ejether/>`__) + 0.16.6 (2020-01-20): - fix empty string mapping key roundtripping with preservation of quotes as `? ''` (reported via email by Tomer Aharoni). diff --git a/__init__.py b/__init__.py index 00a27a3..6a3af12 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, 16, 6), - __version__='0.16.6', + version_info=(0, 16, 7), + __version__='0.16.7', 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 2de7091..c4e7915 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.16.6</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.16.6</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.16.7</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.16.7</text></g> </svg> diff --git a/_test/test_z_data.py b/_test/test_z_data.py index fcd09be..a4eec0d 100644 --- a/_test/test_z_data.py +++ b/_test/test_z_data.py @@ -128,6 +128,8 @@ class TestYAMLData(object): value = buf.getvalue() if PY2: value = value.decode('utf-8') + print('value', value) + # print('expected', expected) assert value == expected def load_assert(self, input, confirm, yaml_version=None): @@ -1,4 +1,6 @@ +if False: # MYPY + from typing import Any, Dict, Optional, List, Union, Optional, Iterator # NOQA anchor_attrib = '_yaml_anchor' @@ -13,5 +15,6 @@ class Anchor(object): self.always_dump = False def __repr__(self): - ad = ", (always dump)" if self.always_dump else "" - return "Anchor({!r}{})".format(self.value, ad) + # type: () -> Any + ad = ', (always dump)' if self.always_dump else "" + return 'Anchor({!r}{})'.format(self.value, ad) diff --git a/comments.py b/comments.py index 237ffd3..1cfd662 100644 --- a/comments.py +++ b/comments.py @@ -1116,7 +1116,7 @@ class CommentedSet(MutableSet, CommentedBase): # type: ignore # NOQA class TaggedScalar(CommentedBase): # the value and style attributes are set during roundtrip construction def __init__(self, value=None, style=None, tag=None): - # type: () -> None + # type: (Any, Any, Any) -> None self.value = value self.style = style if tag is not None: diff --git a/constructor.py b/constructor.py index 2280d4f..ddd2915 100644 --- a/constructor.py +++ b/constructor.py @@ -1311,9 +1311,10 @@ class RoundTripConstructor(SafeConstructor): if not templated_id(node.anchor): seqtyp.yaml_set_anchor(node.anchor) for idx, child in enumerate(node.value): - ret_val.append(self.construct_object(child, deep=deep)) if child.comment: seqtyp._yaml_add_comment(child.comment, key=idx) + child.comment = None # if moved to sequence remove from child + ret_val.append(self.construct_object(child, deep=deep)) seqtyp._yaml_set_idx_line_col( idx, [child.start_mark.line, child.start_mark.column] ) @@ -1467,7 +1468,6 @@ class RoundTripConstructor(SafeConstructor): ) value = self.construct_object(value_node, deep=deep) if self.check_mapping_key(node, key_node, maptyp, key, value): - if key_node.comment and len(key_node.comment) > 4 and key_node.comment[4]: if last_value is None: key_node.comment[0] = key_node.comment.pop(4) @@ -92,6 +92,8 @@ class YAML(object): self.Resolver = ruamel.yaml.resolver.VersionedResolver # type: Any self.allow_unicode = True self.Reader = None # type: Any + self.Representer = None # type: Any + self.Constructor = None # type: Any self.Scanner = None # type: Any self.Serializer = None # type: Any self.default_flow_style = None # type: Any @@ -127,14 +129,14 @@ class YAML(object): if setup_rt: self.default_flow_style = False # no optimized rt-dumper yet - self.Emitter = ruamel.yaml.emitter.Emitter # type: Any + self.Emitter = ruamel.yaml.emitter.Emitter self.Serializer = ruamel.yaml.serializer.Serializer - self.Representer = ruamel.yaml.representer.RoundTripRepresenter # type: Any + self.Representer = ruamel.yaml.representer.RoundTripRepresenter self.Scanner = ruamel.yaml.scanner.RoundTripScanner # no optimized rt-parser yet - self.Parser = ruamel.yaml.parser.RoundTripParser # type: Any - self.Composer = ruamel.yaml.composer.Composer # type: Any - self.Constructor = ruamel.yaml.constructor.RoundTripConstructor # type: Any + self.Parser = ruamel.yaml.parser.RoundTripParser + self.Composer = ruamel.yaml.composer.Composer + self.Constructor = ruamel.yaml.constructor.RoundTripConstructor del setup_rt self.stream = None self.canonical = None |