summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-01-16 08:14:14 +0100
committerAnthon van der Neut <anthon@mnt.org>2019-01-16 08:14:14 +0100
commit713d6c65fd545c6ad38d73686cfb040fd6dc217d (patch)
treeb86dd2a676dd50ea30311d163bcfb7614c36078f
parentdf566d79c442daceb169454a1003c39e9e71b325 (diff)
downloadruamel.yaml-713d6c65fd545c6ad38d73686cfb040fd6dc217d.tar.gz
insert merge key in old (absolute) position0.15.86
-rw-r--r--CHANGES16
-rw-r--r--README.rst22
-rw-r--r--__init__.py4
-rw-r--r--_doc/_static/pypi.svg2
-rw-r--r--_test/test_z_data.py6
-rw-r--r--constructor.py8
-rw-r--r--representer.py3
-rw-r--r--setup.py1
-rw-r--r--timestamp.py3
9 files changed, 53 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index bb25af7..d56f30e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,19 @@
+[0, 15, 86]: 2019-01-16
+ - reinsert merge key in its old position (reported by grumbler on
+ <Stackoverflow <https://stackoverflow.com/a/54206512/1307905>`__)
+ - fix for issue with non-ASCII anchor names (reported and fix
+ provided by Dandaleon Flux via email)
+ - fix for issue when parsing flow mapping value starting with colon (in pure Python only)
+ (reported by `FichteFoll <https://bitbucket.org/FichteFoll/>`__)
+
+[0, 15, 86]: 2019-01-15
+ - reinsert merge key in its old position (reported by grumbler on
+ <Stackoverflow <https://stackoverflow.com/a/54206512/1307905>`__)
+ - fix for issue with non-ASCII anchor names (reported and fix
+ provided by Dandaleon Flux via email)
+ - fix for issue when parsing flow mapping value starting with colon (in pure Python only)
+ (reported by `FichteFoll <https://bitbucket.org/FichteFoll/>`__)
+
[0, 15, 85]: 2019-01-08
- the types used by `SafeConstructor` for mappings and sequences can
now by set by assigning to `XXXConstructor.yaml_base_dict_type`
diff --git a/README.rst b/README.rst
index 7f929bb..809dd10 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.85
-:updated: 2019-01-08
+:version: 0.15.86
+:updated: 2019-01-16
:documentation: http://yaml.readthedocs.io
:repository: https://bitbucket.org/ruamel/
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -54,16 +54,24 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key (with empty line)
+0.15.86 (2019-01-16):
+ - reinsert merge key in its old position (reported by grumbler on
+ <Stackoverflow <https://stackoverflow.com/a/54206512/1307905>`__)
+ - fix for issue with non-ASCII anchor names (reported and fix
+ provided by Dandaleon Flux via email)
+ - fix for issue when parsing flow mapping value starting with colon (in pure Python only)
+ (reported by `FichteFoll <https://bitbucket.org/FichteFoll/>`__)
+
0.15.85 (2019-01-08):
- - the types used by `SafeConstructor` for mappings and sequences can
- now by set by assigning to `XXXConstructor.yaml_base_dict_type`
- (and `..._list_type`), preventing the need to copy two methods
- with 50+ lines that had `var = {}` hardcoded. (Implemented to
+ - the types used by ``SafeConstructor`` for mappings and sequences can
+ now by set by assigning to ``XXXConstructor.yaml_base_dict_type``
+ (and ``..._list_type``), preventing the need to copy two methods
+ with 50+ lines that had ``var = {}`` hardcoded. (Implemented to
help solve an feature request by `Anthony Sottile
<https://bitbucket.org/asottile/>`__ in an easier way)
0.15.84 (2019-01-07):
- - fix for `CommentedMap.copy()` not returning `CommentedMap`, let alone copying comments etc.
+ - fix for ``CommentedMap.copy()`` not returning ``CommentedMap``, let alone copying comments etc.
(reported by `Anthony Sottile <https://bitbucket.org/asottile/>`__)
0.15.83 (2019-01-02):
diff --git a/__init__.py b/__init__.py
index 8a0ef9e..1cb3f30 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, 85),
- __version__='0.15.85',
+ version_info=(0, 15, 86),
+ __version__='0.15.86',
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 4c05b38..23fc356 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.85</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.85</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.86</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.86</text></g> </svg>
diff --git a/_test/test_z_data.py b/_test/test_z_data.py
index ca75ca6..99810aa 100644
--- a/_test/test_z_data.py
+++ b/_test/test_z_data.py
@@ -9,6 +9,7 @@ import warnings # NOQA
from ruamel.std.pathlib import Path
base_path = Path('data') # that is ruamel.yaml.data
+PY2 = sys.version_info[0] == 2
class YAMLData(object):
@@ -124,7 +125,10 @@ class TestYAMLData(object):
buf = StringIO()
yaml.dump(data, buf)
expected = input.value if output is None else output.value
- assert buf.getvalue() == expected
+ value = buf.getvalue()
+ if PY2:
+ value = value.decode('utf-8')
+ assert value == expected
def load_assert(self, input, confirm, yaml_version=None):
from ruamel.yaml.compat import Mapping
diff --git a/constructor.py b/constructor.py
index 53e0d27..3f11c56 100644
--- a/constructor.py
+++ b/constructor.py
@@ -599,6 +599,14 @@ class SafeConstructor(BaseConstructor):
delta = datetime.timedelta(hours=tz_hour, minutes=tz_minute)
if values['tz_sign'] == '-':
delta = -delta
+ # should do something else instead (or hook this up to the preceding if statement
+ # in reverse
+ # if delta is None:
+ # return datetime.datetime(year, month, day, hour, minute, second, fraction)
+ # return datetime.datetime(year, month, day, hour, minute, second, fraction,
+ # datetime.timezone.utc)
+ # the above is not good enough though, should provide tzinfo. In Python3 that is easily
+ # doable drop that kind of support for Python2 as it has not native tzinfo
data = datetime.datetime(year, month, day, hour, minute, second, fraction)
if delta:
data -= delta
diff --git a/representer.py b/representer.py
index ced41a0..7b2f007 100644
--- a/representer.py
+++ b/representer.py
@@ -1002,6 +1002,7 @@ 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]
item_count = 0
if bool(merge_list):
items = mapping.non_merged_items()
@@ -1039,7 +1040,7 @@ class RoundTripRepresenter(SafeRepresenter):
else:
arg = self.represent_data(merge_list)
arg.flow_style = True
- value.insert(0, (ScalarNode(u'tag:yaml.org,2002:merge', '<<'), arg))
+ value.insert(merge_pos, (ScalarNode(u'tag:yaml.org,2002:merge', '<<'), arg))
return node
def represent_omap(self, tag, omap, flow_style=None):
diff --git a/setup.py b/setup.py
index e75711c..70aee86 100644
--- a/setup.py
+++ b/setup.py
@@ -44,6 +44,7 @@ if sys.version_info < (3, 4):
class NameConstant:
pass
+
if sys.version_info >= (3, 8):
from ast import Str, Num, Bytes, NameConstant # NOQA
diff --git a/timestamp.py b/timestamp.py
index b87a348..374e4c0 100644
--- a/timestamp.py
+++ b/timestamp.py
@@ -5,6 +5,9 @@ from __future__ import print_function, absolute_import, division, unicode_litera
import datetime
import copy
+# ToDo: at least on PY3 you could probably attach the tzinfo correctly to the object
+# a more complete datetime might be used by safe loading as well
+
if False: # MYPY
from typing import Any, Dict, Optional, List # NOQA