summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-01-23 12:23:47 +0100
committerAnthon van der Neut <anthon@mnt.org>2017-01-23 12:23:47 +0100
commit610bebfbbc8887195f1ad9f52adbed7ffcf70876 (patch)
tree20567b150c64f93b051645be03312c0676de3e15
parent5f73166ac799522dea0377044b4f1df12c27c331 (diff)
downloadruamel.yaml-0.13.11.tar.gz
allow ':' in flow-style scalar when not followed by space0.13.11
-rw-r--r--README.rst5
-rw-r--r--__init__.py2
-rw-r--r--_test/test_fail.py13
-rw-r--r--emitter.py2
-rw-r--r--scanner.py11
-rw-r--r--tox.ini2
6 files changed, 28 insertions, 7 deletions
diff --git a/README.rst b/README.rst
index 4ac5d5c..fcc517a 100644
--- a/README.rst
+++ b/README.rst
@@ -18,6 +18,11 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key
+0.13.11 (2017-01-23):
+ - allow ':' in flow style scalars if not followed by space. Also don't
+ quote such scalar as this is no longer necessary.
+ - add python 3.6 manylinux wheel to PyPI
+
0.13.10 (2017-01-22):
- fix for issue 93, insert spurious blank line before single line comment
between indented sequence elements (reported by Alex)
diff --git a/__init__.py b/__init__.py
index 40e77b5..4cbf3b2 100644
--- a/__init__.py
+++ b/__init__.py
@@ -9,7 +9,7 @@ from __future__ import absolute_import
_package_data = dict(
full_package_name="ruamel.yaml",
- version_info=(0, 13, 10),
+ version_info=(0, 13, 11),
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/_test/test_fail.py b/_test/test_fail.py
index 34516a0..300bfa6 100644
--- a/_test/test_fail.py
+++ b/_test/test_fail.py
@@ -212,3 +212,16 @@ class TestTagFailures:
location: Germany
language: python
""")
+
+
+class TestFlowValues:
+ def test_flow_value_with_colon(self):
+ round_trip("""\
+ {a: bcd:efg}
+ """)
+
+ @pytest.mark.xfail(strict=True)
+ def test_flow_value_with_colon_quoted(self):
+ round_trip("""\
+ {a: 'bcd:efg'}
+ """)
diff --git a/emitter.py b/emitter.py
index 21961b3..a1cdf54 100644
--- a/emitter.py
+++ b/emitter.py
@@ -775,8 +775,8 @@ class Emitter(object):
if ch in u',?[]{}':
flow_indicators = True
if ch == u':':
- flow_indicators = True
if followed_by_whitespace:
+ flow_indicators = True
block_indicators = True
if ch == u'#' and preceeded_by_whitespace:
flow_indicators = True
diff --git a/scanner.py b/scanner.py
index 2a57c5d..ce12500 100644
--- a/scanner.py
+++ b/scanner.py
@@ -1344,10 +1344,13 @@ class Scanner(object):
break
while True:
ch = self.peek(length)
- if ch in u'\0 \t\r\n\x85\u2028\u2029' \
- or (not self.flow_level and ch == u':' and
- self.peek(length+1) in u'\0 \t\r\n\x85\u2028\u2029') \
- or (self.flow_level and ch in u',:?[]{}'):
+ if (ch == u':' and
+ self.peek(length+1) not in u'\0 \t\r\n\x85\u2028\u2029'):
+ pass
+ elif (ch in u'\0 \t\r\n\x85\u2028\u2029' or
+ (not self.flow_level and ch == u':' and
+ self.peek(length+1) in u'\0 \t\r\n\x85\u2028\u2029') or
+ (self.flow_level and ch in u',:?[]{}')):
break
length += 1
# It's not clear what we should do with ':' in the flow context.
diff --git a/tox.ini b/tox.ini
index 611e633..5744346 100644
--- a/tox.ini
+++ b/tox.ini
@@ -20,4 +20,4 @@ commands =
[flake8]
show-source = True
max-line-length = 95
-exclude = .hg,.git,.tox,dist,.cache,__pycache__,ruamel.zip2tar.egg-info
+exclude = _test/lib,.hg,.git,.tox,dist,.cache,__pycache__,ruamel.zip2tar.egg-info