Hello community, here is the log from the commit of package python-ruamel.yaml for openSUSE:Factory checked in at 2018-07-17 09:41:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ruamel.yaml (Old) and /work/SRC/openSUSE:Factory/.python-ruamel.yaml.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-ruamel.yaml" Tue Jul 17 09:41:55 2018 rev:6 rq:622950 version:0.15.44 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ruamel.yaml/python-ruamel.yaml.changes 2018-04-05 15:34:10.858647640 +0200 +++ /work/SRC/openSUSE:Factory/.python-ruamel.yaml.new/python-ruamel.yaml.changes 2018-07-17 09:42:53.861180098 +0200 @@ -1,0 +2,10 @@ +Sun Jul 15 22:04:22 UTC 2018 - mimi.vx@gmail.com + +- update to 0.15.44 + * fix for losing precision when roundtripping floats by + * decoding unicode escaped tags on Python2 + * add detection of C-compile failure + * fix regression showing only on narrow Python 2.7 + * ``register_class()`` now returns class + +------------------------------------------------------------------- Old: ---- ruamel.yaml-0.15.37.tar.gz New: ---- ruamel.yaml-0.15.44.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ruamel.yaml.spec ++++++ --- /var/tmp/diff_new_pack.veU1Bh/_old 2018-07-17 09:42:54.781176724 +0200 +++ /var/tmp/diff_new_pack.veU1Bh/_new 2018-07-17 09:42:54.785176709 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-ruamel.yaml -Version: 0.15.37 +Version: 0.15.44 Release: 0 Summary: Python YAML parser License: MIT ++++++ ruamel.yaml-0.15.37.tar.gz -> ruamel.yaml-0.15.44.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/CHANGES new/ruamel.yaml-0.15.44/CHANGES --- old/ruamel.yaml-0.15.37/CHANGES 2018-03-21 21:22:57.000000000 +0100 +++ new/ruamel.yaml-0.15.44/CHANGES 2018-07-14 09:24:38.000000000 +0200 @@ -1,3 +1,99 @@ +[0, 15, 44]: 2018-07-14 + - Correct loading plain scalars consisting of numerals only and + starting with `0`, when not explicitly specifying YAML version + 1.1. This also fixes the issue about dumping string `'019'` as + plain scalars as reported by `Min RK + <https://bitbucket.org/minrk/>`__, that prompted this chance. + +[0, 15, 43]: 2018-07-14 + - Correct loading plain scalars consisting of numerals only and + starting with `0`, when not explicitly specifying YAML version + 1.1. This also fixes the issue about dumping string `'019'` as + plain scalars as reported by `Min RK + <https://bitbucket.org/minrk/>`__, that prompted this chance. + +[0, 15, 43]: 2018-07-12 + - merge PR33: Python2.7 on Windows is narrow, but has no + ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__) + - ``register_class()`` now returns class (proposed by + `Mike Nerone <https://bitbucket.org/Manganeez/>`__} + +[0, 15, 43]: 2018-07-12 + - merge PR33: Python2.7 on Windows is narrow, but has no + ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__) + - ``register_class()`` now returns class (proposed by + `Mike Nerone <https://bitbucket.org/Manganeez/>`__} + +[0, 15, 43]: 2018-07-12 + - merge PR33: Python2.7 on Windows is narrow, but has no + ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__) + - ``register_class()`` now returns class (proposed by + `Mike Nerone <https://bitbucket.org/Manganeez/>`__} + +[0, 15, 43]: 2018-07-12 + - merge PR33: Python2.7 on Windows is narrow, but has no + ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__) + - ``register_class()`` now returns class (proposed by + `Mike Nerone <https://bitbucket.org/Manganeez/>`__} + +[0, 15, 43]: 2018-07-12 + - merge PR33: Python2.7 on Windows is narrow, but has no + ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__) + - ``register_class()`` now returns class (proposed by + `Mike Nerone <https://bitbucket.org/Manganeez/>`__} + +[0, 15, 43]: 2018-07-12 + - merge PR33: Python2.7 on Windows is narrow, but has no + ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__) + - ``register_class()`` now returns class (proposed by + `Mike Nerone <https://bitbucket.org/Manganeez/>`__} + +[0, 15, 42]: 2018-07-01 + - fix regression showing only on narrow Python 2.7 (py27mu) builds + (with help from + `Marcel Bargull <https://bitbucket.org/mbargull/>`__ and + `Colm O'Connor <>`__). + - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well as + 3.4/3.5/3.6/3.7/pypy + +[0, 15, 41]: 2018-06-27 + - add detection of C-compile failure (investigation prompted by + `StackOverlow <https://stackoverflow.com/a/51057399/1307905>`__ by + `Emmanuel Blot <https://stackoverflow.com/users/8233409/emmanuel-blot>`__), + which was removed while no longer dependent on ``libyaml``, C-extensions + compilation still needs a compiler though. + +[0, 15, 41]: 2018-06-27 + - add detection of C-compile failure (investigation prompted by + `StackOverlow <https://stackoverflow.com/a/51057399/1307905>`__ by + `Emmanuel Blot <https://stackoverflow.com/users/8233409/emmanuel-blot>`__), + which was removed while no longer dependent on ``libyaml``, C-extensions + compilation still needs a compiler though. + +[0, 15, 40]: 2018-06-18 + - added links to landing places as suggested in issue 190 by + `KostisA <https://bitbucket.org/ankostis/>`__ + - fixes issue #201: decoding unicode escaped tags on Python2, reported + by `Dan Abolafia <https://bitbucket.org/danabo/>`__ + +[0, 15, 39]: 2018-06-16 + - merge PR27 improving package startup time (and loading when regexp not + actually used), provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__ + +[0, 15, 37]: 2018-06-13 + - fix for losing precision when roundtripping floats by + `Rolf Wojtech <https://bitbucket.org/asomov/>`__ + - fix for hardcoded dir separator not working for Windows by + `Nuno André <https://bitbucket.org/nu_no/>`__ + - typo fix by `Andrey Somov <https://bitbucket.org/asomov/>`__ + [0, 15, 37]: 2018-03-21 - again trying to create installable files for 187 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/PKG-INFO new/ruamel.yaml-0.15.44/PKG-INFO --- old/ruamel.yaml-0.15.37/PKG-INFO 2018-03-21 21:27:29.000000000 +0100 +++ new/ruamel.yaml-0.15.44/PKG-INFO 2018-07-14 09:43:12.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ruamel.yaml -Version: 0.15.37 +Version: 0.15.44 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,6 +12,13 @@ ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. + :version: 0.15.44 + :updated: 2018-07-14 + :documentation: http://yaml.readthedocs.io + :repository: https://bitbucket.org/ruamel/ + :pypi: https://pypi.org/project/ruamel.yaml/ + + Starting with version 0.15.0 the way YAML files are loaded and dumped is changing. See the API doc for details. Currently existing functionality will throw a warning before being changed/removed. @@ -43,6 +50,53 @@ .. should insert NEXT: at the beginning of line for next key (with empty line) + 0.15.44 (2018-07-14): + - Correct loading plain scalars consisting of numerals only and + starting with `0`, when not explicitly specifying YAML version + 1.1. This also fixes the issue about dumping string `'019'` as + plain scalars as reported by `Min RK + <https://bitbucket.org/minrk/>`__, that prompted this chance. + + 0.15.43 (2018-07-12): + - merge PR33: Python2.7 on Windows is narrow, but has no + ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__) + - ``register_class()`` now returns class (proposed by + `Mike Nerone <https://bitbucket.org/Manganeez/>`__} + + 0.15.42 (2018-07-01): + - fix regression showing only on narrow Python 2.7 (py27mu) builds + (with help from + `Marcel Bargull <https://bitbucket.org/mbargull/>`__ and + `Colm O'Connor <>`__). + - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well as + 3.4/3.5/3.6/3.7/pypy + + 0.15.41 (2018-06-27): + - add detection of C-compile failure (investigation prompted by + `StackOverlow <https://stackoverflow.com/a/51057399/1307905>`__ by + `Emmanuel Blot <https://stackoverflow.com/users/8233409/emmanuel-blot>`__), + which was removed while no longer dependent on ``libyaml``, C-extensions + compilation still needs a compiler though. + + 0.15.40 (2018-06-18): + - added links to landing places as suggested in issue 190 by + `KostisA <https://bitbucket.org/ankostis/>`__ + - fixes issue #201: decoding unicode escaped tags on Python2, reported + by `Dan Abolafia <https://bitbucket.org/danabo/>`__ + + 0.15.39 (2018-06-17): + - merge PR27 improving package startup time (and loading when regexp not + actually used), provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__ + + 0.15.38 (2018-06-13): + - fix for losing precision when roundtripping floats by + `Rolf Wojtech <https://bitbucket.org/asomov/>`__ + - fix for hardcoded dir separator not working for Windows by + `Nuno André <https://bitbucket.org/nu_no/>`__ + - typo fix by `Andrey Somov <https://bitbucket.org/asomov/>`__ + 0.15.37 (2018-03-21): - again trying to create installable files for 187 @@ -297,7 +351,6 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/README.rst new/ruamel.yaml-0.15.44/README.rst --- old/ruamel.yaml-0.15.37/README.rst 2018-03-21 21:22:57.000000000 +0100 +++ new/ruamel.yaml-0.15.44/README.rst 2018-07-14 09:24:38.000000000 +0200 @@ -4,6 +4,13 @@ ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. +:version: 0.15.44 +:updated: 2018-07-14 +:documentation: http://yaml.readthedocs.io +:repository: https://bitbucket.org/ruamel/ +:pypi: https://pypi.org/project/ruamel.yaml/ + + Starting with version 0.15.0 the way YAML files are loaded and dumped is changing. See the API doc for details. Currently existing functionality will throw a warning before being changed/removed. @@ -35,6 +42,53 @@ .. should insert NEXT: at the beginning of line for next key (with empty line) +0.15.44 (2018-07-14): + - Correct loading plain scalars consisting of numerals only and + starting with `0`, when not explicitly specifying YAML version + 1.1. This also fixes the issue about dumping string `'019'` as + plain scalars as reported by `Min RK + <https://bitbucket.org/minrk/>`__, that prompted this chance. + +0.15.43 (2018-07-12): + - merge PR33: Python2.7 on Windows is narrow, but has no + ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__) + - ``register_class()`` now returns class (proposed by + `Mike Nerone <https://bitbucket.org/Manganeez/>`__} + +0.15.42 (2018-07-01): + - fix regression showing only on narrow Python 2.7 (py27mu) builds + (with help from + `Marcel Bargull <https://bitbucket.org/mbargull/>`__ and + `Colm O'Connor <>`__). + - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well as + 3.4/3.5/3.6/3.7/pypy + +0.15.41 (2018-06-27): + - add detection of C-compile failure (investigation prompted by + `StackOverlow <https://stackoverflow.com/a/51057399/1307905>`__ by + `Emmanuel Blot <https://stackoverflow.com/users/8233409/emmanuel-blot>`__), + which was removed while no longer dependent on ``libyaml``, C-extensions + compilation still needs a compiler though. + +0.15.40 (2018-06-18): + - added links to landing places as suggested in issue 190 by + `KostisA <https://bitbucket.org/ankostis/>`__ + - fixes issue #201: decoding unicode escaped tags on Python2, reported + by `Dan Abolafia <https://bitbucket.org/danabo/>`__ + +0.15.39 (2018-06-17): + - merge PR27 improving package startup time (and loading when regexp not + actually used), provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__ + +0.15.38 (2018-06-13): + - fix for losing precision when roundtripping floats by + `Rolf Wojtech <https://bitbucket.org/asomov/>`__ + - fix for hardcoded dir separator not working for Windows by + `Nuno André <https://bitbucket.org/nu_no/>`__ + - typo fix by `Andrey Somov <https://bitbucket.org/asomov/>`__ + 0.15.37 (2018-03-21): - again trying to create installable files for 187 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/__init__.py new/ruamel.yaml-0.15.44/__init__.py --- old/ruamel.yaml-0.15.37/__init__.py 2018-03-21 21:23:28.000000000 +0100 +++ new/ruamel.yaml-0.15.44/__init__.py 2018-07-14 09:24:41.000000000 +0200 @@ -7,8 +7,8 @@ _package_data = dict( full_package_name='ruamel.yaml', - version_info=(0, 15, 37), - __version__='0.15.37', + version_info=(0, 15, 44), + __version__='0.15.44', 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 @@ -27,11 +27,18 @@ 'ext/emitter.c', ], lib=[], + test=""" + int main(int argc, char* argv[]) + { + /* prevent warning */ + return 0; + } + """, )], + # NOQA # test='#include "ext/yaml.h"\n\nint main(int argc, char* argv[])\n{\nyaml_parser_t parser;\nparser = parser; /* prevent warning */\nreturn 0;\n}\n', # NOQA classifiers=[ 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', @@ -46,9 +53,12 @@ windows_wheels=True, read_the_docs='yaml', many_linux='libyaml-devel', - supported=[(2, 7), (3, 3)], # minimum + supported=[(2, 7), (3, 4)], # minimum tox=dict( - env='*p', + flake8=dict( + version='==2.5.5', + ), + env='*pn', # also test narrow 2.7.15 deps='ruamel.std.pathlib', fl8excl='_test/lib', ), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/comments.py new/ruamel.yaml-0.15.44/comments.py --- old/ruamel.yaml-0.15.37/comments.py 2017-12-28 09:11:13.000000000 +0100 +++ new/ruamel.yaml-0.15.44/comments.py 2018-06-27 10:02:48.000000000 +0200 @@ -200,25 +200,25 @@ def yaml_key_comment_extend(self, key, comment, clear=False): # type: (Any, Any, bool) -> None - l = self.ca._items.setdefault(key, [None, None, None, None]) - if clear or l[1] is None: + r = self.ca._items.setdefault(key, [None, None, None, None]) + if clear or r[1] is None: if comment[1] is not None: assert isinstance(comment[1], list) - l[1] = comment[1] + r[1] = comment[1] else: - l[1].extend(comment[0]) - l[0] = comment[0] + r[1].extend(comment[0]) + r[0] = comment[0] def yaml_value_comment_extend(self, key, comment, clear=False): # type: (Any, Any, bool) -> None - l = self.ca._items.setdefault(key, [None, None, None, None]) - if clear or l[3] is None: + r = self.ca._items.setdefault(key, [None, None, None, None]) + if clear or r[3] is None: if comment[1] is not None: assert isinstance(comment[1], list) - l[3] = comment[1] + r[3] = comment[1] else: - l[3].extend(comment[0]) - l[2] = comment[0] + r[3].extend(comment[0]) + r[2] = comment[0] def yaml_set_start_comment(self, comment, indent=0): # type: (Any, Any) -> None @@ -736,7 +736,7 @@ # type: (Any, Any) -> Any try: return self.__getitem__(key) - except: + except: # NOQA return default def __repr__(self): @@ -952,7 +952,7 @@ def dump_comments(d, name='', sep='.', out=sys.stdout): # type: (Any, str, str, Any) -> None """ - recurisively dump domments all but the toplevel preceded by the path + recursively dump comments, all but the toplevel preceded by the path in dotted form x.0.a """ if isinstance(d, dict) and hasattr(d, 'ca'): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/compat.py new/ruamel.yaml-0.15.44/compat.py --- old/ruamel.yaml-0.15.37/compat.py 2017-08-09 11:03:53.000000000 +0200 +++ new/ruamel.yaml-0.15.44/compat.py 2018-07-12 14:57:17.000000000 +0200 @@ -15,7 +15,7 @@ try: from ruamel.ordereddict import ordereddict -except: +except: # NOQA try: from collections import OrderedDict except ImportError: @@ -112,6 +112,8 @@ else: builtins_module = '__builtin__' +UNICODE_SIZE = 4 if sys.maxunicode > 65535 else 2 + def with_metaclass(meta, *bases): # type: (Any, Any) -> Any diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/constructor.py new/ruamel.yaml-0.15.44/constructor.py --- old/ruamel.yaml-0.15.37/constructor.py 2017-09-01 08:13:26.000000000 +0200 +++ new/ruamel.yaml-0.15.44/constructor.py 2018-07-12 16:55:34.000000000 +0200 @@ -26,6 +26,7 @@ from ruamel.yaml.scalarint import ScalarInt, BinaryInt, OctalInt, HexInt, HexCapsInt from ruamel.yaml.scalarfloat import ScalarFloat from ruamel.yaml.timestamp import TimeStamp +from ruamel.yaml.util import RegExp if False: # MYPY from typing import Any, Dict, List, Set, Generator # NOQA @@ -254,7 +255,7 @@ http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys """, """\ - Duplicate keys will become and error in future releases, and are errors + Duplicate keys will become an error in future releases, and are errors by default when using the new API. """, ] @@ -471,7 +472,7 @@ None, None, "failed to decode base64 data: %s" % exc, node.start_mark) - timestamp_regexp = re.compile( + timestamp_regexp = RegExp( u'''^(?P<year>[0-9][0-9][0-9][0-9]) -(?P<month>[0-9][0-9]?) -(?P<day>[0-9][0-9]?) @@ -1437,7 +1438,7 @@ data.yaml_set_tag(node.tag) yield data return - except: + except: # NOQA pass raise ConstructorError( None, None, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/emitter.py new/ruamel.yaml-0.15.44/emitter.py --- old/ruamel.yaml-0.15.37/emitter.py 2018-03-08 09:14:05.000000000 +0100 +++ new/ruamel.yaml-0.15.44/emitter.py 2018-06-27 09:58:05.000000000 +0200 @@ -1405,7 +1405,7 @@ data = data.encode(self.encoding) try: self.stream.write(data) - except: + except: # NOQA print(repr(data)) raise start = end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/ext/reader.c.orig new/ruamel.yaml-0.15.44/ext/reader.c.orig --- old/ruamel.yaml-0.15.37/ext/reader.c.orig 2018-03-03 10:11:14.000000000 +0100 +++ new/ruamel.yaml-0.15.44/ext/reader.c.orig 1970-01-01 01:00:00.000000000 +0100 @@ -1,469 +0,0 @@ - -#include "yaml_private.h" - -/* - * Declarations. - */ - -static int -yaml_parser_set_reader_error(yaml_parser_t *parser, const char *problem, - size_t offset, int value); - -static int -yaml_parser_update_raw_buffer(yaml_parser_t *parser); - -static int -yaml_parser_determine_encoding(yaml_parser_t *parser); - -YAML_DECLARE(int) -yaml_parser_update_buffer(yaml_parser_t *parser, size_t length); - -/* - * Set the reader error and return 0. - */ - -static int -yaml_parser_set_reader_error(yaml_parser_t *parser, const char *problem, - size_t offset, int value) -{ - parser->error = YAML_READER_ERROR; - parser->problem = problem; - parser->problem_offset = offset; - parser->problem_value = value; - - return 0; -} - -/* - * Byte order marks. - */ - -#define BOM_UTF8 "\xef\xbb\xbf" -#define BOM_UTF16LE "\xff\xfe" -#define BOM_UTF16BE "\xfe\xff" - -/* - * Determine the input stream encoding by checking the BOM symbol. If no BOM is - * found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. - */ - -static int -yaml_parser_determine_encoding(yaml_parser_t *parser) -{ - /* Ensure that we had enough bytes in the raw buffer. */ - - while (!parser->eof - && parser->raw_buffer.last - parser->raw_buffer.pointer < 3) { - if (!yaml_parser_update_raw_buffer(parser)) { - return 0; - } - } - - /* Determine the encoding. */ - - if (parser->raw_buffer.last - parser->raw_buffer.pointer >= 2 - && !memcmp(parser->raw_buffer.pointer, BOM_UTF16LE, 2)) { - parser->encoding = YAML_UTF16LE_ENCODING; - parser->raw_buffer.pointer += 2; - parser->offset += 2; - } - else if (parser->raw_buffer.last - parser->raw_buffer.pointer >= 2 - && !memcmp(parser->raw_buffer.pointer, BOM_UTF16BE, 2)) { - parser->encoding = YAML_UTF16BE_ENCODING; - parser->raw_buffer.pointer += 2; - parser->offset += 2; - } - else if (parser->raw_buffer.last - parser->raw_buffer.pointer >= 3 - && !memcmp(parser->raw_buffer.pointer, BOM_UTF8, 3)) { - parser->encoding = YAML_UTF8_ENCODING; - parser->raw_buffer.pointer += 3; - parser->offset += 3; - } - else { - parser->encoding = YAML_UTF8_ENCODING; - } - - return 1; -} - -/* - * Update the raw buffer. - */ - -static int -yaml_parser_update_raw_buffer(yaml_parser_t *parser) -{ - size_t size_read = 0; - - /* Return if the raw buffer is full. */ - - if (parser->raw_buffer.start == parser->raw_buffer.pointer - && parser->raw_buffer.last == parser->raw_buffer.end) - return 1; - - /* Return on EOF. */ - - if (parser->eof) return 1; - - /* Move the remaining bytes in the raw buffer to the beginning. */ - - if (parser->raw_buffer.start < parser->raw_buffer.pointer - && parser->raw_buffer.pointer < parser->raw_buffer.last) { - memmove(parser->raw_buffer.start, parser->raw_buffer.pointer, - parser->raw_buffer.last - parser->raw_buffer.pointer); - } - parser->raw_buffer.last -= - parser->raw_buffer.pointer - parser->raw_buffer.start; - parser->raw_buffer.pointer = parser->raw_buffer.start; - - /* Call the read handler to fill the buffer. */ - - if (!parser->read_handler(parser->read_handler_data, parser->raw_buffer.last, - parser->raw_buffer.end - parser->raw_buffer.last, &size_read)) { - return yaml_parser_set_reader_error(parser, "input error", - parser->offset, -1); - } - parser->raw_buffer.last += size_read; - if (!size_read) { - parser->eof = 1; - } - - return 1; -} - -/* - * Ensure that the buffer contains at least `length` characters. - * Return 1 on success, 0 on failure. - * - * The length is supposed to be significantly less that the buffer size. - */ - -YAML_DECLARE(int) -yaml_parser_update_buffer(yaml_parser_t *parser, size_t length) -{ - int first = 1; - - assert(parser->read_handler); /* Read handler must be set. */ - - /* If the EOF flag is set and the raw buffer is empty, do nothing. */ - - if (parser->eof && parser->raw_buffer.pointer == parser->raw_buffer.last) - return 1; - - /* Return if the buffer contains enough characters. */ - - if (parser->unread >= length) - return 1; - - /* Determine the input encoding if it is not known yet. */ - - if (!parser->encoding) { - if (!yaml_parser_determine_encoding(parser)) - return 0; - } - - /* Move the unread characters to the beginning of the buffer. */ - - if (parser->buffer.start < parser->buffer.pointer - && parser->buffer.pointer < parser->buffer.last) { - size_t size = parser->buffer.last - parser->buffer.pointer; - memmove(parser->buffer.start, parser->buffer.pointer, size); - parser->buffer.pointer = parser->buffer.start; - parser->buffer.last = parser->buffer.start + size; - } - else if (parser->buffer.pointer == parser->buffer.last) { - parser->buffer.pointer = parser->buffer.start; - parser->buffer.last = parser->buffer.start; - } - - /* Fill the buffer until it has enough characters. */ - - while (parser->unread < length) - { - /* Fill the raw buffer if necessary. */ - - if (!first || parser->raw_buffer.pointer == parser->raw_buffer.last) { - if (!yaml_parser_update_raw_buffer(parser)) return 0; - } - first = 0; - - /* Decode the raw buffer. */ - - while (parser->raw_buffer.pointer != parser->raw_buffer.last) - { - unsigned int value = 0, value2 = 0; - int incomplete = 0; - unsigned char octet; - unsigned int width = 0; - int low, high; - size_t k; - size_t raw_unread = parser->raw_buffer.last - parser->raw_buffer.pointer; - - /* Decode the next character. */ - - switch (parser->encoding) - { - case YAML_UTF8_ENCODING: - - /* - * Decode a UTF-8 character. Check RFC 3629 - * (http://www.ietf.org/rfc/rfc3629.txt) for more details. - * - * The following table (taken from the RFC) is used for - * decoding. - * - * Char. number range | UTF-8 octet sequence - * (hexadecimal) | (binary) - * --------------------+------------------------------------ - * 0000 0000-0000 007F | 0xxxxxxx - * 0000 0080-0000 07FF | 110xxxxx 10xxxxxx - * 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx - * 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - * - * Additionally, the characters in the range 0xD800-0xDFFF - * are prohibited as they are reserved for use with UTF-16 - * surrogate pairs. - */ - - /* Determine the length of the UTF-8 sequence. */ - - octet = parser->raw_buffer.pointer[0]; - width = (octet & 0x80) == 0x00 ? 1 : - (octet & 0xE0) == 0xC0 ? 2 : - (octet & 0xF0) == 0xE0 ? 3 : - (octet & 0xF8) == 0xF0 ? 4 : 0; - - /* Check if the leading octet is valid. */ - - if (!width) - return yaml_parser_set_reader_error(parser, - "invalid leading UTF-8 octet", - parser->offset, octet); - - /* Check if the raw buffer contains an incomplete character. */ - - if (width > raw_unread) { - if (parser->eof) { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-8 octet sequence", - parser->offset, -1); - } - incomplete = 1; - break; - } - - /* Decode the leading octet. */ - - value = (octet & 0x80) == 0x00 ? octet & 0x7F : - (octet & 0xE0) == 0xC0 ? octet & 0x1F : - (octet & 0xF0) == 0xE0 ? octet & 0x0F : - (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; - - /* Check and decode the trailing octets. */ - - for (k = 1; k < width; k ++) - { - octet = parser->raw_buffer.pointer[k]; - - /* Check if the octet is valid. */ - - if ((octet & 0xC0) != 0x80) - return yaml_parser_set_reader_error(parser, - "invalid trailing UTF-8 octet", - parser->offset+k, octet); - - /* Decode the octet. */ - - value = (value << 6) + (octet & 0x3F); - } - - /* Check the length of the sequence against the value. */ - - if (!((width == 1) || - (width == 2 && value >= 0x80) || - (width == 3 && value >= 0x800) || - (width == 4 && value >= 0x10000))) - return yaml_parser_set_reader_error(parser, - "invalid length of a UTF-8 sequence", - parser->offset, -1); - - /* Check the range of the value. */ - - /* if ((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF) */ - if (value > 0x10FFFF) - return yaml_parser_set_reader_error(parser, - "invalid Unicode character", - parser->offset, value); - - break; - - case YAML_UTF16LE_ENCODING: - case YAML_UTF16BE_ENCODING: - - low = (parser->encoding == YAML_UTF16LE_ENCODING ? 0 : 1); - high = (parser->encoding == YAML_UTF16LE_ENCODING ? 1 : 0); - - /* - * The UTF-16 encoding is not as simple as one might - * naively think. Check RFC 2781 - * (http://www.ietf.org/rfc/rfc2781.txt). - * - * Normally, two subsequent bytes describe a Unicode - * character. However a special technique (called a - * surrogate pair) is used for specifying character - * values larger than 0xFFFF. - * - * A surrogate pair consists of two pseudo-characters: - * high surrogate area (0xD800-0xDBFF) - * low surrogate area (0xDC00-0xDFFF) - * - * The following formulas are used for decoding - * and encoding characters using surrogate pairs: - * - * U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) - * U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) - * W1 = 110110yyyyyyyyyy - * W2 = 110111xxxxxxxxxx - * - * where U is the character value, W1 is the high surrogate - * area, W2 is the low surrogate area. - */ - - /* Check for incomplete UTF-16 character. */ - - if (raw_unread < 2) { - if (parser->eof) { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-16 character", - parser->offset, -1); - } - incomplete = 1; - break; - } - - /* Get the character. */ - - value = parser->raw_buffer.pointer[low] - + (parser->raw_buffer.pointer[high] << 8); - - /* Check for unexpected low surrogate area. */ - - if ((value & 0xFC00) == 0xDC00) - return yaml_parser_set_reader_error(parser, - "unexpected low surrogate area", - parser->offset, value); - - /* Check for a high surrogate area. */ - - if ((value & 0xFC00) == 0xD800) { - - width = 4; - - /* Check for incomplete surrogate pair. */ - - if (raw_unread < 4) { - if (parser->eof) { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-16 surrogate pair", - parser->offset, -1); - } - incomplete = 1; - break; - } - - /* Get the next character. */ - - value2 = parser->raw_buffer.pointer[low+2] - + (parser->raw_buffer.pointer[high+2] << 8); - - /* Check for a low surrogate area. */ - - if ((value2 & 0xFC00) != 0xDC00) - return yaml_parser_set_reader_error(parser, - "expected low surrogate area", - parser->offset+2, value2); - - /* Generate the value of the surrogate pair. */ - - value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF); - } - - else { - width = 2; - } - - break; - - default: - assert(1); /* Impossible. */ - } - - /* Check if the raw buffer contains enough bytes to form a character. */ - - if (incomplete) break; - - /* - * Check if the character is in the allowed range: - * #x9 | #xA | #xD | [#x20-#x7E] (8 bit) - * | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) - * | [#x10000-#x10FFFF] (32 bit) - */ - - if (! (value == 0x09 || value == 0x0A || value == 0x0D - || (value >= 0x20 && value <= 0x7E) - || (value == 0x85) || (value >= 0xA0 && value <= 0xD7FF) - || (value >= 0xE000 && value <= 0xFFFD) - || (value >= 0x10000 && value <= 0x10FFFF))) - return yaml_parser_set_reader_error(parser, - "control characters are not allowed", - parser->offset, value); - - /* Move the raw pointers. */ - - parser->raw_buffer.pointer += width; - parser->offset += width; - - /* Finally put the character into the buffer. */ - - /* 0000 0000-0000 007F -> 0xxxxxxx */ - if (value <= 0x7F) { - *(parser->buffer.last++) = value; - } - /* 0000 0080-0000 07FF -> 110xxxxx 10xxxxxx */ - else if (value <= 0x7FF) { - *(parser->buffer.last++) = 0xC0 + (value >> 6); - *(parser->buffer.last++) = 0x80 + (value & 0x3F); - } - /* 0000 0800-0000 FFFF -> 1110xxxx 10xxxxxx 10xxxxxx */ - else if (value <= 0xFFFF) { - *(parser->buffer.last++) = 0xE0 + (value >> 12); - *(parser->buffer.last++) = 0x80 + ((value >> 6) & 0x3F); - *(parser->buffer.last++) = 0x80 + (value & 0x3F); - } - /* 0001 0000-0010 FFFF -> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ - else { - *(parser->buffer.last++) = 0xF0 + (value >> 18); - *(parser->buffer.last++) = 0x80 + ((value >> 12) & 0x3F); - *(parser->buffer.last++) = 0x80 + ((value >> 6) & 0x3F); - *(parser->buffer.last++) = 0x80 + (value & 0x3F); - } - - parser->unread ++; - } - - /* On EOF, put NUL into the buffer and return. */ - - if (parser->eof) { - *(parser->buffer.last++) = '\0'; - parser->unread ++; - return 1; - } - - } - - if (parser->offset >= PTRDIFF_MAX) - return yaml_parser_set_reader_error(parser, "input is too long", - PTRDIFF_MAX, -1); - - return 1; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/main.py new/ruamel.yaml-0.15.44/main.py --- old/ruamel.yaml-0.15.37/main.py 2017-12-03 10:49:19.000000000 +0100 +++ new/ruamel.yaml-0.15.44/main.py 2018-07-12 15:09:12.000000000 +0200 @@ -32,7 +32,7 @@ try: from _ruamel_yaml import CParser, CEmitter # type: ignore -except: +except: # NOQA CParser = CEmitter = None # import io @@ -63,7 +63,7 @@ self.pure = pure self.plug_ins = [] # type: List[Any] for pu in ([] if plug_ins is None else plug_ins) + self.official_plug_ins(): - file_name = pu.replace('/', '.') + file_name = pu.replace(os.sep, '.') self.plug_ins.append(import_module(file_name)) self.Resolver = ruamel.yaml.resolver.VersionedResolver # type: Any self.allow_unicode = True @@ -481,7 +481,7 @@ return res def register_class(self, cls): - # type:(Any) -> None + # type:(Any) -> Any """ register a class for dumping loading - if it has attribute yaml_tag use that to register, else use class name @@ -506,6 +506,7 @@ return constructor.construct_yaml_object(node, cls) self.constructor.add_constructor(tag, f_y) + return cls # ### backwards compatibility def _indent(self, mapping=None, sequence=None, offset=None): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/reader.py new/ruamel.yaml-0.15.44/reader.py --- old/ruamel.yaml-0.15.37/reader.py 2017-07-18 12:51:19.000000000 +0200 +++ new/ruamel.yaml-0.15.44/reader.py 2018-06-30 15:55:36.000000000 +0200 @@ -21,13 +21,13 @@ # character. import codecs -import re from ruamel.yaml.error import YAMLError, FileMark, StringMark, YAMLStreamError -from ruamel.yaml.compat import text_type, binary_type, PY3 +from ruamel.yaml.compat import text_type, binary_type, PY3, UNICODE_SIZE +from ruamel.yaml.util import RegExp if False: # MYPY - from typing import Any, Dict, Optional, List, Union, Text # NOQA + from typing import Any, Dict, Optional, List, Union, Text, Tuple # NOQA from ruamel.yaml.compat import StreamTextType # NOQA __all__ = ['Reader', 'ReaderError'] @@ -179,31 +179,56 @@ self.encoding = 'utf-8' self.update(1) - # 4 if 32 bit unicode supported, 2 e.g. on MacOS (issue 56) - try: - NON_PRINTABLE = re.compile( + if UNICODE_SIZE == 2: + NON_PRINTABLE = RegExp( u'[^\x09\x0A\x0D\x20-\x7E\x85' u'\xA0-\uD7FF' u'\uE000-\uFFFD' - u'\U00010000-\U0010FFFF' u']' ) - UNICODE_SIZE = 4 - except: - NON_PRINTABLE = re.compile( + else: + NON_PRINTABLE = RegExp( u'[^\x09\x0A\x0D\x20-\x7E\x85' u'\xA0-\uD7FF' u'\uE000-\uFFFD' + u'\U00010000-\U0010FFFF' u']' ) - UNICODE_SIZE = 2 + + _printable_ascii = ('\x09\x0A\x0D' + ''.join(map(chr, range(0x20, 0x7F)))).encode('ascii') + + @classmethod + def _get_non_printable_ascii(cls, data): + # type: (Text, bytes) -> Union[None, Tuple[int, Text]] + ascii_bytes = data.encode('ascii') + non_printables = ascii_bytes.translate(None, cls._printable_ascii) + if not non_printables: + return None + non_printable = non_printables[:1] + return ascii_bytes.index(non_printable), non_printable.decode('ascii') + + @classmethod + def _get_non_printable_regex(cls, data): + # type: (Text) -> Union[None, Tuple[int, Text]] + match = cls.NON_PRINTABLE.search(data) + if not bool(match): + return None + return match.start(), match.group() + + @classmethod + def _get_non_printable(cls, data): + # type: (Text) -> Union[None, Tuple[int, Text]] + try: + return cls._get_non_printable_ascii(data) + except UnicodeEncodeError: + return cls._get_non_printable_regex(data) def check_printable(self, data): # type: (Any) -> None - match = self.NON_PRINTABLE.search(data) - if bool(match): - character = match.group() - position = self.index + (len(self.buffer) - self.pointer) + match.start() + non_printable_match = self._get_non_printable(data) + if non_printable_match is not None: + start, character = non_printable_match + position = self.index + (len(self.buffer) - self.pointer) + start raise ReaderError(self.name, position, ord(character), 'unicode', "special characters are not allowed") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/representer.py new/ruamel.yaml-0.15.44/representer.py --- old/ruamel.yaml-0.15.37/representer.py 2018-03-08 09:14:05.000000000 +0100 +++ new/ruamel.yaml-0.15.44/representer.py 2018-06-13 11:57:08.000000000 +0200 @@ -782,7 +782,9 @@ value += u'0' else: # exponent - m, es = u'{:{}e}'.format(data, data._width).split('e') + m, es = u'{:{}.{}e}'.format( + data, data._width, data._width - data._prec + (1 if data._m_sign else 0) + ).split('e') w = data._width if data._prec > 0 else (data._width + 1) if data < 0: w += 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/resolver.py new/ruamel.yaml-0.15.44/resolver.py --- old/ruamel.yaml-0.15.37/resolver.py 2017-08-12 20:12:47.000000000 +0200 +++ new/ruamel.yaml-0.15.44/resolver.py 2018-07-14 08:33:59.000000000 +0200 @@ -11,6 +11,7 @@ from ruamel.yaml.compat import string_types, _DEFAULT_YAML_VERSION # NOQA from ruamel.yaml.error import * # NOQA from ruamel.yaml.nodes import * # NOQA +from ruamel.yaml.util import RegExp # NOQA __all__ = ['BaseResolver', 'Resolver', 'VersionedResolver'] @@ -23,17 +24,17 @@ implicit_resolvers = [ ([(1, 2)], u'tag:yaml.org,2002:bool', - re.compile(u'''^(?:true|True|TRUE|false|False|FALSE)$''', re.X), + RegExp(u'''^(?:true|True|TRUE|false|False|FALSE)$''', re.X), list(u'tTfF')), ([(1, 1)], u'tag:yaml.org,2002:bool', - re.compile(u'''^(?:yes|Yes|YES|no|No|NO + RegExp(u'''^(?:yes|Yes|YES|no|No|NO |true|True|TRUE|false|False|FALSE |on|On|ON|off|Off|OFF)$''', re.X), list(u'yYnNtTfFoO')), ([(1, 2)], u'tag:yaml.org,2002:float', - re.compile(u'''^(?: + RegExp(u'''^(?: [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)? |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+) |\\.[0-9_]+(?:[eE][-+][0-9]+)? @@ -42,7 +43,7 @@ list(u'-+0123456789.')), ([(1, 1)], u'tag:yaml.org,2002:float', - re.compile(u'''^(?: + RegExp(u'''^(?: [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)? |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+) |\\.[0-9_]+(?:[eE][-+][0-9]+)? @@ -52,14 +53,14 @@ list(u'-+0123456789.')), ([(1, 2)], u'tag:yaml.org,2002:int', - re.compile(u'''^(?:[-+]?0b[0-1_]+ + RegExp(u'''^(?:[-+]?0b[0-1_]+ |[-+]?0o?[0-7_]+ - |[-+]?(?:0|[1-9][0-9_]*) + |[-+]?[0-9_]* |[-+]?0x[0-9a-fA-F_]+)$''', re.X), list(u'-+0123456789')), ([(1, 1)], u'tag:yaml.org,2002:int', - re.compile(u'''^(?:[-+]?0b[0-1_]+ + RegExp(u'''^(?:[-+]?0b[0-1_]+ |[-+]?0?[0-7_]+ |[-+]?(?:0|[1-9][0-9_]*) |[-+]?0x[0-9a-fA-F_]+ @@ -67,17 +68,17 @@ list(u'-+0123456789')), ([(1, 2), (1, 1)], u'tag:yaml.org,2002:merge', - re.compile(u'^(?:<<)$'), + RegExp(u'^(?:<<)$'), [u'<']), ([(1, 2), (1, 1)], u'tag:yaml.org,2002:null', - re.compile(u'''^(?: ~ + RegExp(u'''^(?: ~ |null|Null|NULL | )$''', re.X), [u'~', u'n', u'N', u'']), ([(1, 2), (1, 1)], u'tag:yaml.org,2002:timestamp', - re.compile(u'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] + RegExp(u'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]? (?:[Tt]|[ \\t]+)[0-9][0-9]? :[0-9][0-9] :[0-9][0-9] (?:\\.[0-9]*)? @@ -85,13 +86,13 @@ list(u'0123456789')), ([(1, 2), (1, 1)], u'tag:yaml.org,2002:value', - re.compile(u'^(?:=)$'), + RegExp(u'^(?:=)$'), [u'=']), # The following resolver is only for documentation purposes. It cannot work # because plain scalars cannot start with '!', '&', or '*'. ([(1, 2), (1, 1)], u'tag:yaml.org,2002:yaml', - re.compile(u'^(?:!|&|\\*)$'), + RegExp(u'^(?:!|&|\\*)$'), list(u'!&*')), ] @@ -308,14 +309,14 @@ Resolver.add_implicit_resolver_base( u'tag:yaml.org,2002:bool', - re.compile(u'''^(?:yes|Yes|YES|no|No|NO + RegExp(u'''^(?:yes|Yes|YES|no|No|NO |true|True|TRUE|false|False|FALSE |on|On|ON|off|Off|OFF)$''', re.X), list(u'yYnNtTfFoO')) Resolver.add_implicit_resolver_base( u'tag:yaml.org,2002:float', - re.compile(u'''^(?: + RegExp(u'''^(?: [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)? |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+) |\\.[0-9_]+(?:[eE][-+][0-9]+)? @@ -326,7 +327,7 @@ Resolver.add_implicit_resolver_base( u'tag:yaml.org,2002:int', - re.compile(u'''^(?:[-+]?0b[0-1_]+ + RegExp(u'''^(?:[-+]?0b[0-1_]+ |[-+]?0o?[0-7_]+ |[-+]?(?:0|[1-9][0-9_]*) |[-+]?0x[0-9a-fA-F_]+ @@ -335,19 +336,19 @@ Resolver.add_implicit_resolver_base( u'tag:yaml.org,2002:merge', - re.compile(u'^(?:<<)$'), + RegExp(u'^(?:<<)$'), [u'<']) Resolver.add_implicit_resolver_base( u'tag:yaml.org,2002:null', - re.compile(u'''^(?: ~ + RegExp(u'''^(?: ~ |null|Null|NULL | )$''', re.X), [u'~', u'n', u'N', u'']) Resolver.add_implicit_resolver_base( u'tag:yaml.org,2002:timestamp', - re.compile(u'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] + RegExp(u'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]? (?:[Tt]|[ \\t]+)[0-9][0-9]? :[0-9][0-9] :[0-9][0-9] (?:\\.[0-9]*)? @@ -356,14 +357,14 @@ Resolver.add_implicit_resolver_base( u'tag:yaml.org,2002:value', - re.compile(u'^(?:=)$'), + RegExp(u'^(?:=)$'), [u'=']) # The following resolver is only for documentation purposes. It cannot work # because plain scalars cannot start with '!', '&', or '*'. Resolver.add_implicit_resolver_base( u'tag:yaml.org,2002:yaml', - re.compile(u'^(?:!|&|\\*)$'), + RegExp(u'^(?:!|&|\\*)$'), list(u'!&*')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/ruamel.yaml.egg-info/PKG-INFO new/ruamel.yaml-0.15.44/ruamel.yaml.egg-info/PKG-INFO --- old/ruamel.yaml-0.15.37/ruamel.yaml.egg-info/PKG-INFO 2018-03-21 21:27:29.000000000 +0100 +++ new/ruamel.yaml-0.15.44/ruamel.yaml.egg-info/PKG-INFO 2018-07-14 09:43:12.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ruamel.yaml -Version: 0.15.37 +Version: 0.15.44 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,6 +12,13 @@ ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. + :version: 0.15.44 + :updated: 2018-07-14 + :documentation: http://yaml.readthedocs.io + :repository: https://bitbucket.org/ruamel/ + :pypi: https://pypi.org/project/ruamel.yaml/ + + Starting with version 0.15.0 the way YAML files are loaded and dumped is changing. See the API doc for details. Currently existing functionality will throw a warning before being changed/removed. @@ -43,6 +50,53 @@ .. should insert NEXT: at the beginning of line for next key (with empty line) + 0.15.44 (2018-07-14): + - Correct loading plain scalars consisting of numerals only and + starting with `0`, when not explicitly specifying YAML version + 1.1. This also fixes the issue about dumping string `'019'` as + plain scalars as reported by `Min RK + <https://bitbucket.org/minrk/>`__, that prompted this chance. + + 0.15.43 (2018-07-12): + - merge PR33: Python2.7 on Windows is narrow, but has no + ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__) + - ``register_class()`` now returns class (proposed by + `Mike Nerone <https://bitbucket.org/Manganeez/>`__} + + 0.15.42 (2018-07-01): + - fix regression showing only on narrow Python 2.7 (py27mu) builds + (with help from + `Marcel Bargull <https://bitbucket.org/mbargull/>`__ and + `Colm O'Connor <>`__). + - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well as + 3.4/3.5/3.6/3.7/pypy + + 0.15.41 (2018-06-27): + - add detection of C-compile failure (investigation prompted by + `StackOverlow <https://stackoverflow.com/a/51057399/1307905>`__ by + `Emmanuel Blot <https://stackoverflow.com/users/8233409/emmanuel-blot>`__), + which was removed while no longer dependent on ``libyaml``, C-extensions + compilation still needs a compiler though. + + 0.15.40 (2018-06-18): + - added links to landing places as suggested in issue 190 by + `KostisA <https://bitbucket.org/ankostis/>`__ + - fixes issue #201: decoding unicode escaped tags on Python2, reported + by `Dan Abolafia <https://bitbucket.org/danabo/>`__ + + 0.15.39 (2018-06-17): + - merge PR27 improving package startup time (and loading when regexp not + actually used), provided by + `Marcel Bargull <https://bitbucket.org/mbargull/>`__ + + 0.15.38 (2018-06-13): + - fix for losing precision when roundtripping floats by + `Rolf Wojtech <https://bitbucket.org/asomov/>`__ + - fix for hardcoded dir separator not working for Windows by + `Nuno André <https://bitbucket.org/nu_no/>`__ + - typo fix by `Andrey Somov <https://bitbucket.org/asomov/>`__ + 0.15.37 (2018-03-21): - again trying to create installable files for 187 @@ -297,7 +351,6 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/ruamel.yaml.egg-info/SOURCES.txt new/ruamel.yaml-0.15.44/ruamel.yaml.egg-info/SOURCES.txt --- old/ruamel.yaml-0.15.37/ruamel.yaml.egg-info/SOURCES.txt 2018-03-21 21:27:29.000000000 +0100 +++ new/ruamel.yaml-0.15.44/ruamel.yaml.egg-info/SOURCES.txt 2018-07-14 09:43:12.000000000 +0200 @@ -42,7 +42,6 @@ ext/loader.c ext/parser.c ext/reader.c -ext/reader.c.orig ext/scanner.c ext/writer.c ext/yaml.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/scanner.py new/ruamel.yaml-0.15.44/scanner.py --- old/ruamel.yaml-0.15.37/scanner.py 2017-08-14 22:19:47.000000000 +0200 +++ new/ruamel.yaml-0.15.44/scanner.py 2018-06-17 16:13:07.000000000 +0200 @@ -1582,7 +1582,7 @@ if PY3: value = bytes(code_bytes).decode('utf-8') else: - value = unicode(''.join(code_bytes), 'utf-8') # type: ignore + value = unicode(b''.join(code_bytes), 'utf-8') # type: ignore except UnicodeDecodeError as exc: raise ScannerError("while scanning a %s" % name, start_mark, str(exc), mark) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/serializer.py new/ruamel.yaml-0.15.44/serializer.py --- old/ruamel.yaml-0.15.37/serializer.py 2018-03-08 09:00:08.000000000 +0100 +++ new/ruamel.yaml-0.15.44/serializer.py 2018-06-27 10:00:22.000000000 +0200 @@ -2,10 +2,9 @@ from __future__ import absolute_import -import re - from ruamel.yaml.error import YAMLError from ruamel.yaml.compat import nprint, DBG_NODE, dbg, string_types +from ruamel.yaml.util import RegExp from ruamel.yaml.events import ( StreamStartEvent, StreamEndEvent, MappingStartEvent, MappingEndEvent, @@ -31,7 +30,7 @@ # 'id' and 3+ numbers, but not 000 ANCHOR_TEMPLATE = u'id%03d' - ANCHOR_RE = re.compile(u'id(?!000$)\\d{3,}') + ANCHOR_RE = RegExp(u'id(?!000$)\\d{3,}') def __init__(self, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, dumper=None): @@ -117,7 +116,7 @@ try: if node.anchor.always_dump: anchor = node.anchor.value - except: + except: # NOQA pass self.anchors[node] = anchor if isinstance(node, SequenceNode): @@ -132,7 +131,7 @@ # type: (Any) -> Any try: anchor = node.anchor.value - except: + except: # NOQA anchor = None if anchor is None: self.last_anchor_id += 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/setup.py new/ruamel.yaml-0.15.44/setup.py --- old/ruamel.yaml-0.15.37/setup.py 2018-03-21 21:22:55.000000000 +0100 +++ new/ruamel.yaml-0.15.44/setup.py 2018-07-14 09:43:10.000000000 +0200 @@ -8,6 +8,7 @@ import sys import os import datetime +import traceback sys.path = [path for path in sys.path if path not in [os.getcwd(), '']] import platform # NOQA from _ast import * # NOQA @@ -51,6 +52,17 @@ class Set(): pass +if os.environ.get('DVDEBUG', '') == '': + def debug(*args, **kw): + pass +else: + def debug(*args, **kw): + with open(os.environ['DVDEBUG'], 'a') as fp: + kw1 = kw.copy() + kw1['file'] = fp + print('{:%Y-%d-%mT%H:%M:%S}'.format(datetime.datetime.now()), file=fp, end=' ') + print(*args, **kw1) + def literal_eval(node_or_string): """ @@ -696,8 +708,9 @@ @property def ext_modules(self): - """check if all modules specified in the value for 'ext_modules' can be build - that value (if not None) is a list of dicts with 'name', 'src', 'lib' + """ + Check if all modules specified in the value for 'ext_modules' can be build. + That value (if not None) is a list of dicts with 'name', 'src', 'lib' Optional 'test' can be used to make sure trying to compile will work on the host creates and return the external modules as Extensions, unless that @@ -749,9 +762,15 @@ sources=[self.pn(x) for x in target['src']], libraries=[self.pn(x) for x in target.get('lib')], ) - if 'test' not in target: # no test just hope it works + # debug('test in target', 'test' in target, target) + if 'test' not in target: # no test, just hope it works self._ext_modules.append(ext) continue + if sys.version_info[:2] == (3, 4) and platform.system() == 'Windows': + # this is giving problems on appveyor, so skip + if 'FORCE_C_BUILD_TEST' not in os.environ: + self._ext_modules.append(ext) + continue # write a temporary .c file to compile c_code = dedent(target['test']) try: @@ -783,15 +802,19 @@ libraries=ext.libraries, ) except CompileError: + debug('compile error:', file_name) print('compile error:', file_name) continue except LinkError: + debug('libyaml link error', file_name) print('libyaml link error', file_name) continue self._ext_modules.append(ext) except Exception as e: # NOQA + debug('Exception:', e) print('Exception:', e) - pass + if sys.version_info[:2] == (3, 4) and platform.system() == 'Windows': + traceback.print_exc() finally: shutil.rmtree(tmp_dir) return self._ext_modules @@ -814,7 +837,7 @@ fp.write('[bdist_wheel]\nuniversal = 1\n') try: setup(**kw) - except: + except Exception: raise finally: os.remove(file_name) @@ -877,7 +900,7 @@ try: with open('README.rst') as fp: kw['long_description'] = fp.read() - except: + except Exception: pass if nsp.wheel(kw, setup): return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/tokens.py new/ruamel.yaml-0.15.44/tokens.py --- old/ruamel.yaml-0.15.37/tokens.py 2017-08-15 15:52:00.000000000 +0200 +++ new/ruamel.yaml-0.15.44/tokens.py 2018-06-27 10:01:10.000000000 +0200 @@ -26,7 +26,7 @@ if SHOWLINES: try: arguments += u', line: ' + str(self.start_mark.line) - except: + except: # NOQA pass return u'{}({})'.format(self.__class__.__name__, arguments) @@ -259,6 +259,6 @@ if SHOWLINES: try: v += u', line: ' + str(self.start_mark.line) - except: + except: # NOQA pass return 'CommentToken({})'.format(v) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruamel.yaml-0.15.37/util.py new/ruamel.yaml-0.15.44/util.py --- old/ruamel.yaml-0.15.37/util.py 2017-07-18 12:51:19.000000000 +0200 +++ new/ruamel.yaml-0.15.44/util.py 2018-06-16 23:33:51.000000000 +0200 @@ -6,6 +6,9 @@ from __future__ import absolute_import, print_function +from functools import partial +import re + from .compat import text_type, binary_type if False: # MYPY @@ -13,6 +16,36 @@ from .compat import StreamTextType # NOQA +class LazyEval(object): + """ + Lightweight wrapper around lazily evaluated func(*args, **kwargs). + + func is only evaluated when any attribute of its return value is accessed. + Every attribute access is passed through to the wrapped value. + (This only excludes special cases like method-wrappers, e.g., __hash__.) + The sole additional attribute is the lazy_self function which holds the + return value (or, prior to evaluation, func and arguments), in its closure. + """ + def __init__(self, func, *args, **kwargs): + def lazy_self(): + return_value = func(*args, **kwargs) + object.__setattr__(self, "lazy_self", lambda: return_value) + return return_value + object.__setattr__(self, "lazy_self", lazy_self) + + def __getattribute__(self, name): + lazy_self = object.__getattribute__(self, "lazy_self") + if name == "lazy_self": + return lazy_self + return getattr(lazy_self(), name) + + def __setattr__(self, name, value): + setattr(self.lazy_self(), name, value) + + +RegExp = partial(LazyEval, re.compile) + + # originally as comment # https://github.com/pre-commit/pre-commit/pull/211#issuecomment-186466605 # if you use this in your code, I suggest adding a test in your test suite