summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-01-02 20:43:06 +0100
committerAnthon van der Neut <anthon@mnt.org>2019-01-02 20:43:06 +0100
commit2004da336f1736f63062fa70dae374b9ad765917 (patch)
tree01f967e3bfab14d72db2b40bbfcfca782ac2d953
parentc59babd740f7d6cfd865626f0a0427de8c320987 (diff)
downloadruamel.yaml-2004da336f1736f63062fa70dae374b9ad765917.tar.gz
fix issue with roundtripping mappings keys that are aliases to scalar strings0.15.83
-rw-r--r--CHANGES3
-rw-r--r--LICENSE2
-rw-r--r--README.rst7
-rw-r--r--__init__.py4
-rw-r--r--_doc/_static/pypi.svg2
-rw-r--r--emitter.py9
-rw-r--r--scalarint.py2
7 files changed, 20 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index 84248bb..b157860 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+[0, 15, 83]: 2019-01-02
+ - fix for bug in roundtripping aliases used as key (reported via email by Zaloo)
+
[0, 15, 82]: 2018-12-28
- anchors and aliases on scalar int, float, string and bool are now preserved. Anchors
do not need a referring alias for these (reported by
diff --git a/LICENSE b/LICENSE
index 3fe0f5b..787621c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
- Copyright (c) 2014-2018 Anthon van der Neut, Ruamel bvba
+ Copyright (c) 2014-2019 Anthon van der Neut, Ruamel bvba
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.rst b/README.rst
index e651606..829f209 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.82
-:updated: 2018-12-28
+:version: 0.15.83
+:updated: 2019-01-02
:documentation: http://yaml.readthedocs.io
:repository: https://bitbucket.org/ruamel/
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -54,6 +54,9 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key (with empty line)
+0.15.83 (2019-01-02):
+ - fix for bug in roundtripping aliases used as key (reported via email by Zaloo)
+
0.15.82 (2018-12-28):
- anchors and aliases on scalar int, float, string and bool are now preserved. Anchors
do not need a referring alias for these (reported by
diff --git a/__init__.py b/__init__.py
index 1ef43d8..d71c2d4 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, 82),
- __version__='0.15.82',
+ version_info=(0, 15, 83),
+ __version__='0.15.83',
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 a98af9d..5b4aa86 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.82</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.82</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.83</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.83</text></g> </svg>
diff --git a/emitter.py b/emitter.py
index d4c51f9..99fa6bd 100644
--- a/emitter.py
+++ b/emitter.py
@@ -669,10 +669,15 @@ class Emitter(object):
if not isinstance(
self.event, (SequenceStartEvent, MappingStartEvent)
): # sequence keys
- if self.event.style == '?':
- self.write_indicator(u'?', True, indention=True)
+ try:
+ if self.event.style == '?':
+ self.write_indicator(u'?', True, indention=True)
+ except AttributeError: # aliases have no style
+ pass
self.states.append(self.expect_block_mapping_simple_value)
self.expect_node(mapping=True, simple_key=True)
+ if isinstance(self.event, AliasEvent):
+ self.stream.write(u' ')
else:
self.write_indicator(u'?', True, indention=True)
self.states.append(self.expect_block_mapping_value)
diff --git a/scalarint.py b/scalarint.py
index 6842c05..581a8df 100644
--- a/scalarint.py
+++ b/scalarint.py
@@ -8,7 +8,7 @@ from ruamel.yaml.anchor import Anchor
if False: # MYPY
from typing import Text, Any, Dict, List # NOQA
-__all__ = ['ScalarInt', 'BinaryInt', 'OctalInt', 'HexInt', 'HexCapsInt']
+__all__ = ['ScalarInt', 'BinaryInt', 'OctalInt', 'HexInt', 'HexCapsInt', 'DecimalInt']
class ScalarInt(no_limit_int):