Hello community,
here is the log from the commit of package python-ruamel.yaml for openSUSE:Factory checked in at 2018-12-03 10:09:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ruamel.yaml (Old)
and /work/SRC/openSUSE:Factory/.python-ruamel.yaml.new.19453 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ruamel.yaml"
Mon Dec 3 10:09:46 2018 rev:10 rq:653087 version:0.15.78
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-ruamel.yaml/python-ruamel.yaml.changes 2018-10-02 19:48:58.161734608 +0200
+++ /work/SRC/openSUSE:Factory/.python-ruamel.yaml.new.19453/python-ruamel.yaml.changes 2018-12-03 10:09:51.675738327 +0100
@@ -1,0 +2,15 @@
+Fri Nov 30 07:43:33 UTC 2018 - Adrian Schröter
+
+- update to 0.15.78
+ * setup issue for 3.8 (reported by Sidney Kuyateh)
+ * setting yaml.sort_base_mapping_type_on_output = False, will prevent explicit sorting by keys in the base representer of mappings. Roundtrip already did not do this. Usage only makes real sense for Python 3.6+ (feature request by Sebastian Gerber).
+ * implement Python version check in YAML metadata in _test/test_z_data.py
+ * fix issue with empty mapping and sequence loaded as flow-style (mapping reported by Min RK, sequence by Maged Ahmed)
+ * fix issue with single '?' scalar (reported by Terrance)
+ * fix issue with duplicate merge keys (prompted by answering a StackOverflow question by math)
+ * fix dropping of comment on rt before sequence item that is sequence item (reported by Thorsten Kampe)
+ * fix irregular output on pre-comment in sequence within sequence (reported by Thorsten Kampe)
+ * allow non-compact (i.e. next line) dumping sequence/mapping within sequence.
+ * fix regression on explicit 1.1 loading with the C based scanner/parser (reported by Tomas Vavra)
+
+-------------------------------------------------------------------
Old:
----
ruamel.yaml-0.15.71.tar.gz
New:
----
ruamel.yaml-0.15.78.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-ruamel.yaml.spec ++++++
--- /var/tmp/diff_new_pack.d6xGVq/_old 2018-12-03 10:09:52.191737850 +0100
+++ /var/tmp/diff_new_pack.d6xGVq/_new 2018-12-03 10:09:52.191737850 +0100
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-ruamel.yaml
-Version: 0.15.71
+Version: 0.15.78
Release: 0
Summary: Python YAML parser
License: MIT
++++++ ruamel.yaml-0.15.71.tar.gz -> ruamel.yaml-0.15.78.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/CHANGES new/ruamel.yaml-0.15.78/CHANGES
--- old/ruamel.yaml-0.15.71/CHANGES 2018-09-26 22:55:47.000000000 +0200
+++ new/ruamel.yaml-0.15.78/CHANGES 2018-11-15 17:41:48.000000000 +0100
@@ -1,3 +1,52 @@
+[0, 15, 78]: 2018-11-15
+ - fix setup issue for 3.8 (reported by `Sidney Kuyateh
+ https://bitbucket.org/autinerd/`__)
+
+[0, 15, 77]: 2018-11-09
+ - setting `yaml.sort_base_mapping_type_on_output = False`, will prevent
+ explicit sorting by keys in the base representer of mappings. Roundtrip
+ already did not do this. Usage only makes real sense for Python 3.6+
+ (feature request by `Sebastian Gerber https://bitbucket.org/spacemanspiff2007/`__).
+ - implement Python version check in YAML metadata in ``_test/test_z_data.py``
+
+[0, 15, 76]: 2018-11-01
+ - fix issue with empty mapping and sequence loaded as flow-style
+ (mapping reported by `Min RK https://bitbucket.org/minrk/`__, sequence
+ by `Maged Ahmed https://bitbucket.org/maged2/`__)
+
+[0, 15, 75]: 2018-10-27
+ - fix issue with single '?' scalar (reported by `Terrance
+ https://bitbucket.org/OllieTerrance/`__)
+ - fix issue with duplicate merge keys (prompted by `answering
+ https://stackoverflow.com/a/52852106/1307905`__ a
+ `StackOverflow question https://stackoverflow.com/q/52851168/1307905`__
+ by `math https://stackoverflow.com/users/1355634/math`__)
+
+[0, 15, 75]: 2018-10-27
+ - fix issue with single '?' scalar (reported by `Terrance
+ https://bitbucket.org/OllieTerrance/`__)
+ - fix issue with duplicate merge keys (prompted by `answering
+ https://stackoverflow.com/a/52852106/1307905`__ a
+ `StackOverflow question https://stackoverflow.com/q/52851168/1307905`__
+ by `math https://stackoverflow.com/users/1355634/math`__)
+
+[0, 15, 74]: 2018-10-17
+ - fix dropping of comment on rt before sequence item that is sequence item
+ (reported by `Thorsten Kampe https://bitbucket.org/thorstenkampe/`__)
+
+[0, 15, 73]: 2018-10-16
+ - fix irregular output on pre-comment in sequence within sequence (reported
+ by `Thorsten Kampe https://bitbucket.org/thorstenkampe/`__)
+ - allow non-compact (i.e. next line) dumping sequence/mapping within sequence.
+
+[0, 15, 72]: 2018-10-06
+ - fix regression on explicit 1.1 loading with the C based scanner/parser
+ (reported by `Tomas Vavra https://bitbucket.org/xtomik/`__)
+
+[0, 15, 72]: 2018-10-06
+ - fix regression on explicit 1.1 loading with the C based scanner/parser
+ (reported by `Tomas Vavra https://bitbucket.org/xtomik/`__)
+
[0, 15, 71]: 2018-09-26
- fix regression where handcrafted CommentedMaps could not be initiated (reported by
`Dan Helfman https://bitbucket.org/dhelfman/`__)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/PKG-INFO new/ruamel.yaml-0.15.78/PKG-INFO
--- old/ruamel.yaml-0.15.71/PKG-INFO 2018-09-26 23:05:18.000000000 +0200
+++ new/ruamel.yaml-0.15.78/PKG-INFO 2018-11-15 17:57:44.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ruamel.yaml
-Version: 0.15.71
+Version: 0.15.78
Summary: ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order
Home-page: https://bitbucket.org/ruamel/yaml
Author: Anthon van der Neut
@@ -12,8 +12,8 @@
``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python.
- :version: 0.15.71
- :updated: 2018-09-26
+ :version: 0.15.78
+ :updated: 2018-11-15
:documentation: http://yaml.readthedocs.io
:repository: https://bitbucket.org/ruamel/
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -27,7 +27,7 @@
but new functionality is likely only to be available via the new API.
If your package uses ``ruamel.yaml`` and is not listed on PyPI, drop
- me an email, preferably with some infomormation on how you use the
+ me an email, preferably with some information on how you use the
package (or a link to bitbucket/github) and I'll keep you informed
when the status of the API is stable enough to make the transition.
@@ -62,6 +62,43 @@
.. should insert NEXT: at the beginning of line for next key (with empty line)
+ 0.15.78 (2018-11-15):
+ - fix setup issue for 3.8 (reported by `Sidney Kuyateh
+ https://bitbucket.org/autinerd/`__)
+
+ 0.15.77 (2018-11-09):
+ - setting `yaml.sort_base_mapping_type_on_output = False`, will prevent
+ explicit sorting by keys in the base representer of mappings. Roundtrip
+ already did not do this. Usage only makes real sense for Python 3.6+
+ (feature request by `Sebastian Gerber https://bitbucket.org/spacemanspiff2007/`__).
+ - implement Python version check in YAML metadata in ``_test/test_z_data.py``
+
+ 0.15.76 (2018-11-01):
+ - fix issue with empty mapping and sequence loaded as flow-style
+ (mapping reported by `Min RK https://bitbucket.org/minrk/`__, sequence
+ by `Maged Ahmed https://bitbucket.org/maged2/`__)
+
+ 0.15.75 (2018-10-27):
+ - fix issue with single '?' scalar (reported by `Terrance
+ https://bitbucket.org/OllieTerrance/`__)
+ - fix issue with duplicate merge keys (prompted by `answering
+ https://stackoverflow.com/a/52852106/1307905`__ a
+ `StackOverflow question https://stackoverflow.com/q/52851168/1307905`__
+ by `math https://stackoverflow.com/users/1355634/math`__)
+
+ 0.15.74 (2018-10-17):
+ - fix dropping of comment on rt before sequence item that is sequence item
+ (reported by `Thorsten Kampe https://bitbucket.org/thorstenkampe/`__)
+
+ 0.15.73 (2018-10-16):
+ - fix irregular output on pre-comment in sequence within sequence (reported
+ by `Thorsten Kampe https://bitbucket.org/thorstenkampe/`__)
+ - allow non-compact (i.e. next line) dumping sequence/mapping within sequence.
+
+ 0.15.72 (2018-10-06):
+ - fix regression on explicit 1.1 loading with the C based scanner/parser
+ (reported by `Tomas Vavra https://bitbucket.org/xtomik/`__)
+
0.15.71 (2018-09-26):
- some of the tests now live in YAML files in the
`yaml.data https://bitbucket.org/ruamel/yaml.data`__ repository.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/README.rst new/ruamel.yaml-0.15.78/README.rst
--- old/ruamel.yaml-0.15.71/README.rst 2018-09-26 23:04:41.000000000 +0200
+++ new/ruamel.yaml-0.15.78/README.rst 2018-11-15 17:41:48.000000000 +0100
@@ -4,8 +4,8 @@
``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python.
-:version: 0.15.71
-:updated: 2018-09-26
+:version: 0.15.78
+:updated: 2018-11-15
:documentation: http://yaml.readthedocs.io
:repository: https://bitbucket.org/ruamel/
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -19,7 +19,7 @@
but new functionality is likely only to be available via the new API.
If your package uses ``ruamel.yaml`` and is not listed on PyPI, drop
-me an email, preferably with some infomormation on how you use the
+me an email, preferably with some information on how you use the
package (or a link to bitbucket/github) and I'll keep you informed
when the status of the API is stable enough to make the transition.
@@ -54,6 +54,43 @@
.. should insert NEXT: at the beginning of line for next key (with empty line)
+0.15.78 (2018-11-15):
+ - fix setup issue for 3.8 (reported by `Sidney Kuyateh
+ https://bitbucket.org/autinerd/`__)
+
+0.15.77 (2018-11-09):
+ - setting `yaml.sort_base_mapping_type_on_output = False`, will prevent
+ explicit sorting by keys in the base representer of mappings. Roundtrip
+ already did not do this. Usage only makes real sense for Python 3.6+
+ (feature request by `Sebastian Gerber https://bitbucket.org/spacemanspiff2007/`__).
+ - implement Python version check in YAML metadata in ``_test/test_z_data.py``
+
+0.15.76 (2018-11-01):
+ - fix issue with empty mapping and sequence loaded as flow-style
+ (mapping reported by `Min RK https://bitbucket.org/minrk/`__, sequence
+ by `Maged Ahmed https://bitbucket.org/maged2/`__)
+
+0.15.75 (2018-10-27):
+ - fix issue with single '?' scalar (reported by `Terrance
+ https://bitbucket.org/OllieTerrance/`__)
+ - fix issue with duplicate merge keys (prompted by `answering
+ https://stackoverflow.com/a/52852106/1307905`__ a
+ `StackOverflow question https://stackoverflow.com/q/52851168/1307905`__
+ by `math https://stackoverflow.com/users/1355634/math`__)
+
+0.15.74 (2018-10-17):
+ - fix dropping of comment on rt before sequence item that is sequence item
+ (reported by `Thorsten Kampe https://bitbucket.org/thorstenkampe/`__)
+
+0.15.73 (2018-10-16):
+ - fix irregular output on pre-comment in sequence within sequence (reported
+ by `Thorsten Kampe https://bitbucket.org/thorstenkampe/`__)
+ - allow non-compact (i.e. next line) dumping sequence/mapping within sequence.
+
+0.15.72 (2018-10-06):
+ - fix regression on explicit 1.1 loading with the C based scanner/parser
+ (reported by `Tomas Vavra https://bitbucket.org/xtomik/`__)
+
0.15.71 (2018-09-26):
- some of the tests now live in YAML files in the
`yaml.data https://bitbucket.org/ruamel/yaml.data`__ repository.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/__init__.py new/ruamel.yaml-0.15.78/__init__.py
--- old/ruamel.yaml-0.15.71/__init__.py 2018-09-26 22:55:47.000000000 +0200
+++ new/ruamel.yaml-0.15.78/__init__.py 2018-11-15 17:41:48.000000000 +0100
@@ -7,8 +7,8 @@
_package_data = dict(
full_package_name='ruamel.yaml',
- version_info=(0, 15, 71),
- __version__='0.15.71',
+ version_info=(0, 15, 78),
+ __version__='0.15.78',
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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/anchor.py new/ruamel.yaml-0.15.78/anchor.py
--- old/ruamel.yaml-0.15.71/anchor.py 1970-01-01 01:00:00.000000000 +0100
+++ new/ruamel.yaml-0.15.78/anchor.py 2018-11-15 15:46:06.000000000 +0100
@@ -0,0 +1,13 @@
+
+
+anchor_attrib = '_yaml_anchor'
+
+
+class Anchor(object):
+ __slots__ = 'value', 'always_dump'
+ attrib = anchor_attrib
+
+ def __init__(self):
+ # type: () -> None
+ self.value = None
+ self.always_dump = False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/comments.py new/ruamel.yaml-0.15.78/comments.py
--- old/ruamel.yaml-0.15.71/comments.py 2018-09-26 08:56:18.000000000 +0200
+++ new/ruamel.yaml-0.15.78/comments.py 2018-11-15 15:46:06.000000000 +0100
@@ -14,6 +14,7 @@
from ruamel.yaml.compat import ordereddict, PY2, string_types, MutableSliceableSequence
from ruamel.yaml.scalarstring import ScalarString
+from ruamel.yaml.anchor import Anchor
if PY2:
from collections import MutableSet, Sized, Set, MutableMapping, Mapping
@@ -24,15 +25,14 @@
from typing import Any, Dict, Optional, List, Union, Optional, Iterator # NOQA
# fmt: off
-__all__ = ["CommentedSeq", "CommentedKeySeq",
- "CommentedMap", "CommentedOrderedMap",
- "CommentedSet", 'comment_attrib', 'merge_attrib']
+__all__ = ['CommentedSeq', 'CommentedKeySeq',
+ 'CommentedMap', 'CommentedOrderedMap',
+ 'CommentedSet', 'comment_attrib', 'merge_attrib']
# fmt: on
comment_attrib = '_yaml_comment'
format_attrib = '_yaml_format'
line_col_attrib = '_yaml_line_col'
-anchor_attrib = '_yaml_anchor'
merge_attrib = '_yaml_merge'
tag_attrib = '_yaml_tag'
@@ -163,16 +163,6 @@
self.data[key] = data
-class Anchor(object):
- __slots__ = 'value', 'always_dump'
- attrib = anchor_attrib
-
- def __init__(self):
- # type: () -> None
- self.value = None
- self.always_dump = False
-
-
class Tag(object):
"""store tag information for roundtripping"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/compat.py new/ruamel.yaml-0.15.78/compat.py
--- old/ruamel.yaml-0.15.71/compat.py 2018-09-21 20:01:48.000000000 +0200
+++ new/ruamel.yaml-0.15.78/compat.py 2018-11-15 15:46:06.000000000 +0100
@@ -186,18 +186,22 @@
class Nprint(object):
- def __init__(self):
- # type: () -> None
+ def __init__(self, file_name=None):
+ # type: (Any) -> None
self._max_print = None # type: Any
self._count = None # type: Any
+ self._file_name = file_name
def __call__(self, *args, **kw):
# type: (Any, Any) -> None
if not bool(_debug):
return
+ out = sys.stdout if self._file_name is None else open(self._file_name, 'a')
dbgprint = print # to fool checking for print statements by dv utility
- dbgprint(*args, **kw)
- sys.stdout.flush()
+ kw1 = kw.copy()
+ kw1['file'] = out
+ dbgprint(*args, **kw1)
+ out.flush()
if self._max_print is not None:
if self._count is None:
self._count = self._max_print
@@ -205,8 +209,10 @@
if self._count == 0:
dbgprint('forced exit\n')
traceback.print_stack()
- sys.stdout.flush()
+ out.flush()
sys.exit(0)
+ if self._file_name:
+ out.close()
def set_max_print(self, i):
# type: (int) -> None
@@ -215,7 +221,7 @@
nprint = Nprint()
-
+nprintf = Nprint('/var/tmp/ruamel.yaml.log')
# char checkers following production rules
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/composer.py new/ruamel.yaml-0.15.78/composer.py
--- old/ruamel.yaml-0.15.71/composer.py 2018-09-21 11:00:21.000000000 +0200
+++ new/ruamel.yaml-0.15.78/composer.py 2018-11-15 15:46:06.000000000 +0100
@@ -5,7 +5,7 @@
import warnings
from ruamel.yaml.error import MarkedYAMLError, ReusedAnchorWarning
-from ruamel.yaml.compat import utf8, nprint
+from ruamel.yaml.compat import utf8, nprint, nprintf # NOQA
from ruamel.yaml.events import (
StreamStartEvent,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/constructor.py new/ruamel.yaml-0.15.78/constructor.py
--- old/ruamel.yaml-0.15.71/constructor.py 2018-09-26 22:43:46.000000000 +0200
+++ new/ruamel.yaml-0.15.78/constructor.py 2018-11-15 15:46:06.000000000 +0100
@@ -16,8 +16,8 @@
from ruamel.yaml.nodes import * # NOQA
from ruamel.yaml.nodes import (SequenceNode, MappingNode, ScalarNode)
from ruamel.yaml.compat import (utf8, builtins_module, to_str, PY2, PY3, # NOQA
- ordereddict, text_type, nprint, version_tnf, Hashable,
- MutableSequence, MutableMapping)
+ ordereddict, text_type, nprint, nprintf, version_tnf,
+ Hashable, MutableSequence, MutableMapping)
from ruamel.yaml.comments import * # NOQA
from ruamel.yaml.comments import (CommentedMap, CommentedOrderedMap, CommentedSet,
CommentedKeySeq, CommentedSeq, TaggedScalar,
@@ -353,6 +353,25 @@
while index < len(node.value):
key_node, value_node = node.value[index]
if key_node.tag == u'tag:yaml.org,2002:merge':
+ if merge: # double << key
+ args = [
+ 'while constructing a mapping',
+ node.start_mark,
+ 'found duplicate key "{}"'.format(key_node.value),
+ key_node.start_mark,
+ """
+ To suppress this check see:
+ http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys
+ """,
+ """\
+ Duplicate keys will become an error in future releases, and are errors
+ by default when using the new API.
+ """,
+ ]
+ if self.allow_duplicate_keys is None:
+ warnings.warn(DuplicateKeyFutureWarning(*args))
+ else:
+ raise DuplicateKeyError(*args)
del node.value[index]
if isinstance(value_node, MappingNode):
self.flatten_mapping(value_node)
@@ -820,7 +839,7 @@
__import__(module_name)
# object_name = '.'.join(object_name)
break
- except ImportError as exc:
+ except ImportError:
continue
else:
module_name = builtins_module
@@ -1270,11 +1289,30 @@
return value
# merge = []
- merge_map_list = []
+ merge_map_list = [] # type: List[Any]
index = 0
while index < len(node.value):
key_node, value_node = node.value[index]
if key_node.tag == u'tag:yaml.org,2002:merge':
+ if merge_map_list: # double << key
+ args = [
+ 'while constructing a mapping',
+ node.start_mark,
+ 'found duplicate key "{}"'.format(key_node.value),
+ key_node.start_mark,
+ """
+ To suppress this check see:
+ http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys
+ """,
+ """\
+ Duplicate keys will become an error in future releases, and are errors
+ by default when using the new API.
+ """,
+ ]
+ if self.allow_duplicate_keys is None:
+ warnings.warn(DuplicateKeyFutureWarning(*args))
+ else:
+ raise DuplicateKeyError(*args)
del node.value[index]
if isinstance(value_node, MappingNode):
merge_map_list.append((index, constructed(value_node)))
@@ -1456,25 +1494,28 @@
# type: (Any) -> Any
data = CommentedSeq()
data._yaml_set_line_col(node.start_mark.line, node.start_mark.column)
- if node.flow_style is True:
- data.fa.set_flow_style()
- elif node.flow_style is False:
- data.fa.set_block_style()
if node.comment:
data._yaml_add_comment(node.comment)
yield data
data.extend(self.construct_rt_sequence(node, data))
+ self.set_collection_style(data, node)
def construct_yaml_map(self, node):
# type: (Any) -> Any
data = CommentedMap()
data._yaml_set_line_col(node.start_mark.line, node.start_mark.column)
+ yield data
+ self.construct_mapping(node, data)
+ self.set_collection_style(data, node)
+
+ def set_collection_style(self, data, node):
+ # type: (Any, Any) -> None
+ if len(data) == 0:
+ return
if node.flow_style is True:
data.fa.set_flow_style()
elif node.flow_style is False:
data.fa.set_block_style()
- yield data
- self.construct_mapping(node, data)
def construct_yaml_object(self, node, cls):
# type: (Any, Any) -> Any
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/emitter.py new/ruamel.yaml-0.15.78/emitter.py
--- old/ruamel.yaml-0.15.71/emitter.py 2018-09-26 22:01:33.000000000 +0200
+++ new/ruamel.yaml-0.15.78/emitter.py 2018-11-15 15:46:06.000000000 +0100
@@ -156,6 +156,9 @@
self.column = 0
self.whitespace = True
self.indention = True
+ self.compact_seq_seq = True # dash after dash
+ self.compact_seq_map = True # key after dash
+ # self.compact_ms = False # dash after key, only when excplicit key with ?
self.no_newline = None # type: Optional[bool] # set if directly after `- `
# Whether the document requires an explicit document indicator
@@ -404,14 +407,17 @@
if isinstance(self.event, ScalarEvent):
self.expect_scalar()
elif isinstance(self.event, SequenceStartEvent):
+ # nprintf('@', self.indention, self.no_newline, self.column)
+ i2, n2 = self.indention, self.no_newline # NOQA
if self.event.comment:
if self.event.flow_style is False and self.event.comment:
if self.write_post_comment(self.event):
self.indention = False
self.no_newline = True
if self.write_pre_comment(self.event):
- self.indention = False
- self.no_newline = True
+ pass
+ self.indention = i2
+ self.no_newline = not self.indention
if (
self.flow_level
or self.canonical
@@ -593,7 +599,12 @@
def expect_block_sequence(self):
# type: () -> None
- indentless = self.mapping_context and not self.indention
+ if self.mapping_context:
+ indentless = not self.indention
+ else:
+ indentless = False
+ if not self.compact_seq_seq and self.column != 0:
+ self.write_line_break()
self.increase_indent(flow=False, sequence=True, indentless=indentless)
self.state = self.expect_first_block_sequence_item
@@ -626,6 +637,8 @@
def expect_block_mapping(self):
# type: () -> None
+ if not self.mapping_context and not (self.compact_seq_map or self.column == 0):
+ self.write_line_break()
self.increase_indent(flow=False, sequence=False)
self.state = self.expect_first_block_mapping_key
@@ -1011,6 +1024,8 @@
if ch in u'?:': # ToDo
if self.serializer.use_version == (1, 1):
flow_indicators = True
+ elif len(scalar) == 1: # single character
+ flow_indicators = True
if followed_by_whitespace:
block_indicators = True
if ch == u'-' and followed_by_whitespace:
@@ -1574,11 +1589,11 @@
breaks = ch in u'\n\x85\u2028\u2029'
end += 1
- def write_comment(self, comment):
- # type: (Any) -> None
+ def write_comment(self, comment, pre=False):
+ # type: (Any, bool) -> None
value = comment.value
- # nprint('{:02d} {:02d} {!r}'.format(self.column, comment.start_mark.column, value))
- if value[-1] == '\n':
+ # nprintf('{:02d} {:02d} {!r}'.format(self.column, comment.start_mark.column, value))
+ if not pre and value[-1] == '\n':
value = value[:-1]
try:
# get original column position
@@ -1607,7 +1622,8 @@
self.stream.write(value)
except TypeError:
raise
- self.write_line_break()
+ if not pre:
+ self.write_line_break()
def write_pre_comment(self, event):
# type: (Any) -> bool
@@ -1621,7 +1637,7 @@
continue
if self.column != 0:
self.write_line_break()
- self.write_comment(comment)
+ self.write_comment(comment, pre=True)
if isinstance(event, start_events):
comment.pre_done = True
except TypeError:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/main.py new/ruamel.yaml-0.15.78/main.py
--- old/ruamel.yaml-0.15.71/main.py 2018-09-21 11:00:21.000000000 +0200
+++ new/ruamel.yaml-0.15.78/main.py 2018-11-15 15:46:06.000000000 +0100
@@ -146,6 +146,9 @@
self.map_indent = None
self.sequence_indent = None
self.sequence_dash_offset = 0
+ self.compact_seq_seq = None
+ self.compact_seq_map = None
+ self.sort_base_mapping_type_on_output = None # default: sort
self.top_level_colon_align = None
self.prefix_colon = None
@@ -252,6 +255,10 @@
if self.sequence_dash_offset is not None:
_emitter.sequence_dash_offset = self.sequence_dash_offset
# _emitter.block_seq_indent = self.sequence_dash_offset
+ if self.compact_seq_seq is not None:
+ _emitter.compact_seq_seq = self.compact_seq_seq
+ if self.compact_seq_map is not None:
+ _emitter.compact_seq_map = self.compact_seq_map
else:
if getattr(self, '_stream', None) is None:
# wait for the stream
@@ -283,15 +290,14 @@
# type: () -> Any
attr = '_' + sys._getframe().f_code.co_name
if not hasattr(self, attr):
- setattr(
- self,
- attr,
- self.Representer(
- default_style=self.default_style,
- default_flow_style=self.default_flow_style,
- dumper=self,
- ),
+ repres = self.Representer(
+ default_style=self.default_style,
+ default_flow_style=self.default_flow_style,
+ dumper=self,
)
+ if self.sort_base_mapping_type_on_output is not None:
+ repres.sort_base_mapping_type_on_output = self.sort_base_mapping_type_on_output
+ setattr(self, attr, repres)
return getattr(self, attr)
# separate output resolver?
@@ -394,17 +400,17 @@
# if you just initialise the CParser, to much of resolver.py
# is actually used
rslvr = self.Resolver
- if rslvr is ruamel.yaml.resolver.VersionedResolver:
- rslvr = ruamel.yaml.resolver.Resolver
+ # if rslvr is ruamel.yaml.resolver.VersionedResolver:
+ # rslvr = ruamel.yaml.resolver.Resolver
class XLoader(self.Parser, self.Constructor, rslvr): # type: ignore
- def __init__(selfx, stream, version=None, preserve_quotes=None):
+ def __init__(selfx, stream, version=self.version, preserve_quotes=None):
# type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None # NOQA
CParser.__init__(selfx, stream)
selfx._parser = selfx._composer = selfx
self.Constructor.__init__(selfx, loader=selfx)
selfx.allow_duplicate_keys = self.allow_duplicate_keys
- rslvr.__init__(selfx, loadumper=selfx)
+ rslvr.__init__(selfx, version=version, loadumper=selfx)
self._stream = stream
loader = XLoader(stream)
@@ -709,6 +715,11 @@
# type: (Any) -> None
self.sequence_dash_offset = val
+ def compact(self, seq_seq=None, seq_map=None):
+ # type: (Any, Any) -> None
+ self.compact_seq_seq = seq_seq
+ self.compact_seq_map = seq_map
+
class YAMLContextManager(object):
def __init__(self, yaml, transform=None):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/nodes.py new/ruamel.yaml-0.15.78/nodes.py
--- old/ruamel.yaml-0.15.71/nodes.py 2018-09-21 11:00:21.000000000 +0200
+++ new/ruamel.yaml-0.15.78/nodes.py 2018-11-15 15:46:06.000000000 +0100
@@ -12,14 +12,14 @@
class Node(object):
__slots__ = 'tag', 'value', 'start_mark', 'end_mark', 'comment', 'anchor'
- def __init__(self, tag, value, start_mark, end_mark, comment=None):
- # type: (Any, Any, Any, Any, Any) -> None
+ def __init__(self, tag, value, start_mark, end_mark, comment=None, anchor=None):
+ # type: (Any, Any, Any, Any, Any, Any) -> None
self.tag = tag
self.value = value
self.start_mark = start_mark
self.end_mark = end_mark
self.comment = comment
- self.anchor = None
+ self.anchor = anchor
def __repr__(self):
# type: () -> str
@@ -78,14 +78,15 @@
__slots__ = ('style',)
id = 'scalar'
- def __init__(self, tag, value, start_mark=None, end_mark=None, style=None, comment=None):
- # type: (Any, Any, Any, Any, Any, Any) -> None
- Node.__init__(self, tag, value, start_mark, end_mark, comment=comment)
+ def __init__(self, tag, value, start_mark=None, end_mark=None, style=None, comment=None,
+ anchor=None):
+ # type: (Any, Any, Any, Any, Any, Any, Any) -> None
+ Node.__init__(self, tag, value, start_mark, end_mark, comment=comment, anchor=anchor)
self.style = style
class CollectionNode(Node):
- __slots__ = 'flow_style', 'anchor'
+ __slots__ = ('flow_style', )
def __init__(
self,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/parser.py new/ruamel.yaml-0.15.78/parser.py
--- old/ruamel.yaml-0.15.71/parser.py 2018-09-21 11:00:21.000000000 +0200
+++ new/ruamel.yaml-0.15.78/parser.py 2018-11-15 15:46:06.000000000 +0100
@@ -80,7 +80,7 @@
from ruamel.yaml.tokens import * # NOQA
from ruamel.yaml.events import * # NOQA
from ruamel.yaml.scanner import Scanner, RoundTripScanner, ScannerError # NOQA
-from ruamel.yaml.compat import utf8, nprint # NOQA
+from ruamel.yaml.compat import utf8, nprint, nprintf # NOQA
if False: # MYPY
from typing import Any, Dict, Optional, List # NOQA
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/representer.py new/ruamel.yaml-0.15.78/representer.py
--- old/ruamel.yaml-0.15.71/representer.py 2018-09-26 22:25:27.000000000 +0200
+++ new/ruamel.yaml-0.15.78/representer.py 2018-11-15 15:46:06.000000000 +0100
@@ -6,6 +6,7 @@
from ruamel.yaml.error import * # NOQA
from ruamel.yaml.nodes import * # NOQA
from ruamel.yaml.compat import text_type, binary_type, to_unicode, PY2, PY3, ordereddict
+from ruamel.yaml.compat import nprint, nprintf # NOQA
from ruamel.yaml.scalarstring import (
LiteralScalarString,
FoldedScalarString,
@@ -64,6 +65,7 @@
self.represented_objects = {} # type: Dict[Any, Any]
self.object_keeper = [] # type: List[Any]
self.alias_key = None # type: Optional[int]
+ self.sort_base_mapping_type_on_output = True
@property
def serializer(self):
@@ -208,10 +210,11 @@
best_style = True
if hasattr(mapping, 'items'):
mapping = list(mapping.items())
- try:
- mapping = sorted(mapping)
- except TypeError:
- pass
+ if self.sort_base_mapping_type_on_output:
+ try:
+ mapping = sorted(mapping)
+ except TypeError:
+ pass
for item_key, item_value in mapping:
node_key = self.represent_key(item_key)
node_value = self.represent_data(item_value)
@@ -889,17 +892,33 @@
item_comments = {}
for idx, item in enumerate(sequence):
node_item = self.represent_data(item)
- node_item.comment = item_comments.get(idx)
+ self.merge_comments(node_item, item_comments.get(idx))
if not (isinstance(node_item, ScalarNode) and not node_item.style):
best_style = False
value.append(node_item)
if flow_style is None:
- if self.default_flow_style is not None:
+ if len(sequence) != 0 and self.default_flow_style is not None:
node.flow_style = self.default_flow_style
else:
node.flow_style = best_style
return node
+ def merge_comments(self, node, comments):
+ # type: (Any, Any) -> Any
+ if comments is None:
+ assert hasattr(node, 'comment')
+ return node
+ if getattr(node, 'comment', None) is not None:
+ for idx, val in enumerate(comments):
+ if idx >= len(node.comment):
+ continue
+ nc = node.comment[idx]
+ if nc is not None:
+ assert val is None or val == nc
+ comments[idx] = nc
+ node.comment = comments
+ return node
+
def represent_key(self, data):
# type: (Any) -> Any
if isinstance(data, CommentedKeySeq):
@@ -944,11 +963,13 @@
except AttributeError:
item_comments = {}
merge_list = [m[1] for m in getattr(mapping, merge_attrib, [])]
+ item_count = 0
if bool(merge_list):
items = mapping.non_merged_items()
else:
items = mapping.items()
for item_key, item_value in items:
+ item_count += 1
node_key = self.represent_key(item_key)
node_value = self.represent_data(item_value)
item_comment = item_comments.get(item_key)
@@ -967,7 +988,7 @@
best_style = False
value.append((node_key, node_value))
if flow_style is None:
- if self.default_flow_style is not None:
+ if ((item_count != 0) or bool(merge_list)) and self.default_flow_style is not None:
node.flow_style = self.default_flow_style
else:
node.flow_style = best_style
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/resolver.py new/ruamel.yaml-0.15.78/resolver.py
--- old/ruamel.yaml-0.15.71/resolver.py 2018-09-21 11:00:21.000000000 +0200
+++ new/ruamel.yaml-0.15.78/resolver.py 2018-11-15 15:46:06.000000000 +0100
@@ -316,8 +316,10 @@
and Yes/No/On/Off booleans.
"""
- def __init__(self, version=None, loader=None):
- # type: (Optional[VersionType], Any) -> None
+ def __init__(self, version=None, loader=None, loadumper=None):
+ # type: (Optional[VersionType], Any, Any) -> None
+ if loader is None and loadumper is not None:
+ loader = loadumper
BaseResolver.__init__(self, loader)
self._loader_version = self.get_loader_version(version)
self._version_implicit_resolver = {} # type: Dict[Any, Any]
@@ -383,10 +385,13 @@
try:
version = self.parser.yaml_version
except AttributeError:
- if hasattr(self.loadumper, 'typ'):
- version = self.loadumper.version
- else:
- version = self.loadumper._serializer.use_version # dumping
+ try:
+ if hasattr(self.loadumper, 'typ'):
+ version = self.loadumper.version
+ else:
+ version = self.loadumper._serializer.use_version # dumping
+ except AttributeError:
+ version = None
if version is None:
version = self._loader_version
if version is None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/ruamel.yaml.egg-info/PKG-INFO new/ruamel.yaml-0.15.78/ruamel.yaml.egg-info/PKG-INFO
--- old/ruamel.yaml-0.15.71/ruamel.yaml.egg-info/PKG-INFO 2018-09-26 23:05:18.000000000 +0200
+++ new/ruamel.yaml-0.15.78/ruamel.yaml.egg-info/PKG-INFO 2018-11-15 17:57:41.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ruamel.yaml
-Version: 0.15.71
+Version: 0.15.78
Summary: ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order
Home-page: https://bitbucket.org/ruamel/yaml
Author: Anthon van der Neut
@@ -12,8 +12,8 @@
``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python.
- :version: 0.15.71
- :updated: 2018-09-26
+ :version: 0.15.78
+ :updated: 2018-11-15
:documentation: http://yaml.readthedocs.io
:repository: https://bitbucket.org/ruamel/
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -27,7 +27,7 @@
but new functionality is likely only to be available via the new API.
If your package uses ``ruamel.yaml`` and is not listed on PyPI, drop
- me an email, preferably with some infomormation on how you use the
+ me an email, preferably with some information on how you use the
package (or a link to bitbucket/github) and I'll keep you informed
when the status of the API is stable enough to make the transition.
@@ -62,6 +62,43 @@
.. should insert NEXT: at the beginning of line for next key (with empty line)
+ 0.15.78 (2018-11-15):
+ - fix setup issue for 3.8 (reported by `Sidney Kuyateh
+ https://bitbucket.org/autinerd/`__)
+
+ 0.15.77 (2018-11-09):
+ - setting `yaml.sort_base_mapping_type_on_output = False`, will prevent
+ explicit sorting by keys in the base representer of mappings. Roundtrip
+ already did not do this. Usage only makes real sense for Python 3.6+
+ (feature request by `Sebastian Gerber https://bitbucket.org/spacemanspiff2007/`__).
+ - implement Python version check in YAML metadata in ``_test/test_z_data.py``
+
+ 0.15.76 (2018-11-01):
+ - fix issue with empty mapping and sequence loaded as flow-style
+ (mapping reported by `Min RK https://bitbucket.org/minrk/`__, sequence
+ by `Maged Ahmed https://bitbucket.org/maged2/`__)
+
+ 0.15.75 (2018-10-27):
+ - fix issue with single '?' scalar (reported by `Terrance
+ https://bitbucket.org/OllieTerrance/`__)
+ - fix issue with duplicate merge keys (prompted by `answering
+ https://stackoverflow.com/a/52852106/1307905`__ a
+ `StackOverflow question https://stackoverflow.com/q/52851168/1307905`__
+ by `math https://stackoverflow.com/users/1355634/math`__)
+
+ 0.15.74 (2018-10-17):
+ - fix dropping of comment on rt before sequence item that is sequence item
+ (reported by `Thorsten Kampe https://bitbucket.org/thorstenkampe/`__)
+
+ 0.15.73 (2018-10-16):
+ - fix irregular output on pre-comment in sequence within sequence (reported
+ by `Thorsten Kampe https://bitbucket.org/thorstenkampe/`__)
+ - allow non-compact (i.e. next line) dumping sequence/mapping within sequence.
+
+ 0.15.72 (2018-10-06):
+ - fix regression on explicit 1.1 loading with the C based scanner/parser
+ (reported by `Tomas Vavra https://bitbucket.org/xtomik/`__)
+
0.15.71 (2018-09-26):
- some of the tests now live in YAML files in the
`yaml.data https://bitbucket.org/ruamel/yaml.data`__ repository.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/ruamel.yaml.egg-info/SOURCES.txt new/ruamel.yaml-0.15.78/ruamel.yaml.egg-info/SOURCES.txt
--- old/ruamel.yaml-0.15.71/ruamel.yaml.egg-info/SOURCES.txt 2018-09-26 23:05:18.000000000 +0200
+++ new/ruamel.yaml-0.15.78/ruamel.yaml.egg-info/SOURCES.txt 2018-11-15 17:57:41.000000000 +0100
@@ -5,6 +5,7 @@
setup.py
./LICENSE
./__init__.py
+./anchor.py
./comments.py
./compat.py
./composer.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/scalarstring.py new/ruamel.yaml-0.15.78/scalarstring.py
--- old/ruamel.yaml-0.15.71/scalarstring.py 2018-09-21 11:00:21.000000000 +0200
+++ new/ruamel.yaml-0.15.78/scalarstring.py 2018-11-15 15:46:06.000000000 +0100
@@ -3,6 +3,7 @@
from __future__ import print_function, absolute_import, division, unicode_literals
from ruamel.yaml.compat import text_type
+from ruamel.yaml.anchor import Anchor
if False: # MYPY
from typing import Text, Any, Dict, List # NOQA
@@ -20,7 +21,7 @@
class ScalarString(text_type):
- __slots__ = ()
+ __slots__ = (Anchor.attrib)
def __new__(cls, *args, **kw):
# type: (Any, Any) -> Any
@@ -30,6 +31,26 @@
# type: (Any, Any, int) -> Any
return type(self)((text_type.replace(self, old, new, maxreplace)))
+ @property
+ def anchor(self):
+ # type: () -> Any
+ if not hasattr(self, Anchor.attrib):
+ setattr(self, Anchor.attrib, Anchor())
+ return getattr(self, Anchor.attrib)
+
+ def yaml_anchor(self):
+ # type: () -> Any
+ if not hasattr(self, Anchor.attrib):
+ return None
+ if not self.anchor.always_dump:
+ return None
+ return self.anchor
+
+ def yaml_set_anchor(self, value, always_dump=False):
+ # type: (Any, bool) -> None
+ self.anchor.value = value
+ self.anchor.always_dump = always_dump
+
class LiteralScalarString(ScalarString):
__slots__ = 'comment' # the comment after the | on the first line
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/serializer.py new/ruamel.yaml-0.15.78/serializer.py
--- old/ruamel.yaml-0.15.71/serializer.py 2018-09-21 11:00:21.000000000 +0200
+++ new/ruamel.yaml-0.15.78/serializer.py 2018-11-15 15:46:06.000000000 +0100
@@ -3,7 +3,7 @@
from __future__ import absolute_import
from ruamel.yaml.error import YAMLError
-from ruamel.yaml.compat import nprint, DBG_NODE, dbg, string_types
+from ruamel.yaml.compat import nprint, DBG_NODE, dbg, string_types, nprintf # NOQA
from ruamel.yaml.util import RegExp
from ruamel.yaml.events import (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.71/setup.py new/ruamel.yaml-0.15.78/setup.py
--- old/ruamel.yaml-0.15.71/setup.py 2018-09-26 09:06:04.000000000 +0200
+++ new/ruamel.yaml-0.15.78/setup.py 2018-11-15 17:41:33.000000000 +0100
@@ -44,6 +44,10 @@
class NameConstant:
pass
+if sys.version_info >= (3, 8):
+
+ from ast import Str, Num, Bytes, NameConstant # NOQA
+
if sys.version_info < (3,):
open_kw = dict()
@@ -830,7 +834,7 @@
sources=[self.pn(x) for x in target['src']],
libraries=[self.pn(x) for x in target.get('lib')],
)
- # debug('test in target', 'test' in target, target)
+ # debug('test1 in target', 'test' in target, target)
if 'test' not in target: # no test, just hope it works
self._ext_modules.append(ext)
continue
@@ -871,8 +875,8 @@
print('compile error:', file_name)
continue
except LinkError:
- debug('libyaml link error', file_name)
- print('libyaml link error', file_name)
+ debug('link error', file_name)
+ print('link error', file_name)
continue
self._ext_modules.append(ext)
except Exception as e: # NOQA
@@ -893,10 +897,10 @@
https://bitbucket.org/pypa/wheel/issues/47
"""
if 'bdist_wheel' not in sys.argv:
- return
+ return False
file_name = 'setup.cfg'
if os.path.exists(file_name): # add it if not in there?
- return
+ return False
with open(file_name, 'w') as fp:
if os.path.exists('LICENSE'):
fp.write('[metadata]\nlicense-file = LICENSE\n')
@@ -964,6 +968,8 @@
for k in sorted(kw):
v = kw[k]
print(' "{0}": "{1}",'.format(k, v))
+ # if '--record' in sys.argv:
+ # return
if dump_kw in sys.argv:
sys.argv.remove(dump_kw)
try:
@@ -971,7 +977,26 @@
kw['long_description'] = fp.read()
except Exception:
pass
+
if nsp.wheel(kw, setup):
+ if nsp.nested and 'bdist_wheel' in sys.argv:
+ try:
+ d = sys.argv[sys.argv.index('-d') + 1]
+ except ValueError:
+ dist_base = os.environ.get('PYDISTBASE')
+ if dist_base:
+ d = os.path.join(dist_base, nsp.full_package_name)
+ else:
+ d = 'dist'
+ for x in os.listdir(d):
+ dashed_vs = '-' + version_str + '-'
+ if x.endswith('.whl') and dashed_vs in x:
+ # remove .pth file from the wheel
+ full_name = os.path.join(d, x)
+ print('patching .pth from', full_name)
+ with InMemoryZipFile(full_name) as imz:
+ imz.delete_from_zip_file(nsp.full_package_name + '.*.pth')
+ break
return
for x in ['-c', 'egg_info', '--egg-base', 'pip-egg-info']:
if x not in sys.argv:
@@ -1002,6 +1027,7 @@
if x.endswith('.whl'):
# remove .pth file from the wheel
full_name = os.path.join(d, x)
+ print('patching .pth from', full_name)
with InMemoryZipFile(full_name) as imz:
imz.delete_from_zip_file(nsp.full_package_name + '.*.pth')
break