From 004563465b23a86e8351fe51ad8194a7ddd16d66 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 19 Jan 2023 16:14:25 +0100 Subject: build: Update PyYAML to 5.4.1 --- yaml/LICENSE | 2 +- yaml/PKG-INFO | 14 ++++++++++---- yaml/lib/yaml/__init__.py | 2 +- yaml/lib/yaml/constructor.py | 30 ++++++++++++++++++------------ yaml/lib/yaml/cyaml.py | 2 +- yaml/lib/yaml/reader.py | 9 +++++++-- yaml/lib/yaml/resolver.py | 4 ++-- yaml/lib3/yaml/__init__.py | 2 +- yaml/lib3/yaml/constructor.py | 24 ++++++++++++------------ yaml/lib3/yaml/cyaml.py | 2 +- yaml/lib3/yaml/resolver.py | 4 ++-- 11 files changed, 56 insertions(+), 39 deletions(-) (limited to 'yaml') diff --git a/yaml/LICENSE b/yaml/LICENSE index 3d82c281ee..2f1b8e15e5 100644 --- a/yaml/LICENSE +++ b/yaml/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017-2020 Ingy döt Net +Copyright (c) 2017-2021 Ingy döt Net Copyright (c) 2006-2016 Kirill Simonov Permission is hereby granted, free of charge, to any person obtaining a copy of diff --git a/yaml/PKG-INFO b/yaml/PKG-INFO index bf47ef4b35..04d0abf6e5 100644 --- a/yaml/PKG-INFO +++ b/yaml/PKG-INFO @@ -1,12 +1,17 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: PyYAML -Version: 5.3.1 +Version: 5.4.1 Summary: YAML parser and emitter for Python -Home-page: https://github.com/yaml/pyyaml +Home-page: https://pyyaml.org/ Author: Kirill Simonov Author-email: xi@resolvent.net License: MIT Download-URL: https://pypi.org/project/PyYAML/ +Project-URL: Bug Tracker, https://github.com/yaml/pyyaml/issues +Project-URL: CI, https://github.com/yaml/pyyaml/actions +Project-URL: Documentation, https://pyyaml.org/wiki/PyYAMLDocumentation +Project-URL: Mailing lists, http://lists.sourceforge.net/lists/listinfo/yaml-core +Project-URL: Source Code, https://github.com/yaml/pyyaml Description: YAML is a data serialization format designed for human readability and interaction with scripting languages. PyYAML is a YAML parser and emitter for Python. @@ -28,11 +33,12 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Text Processing :: Markup +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.* diff --git a/yaml/lib/yaml/__init__.py b/yaml/lib/yaml/__init__.py index 211fc8665e..3c988198d5 100644 --- a/yaml/lib/yaml/__init__.py +++ b/yaml/lib/yaml/__init__.py @@ -8,7 +8,7 @@ from nodes import * from loader import * from dumper import * -__version__ = '5.3.1' +__version__ = '5.4.1' try: from cyaml import * diff --git a/yaml/lib/yaml/constructor.py b/yaml/lib/yaml/constructor.py index 794681cb7f..ff4e36828e 100644 --- a/yaml/lib/yaml/constructor.py +++ b/yaml/lib/yaml/constructor.py @@ -38,6 +38,12 @@ class timezone(datetime.tzinfo): def dst(self, dt=None): return datetime.timedelta(0) + def __copy__(self): + return self.__deepcopy__() + + def __deepcopy__(self, memodict={}): + return self.__class__(self.utcoffset()) + __repr__ = __str__ = tzname @@ -722,18 +728,6 @@ FullConstructor.add_multi_constructor( u'tag:yaml.org,2002:python/name:', FullConstructor.construct_python_name) -FullConstructor.add_multi_constructor( - u'tag:yaml.org,2002:python/module:', - FullConstructor.construct_python_module) - -FullConstructor.add_multi_constructor( - u'tag:yaml.org,2002:python/object:', - FullConstructor.construct_python_object) - -FullConstructor.add_multi_constructor( - u'tag:yaml.org,2002:python/object/new:', - FullConstructor.construct_python_object_new) - class UnsafeConstructor(FullConstructor): def find_python_module(self, name, mark): @@ -750,6 +744,18 @@ class UnsafeConstructor(FullConstructor): return super(UnsafeConstructor, self).set_python_instance_state( instance, state, unsafe=True) +UnsafeConstructor.add_multi_constructor( + u'tag:yaml.org,2002:python/module:', + UnsafeConstructor.construct_python_module) + +UnsafeConstructor.add_multi_constructor( + u'tag:yaml.org,2002:python/object:', + UnsafeConstructor.construct_python_object) + +UnsafeConstructor.add_multi_constructor( + u'tag:yaml.org,2002:python/object/new:', + UnsafeConstructor.construct_python_object_new) + UnsafeConstructor.add_multi_constructor( u'tag:yaml.org,2002:python/object/apply:', UnsafeConstructor.construct_python_object_apply) diff --git a/yaml/lib/yaml/cyaml.py b/yaml/lib/yaml/cyaml.py index ebb8959352..768b49d6b9 100644 --- a/yaml/lib/yaml/cyaml.py +++ b/yaml/lib/yaml/cyaml.py @@ -4,7 +4,7 @@ __all__ = [ 'CBaseDumper', 'CSafeDumper', 'CDumper' ] -from _yaml import CParser, CEmitter +from yaml._yaml import CParser, CEmitter from constructor import * diff --git a/yaml/lib/yaml/reader.py b/yaml/lib/yaml/reader.py index 4b377d61e2..4c42150989 100644 --- a/yaml/lib/yaml/reader.py +++ b/yaml/lib/yaml/reader.py @@ -137,9 +137,14 @@ class Reader(object): self.update(1) if has_ucs4: - NON_PRINTABLE = re.compile(u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD\U00010000-\U0010ffff]') + NON_PRINTABLE = u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD\U00010000-\U0010ffff]' + elif sys.platform.startswith('java'): + # Jython doesn't support lone surrogates https://bugs.jython.org/issue2048 + NON_PRINTABLE = u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]' else: - NON_PRINTABLE = re.compile(u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uFFFD]|(?:^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF](?:[^\uDC00-\uDFFF]|$)') + # Need to use eval here due to the above Jython issue + NON_PRINTABLE = eval(r"u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uFFFD]|(?:^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF](?:[^\uDC00-\uDFFF]|$)'") + NON_PRINTABLE = re.compile(NON_PRINTABLE) def check_printable(self, data): match = self.NON_PRINTABLE.search(data) if match: diff --git a/yaml/lib/yaml/resolver.py b/yaml/lib/yaml/resolver.py index 528fbc0ead..ba9aeab21d 100644 --- a/yaml/lib/yaml/resolver.py +++ b/yaml/lib/yaml/resolver.py @@ -146,8 +146,8 @@ class BaseResolver(object): resolvers = self.yaml_implicit_resolvers.get(u'', []) else: resolvers = self.yaml_implicit_resolvers.get(value[0], []) - resolvers += self.yaml_implicit_resolvers.get(None, []) - for tag, regexp in resolvers: + wildcard_resolvers = self.yaml_implicit_resolvers.get(None, []) + for tag, regexp in resolvers + wildcard_resolvers: if regexp.match(value): return tag implicit = implicit[1] diff --git a/yaml/lib3/yaml/__init__.py b/yaml/lib3/yaml/__init__.py index 13d687c501..86d07b5525 100644 --- a/yaml/lib3/yaml/__init__.py +++ b/yaml/lib3/yaml/__init__.py @@ -8,7 +8,7 @@ from .nodes import * from .loader import * from .dumper import * -__version__ = '5.3.1' +__version__ = '5.4.1' try: from .cyaml import * __with_libyaml__ = True diff --git a/yaml/lib3/yaml/constructor.py b/yaml/lib3/yaml/constructor.py index 1948b125c2..619acd3070 100644 --- a/yaml/lib3/yaml/constructor.py +++ b/yaml/lib3/yaml/constructor.py @@ -710,18 +710,6 @@ FullConstructor.add_multi_constructor( 'tag:yaml.org,2002:python/name:', FullConstructor.construct_python_name) -FullConstructor.add_multi_constructor( - 'tag:yaml.org,2002:python/module:', - FullConstructor.construct_python_module) - -FullConstructor.add_multi_constructor( - 'tag:yaml.org,2002:python/object:', - FullConstructor.construct_python_object) - -FullConstructor.add_multi_constructor( - 'tag:yaml.org,2002:python/object/new:', - FullConstructor.construct_python_object_new) - class UnsafeConstructor(FullConstructor): def find_python_module(self, name, mark): @@ -738,6 +726,18 @@ class UnsafeConstructor(FullConstructor): return super(UnsafeConstructor, self).set_python_instance_state( instance, state, unsafe=True) +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/module:', + UnsafeConstructor.construct_python_module) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object:', + UnsafeConstructor.construct_python_object) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object/new:', + UnsafeConstructor.construct_python_object_new) + UnsafeConstructor.add_multi_constructor( 'tag:yaml.org,2002:python/object/apply:', UnsafeConstructor.construct_python_object_apply) diff --git a/yaml/lib3/yaml/cyaml.py b/yaml/lib3/yaml/cyaml.py index 1e606c74b9..0c21345879 100644 --- a/yaml/lib3/yaml/cyaml.py +++ b/yaml/lib3/yaml/cyaml.py @@ -4,7 +4,7 @@ __all__ = [ 'CBaseDumper', 'CSafeDumper', 'CDumper' ] -from _yaml import CParser, CEmitter +from yaml._yaml import CParser, CEmitter from .constructor import * diff --git a/yaml/lib3/yaml/resolver.py b/yaml/lib3/yaml/resolver.py index 02b82e73ee..013896d2f1 100644 --- a/yaml/lib3/yaml/resolver.py +++ b/yaml/lib3/yaml/resolver.py @@ -146,8 +146,8 @@ class BaseResolver: resolvers = self.yaml_implicit_resolvers.get('', []) else: resolvers = self.yaml_implicit_resolvers.get(value[0], []) - resolvers += self.yaml_implicit_resolvers.get(None, []) - for tag, regexp in resolvers: + wildcard_resolvers = self.yaml_implicit_resolvers.get(None, []) + for tag, regexp in resolvers + wildcard_resolvers: if regexp.match(value): return tag implicit = implicit[1] -- cgit v1.2.3