diff --git a/developer/upgrade_pyyaml.py b/developer/upgrade_pyyaml.py index ffee4f53da..aca1c82c4b 100644 --- a/developer/upgrade_pyyaml.py +++ b/developer/upgrade_pyyaml.py @@ -85,11 +85,11 @@ def remove_pyyaml_folder(self): def copy_new_pyyaml_files(self): print("Copy new pyyaml package files") - source = os.path.join("lib3", "yaml") + source = os.path.join("lib", "yaml") target = os.path.join(self.pyyaml_dir) shutil.copytree(source, target) - for source in ["README", "LICENSE", "CHANGES"]: + for source in ["README.md", "LICENSE", "CHANGES"]: target = os.path.join(self.pyyaml_dir, source) shutil.copy(source, target) diff --git a/python/tank_vendor/yaml/CHANGES b/python/tank_vendor/yaml/CHANGES index 8d647a597c..687dd2bdaa 100644 --- a/python/tank_vendor/yaml/CHANGES +++ b/python/tank_vendor/yaml/CHANGES @@ -2,7 +2,31 @@ For a complete changelog, see: * https://github.com/yaml/pyyaml/commits/ -* https://bitbucket.org/xi/pyyaml/commits/ + +6.0.3 (2025-09-25) + +* https://github.com/yaml/pyyaml/pull/864 -- Support for Python 3.14 and free-threading (experimental) + +6.0.2 (2024-08-06) + +* https://github.com/yaml/pyyaml/pull/808 -- Support for Cython 3.x and Python 3.13 + +6.0.1 (2023-07-18) + +* https://github.com/yaml/pyyaml/pull/702 -- pin Cython build dep to < 3.0 + +6.0 (2021-10-13) + +* https://github.com/yaml/pyyaml/pull/327 -- Change README format to Markdown +* https://github.com/yaml/pyyaml/pull/483 -- Add a test for YAML 1.1 types +* https://github.com/yaml/pyyaml/pull/497 -- fix float resolver to ignore `.` and `._` +* https://github.com/yaml/pyyaml/pull/550 -- drop Python 2.7 +* https://github.com/yaml/pyyaml/pull/553 -- Fix spelling of “hexadecimal” +* https://github.com/yaml/pyyaml/pull/556 -- fix representation of Enum subclasses +* https://github.com/yaml/pyyaml/pull/557 -- fix libyaml extension compiler warnings +* https://github.com/yaml/pyyaml/pull/560 -- fix ResourceWarning on leaked file descriptors +* https://github.com/yaml/pyyaml/pull/561 -- always require `Loader` arg to `yaml.load()` +* https://github.com/yaml/pyyaml/pull/564 -- remove remaining direct distutils usage 5.4.1 (2021-01-20) diff --git a/python/tank_vendor/yaml/README b/python/tank_vendor/yaml/README deleted file mode 100644 index 49c87e7642..0000000000 --- a/python/tank_vendor/yaml/README +++ /dev/null @@ -1,43 +0,0 @@ -PyYAML - The next generation YAML parser and emitter for Python. - -To install, type 'python setup.py install'. - -By default, the setup.py script checks whether LibYAML is installed -and if so, builds and installs LibYAML bindings. To skip the check -and force installation of LibYAML bindings, use the option '--with-libyaml': -'python setup.py --with-libyaml install'. To disable the check and -skip building and installing LibYAML bindings, use '--without-libyaml': -'python setup.py --without-libyaml install'. - -When LibYAML bindings are installed, you may use fast LibYAML-based -parser and emitter as follows: - - >>> yaml.load(stream, Loader=yaml.CLoader) - >>> yaml.dump(data, Dumper=yaml.CDumper) - -If you don't trust the input stream, you should use: - - >>> yaml.safe_load(stream) - -PyYAML includes a comprehensive test suite. To run the tests, -type 'python setup.py test'. - -For more information, check the PyYAML homepage: -'https://github.com/yaml/pyyaml'. - -For PyYAML tutorial and reference, see: -'http://pyyaml.org/wiki/PyYAMLDocumentation'. - -Discuss PyYAML with the maintainers in IRC #pyyaml irc.freenode.net. - -You may also use the YAML-Core mailing list: -'http://lists.sourceforge.net/lists/listinfo/yaml-core'. - -Submit bug reports and feature requests to the PyYAML bug tracker: -'https://github.com/yaml/pyyaml/issues'. - -The PyYAML module was written by Kirill Simonov . -It is currently maintained by the YAML and Python communities. - -PyYAML is released under the MIT license. -See the file LICENSE for more details. diff --git a/python/tank_vendor/yaml/README.md b/python/tank_vendor/yaml/README.md new file mode 100644 index 0000000000..7d01da248f --- /dev/null +++ b/python/tank_vendor/yaml/README.md @@ -0,0 +1,53 @@ +PyYAML +====== + +A full-featured YAML processing framework for Python + +## Installation + +To install, type `python setup.py install`. + +By default, the `setup.py` script checks whether LibYAML is installed and if +so, builds and installs LibYAML bindings. +To skip the check and force installation of LibYAML bindings, use the option +`--with-libyaml`: `python setup.py --with-libyaml install`. +To disable the check and skip building and installing LibYAML bindings, use +`--without-libyaml`: `python setup.py --without-libyaml install`. + +When LibYAML bindings are installed, you may use fast LibYAML-based parser and +emitter as follows: + + >>> yaml.load(stream, Loader=yaml.CLoader) + >>> yaml.dump(data, Dumper=yaml.CDumper) + +If you don't trust the input YAML stream, you should use: + + >>> yaml.safe_load(stream) + +## Testing + +PyYAML includes a comprehensive test suite. +To run the tests, type `python setup.py test`. + +## Further Information + +* For more information, check the + [PyYAML homepage](https://github.com/yaml/pyyaml). + +* [PyYAML tutorial and reference](http://pyyaml.org/wiki/PyYAMLDocumentation). + +* Discuss PyYAML with the maintainers on + Matrix at https://matrix.to/#/#pyyaml:yaml.io or + IRC #pyyaml irc.libera.chat + +* Submit bug reports and feature requests to the + [PyYAML bug tracker](https://github.com/yaml/pyyaml/issues). + +## License + +The PyYAML module was written by Kirill Simonov . +It is currently maintained by the YAML and Python communities. + +PyYAML is released under the MIT license. + +See the file LICENSE for more details. diff --git a/python/tank_vendor/yaml/__init__.py b/python/tank_vendor/yaml/__init__.py index 86d07b5525..d58f089173 100644 --- a/python/tank_vendor/yaml/__init__.py +++ b/python/tank_vendor/yaml/__init__.py @@ -8,7 +8,7 @@ from .loader import * from .dumper import * -__version__ = '5.4.1' +__version__ = '6.0.3' try: from .cyaml import * __with_libyaml__ = True @@ -18,41 +18,12 @@ import io #------------------------------------------------------------------------------ -# Warnings control +# XXX "Warnings control" is now deprecated. Leaving in the API function to not +# break code that uses it. #------------------------------------------------------------------------------ - -# 'Global' warnings state: -_warnings_enabled = { - 'YAMLLoadWarning': True, -} - -# Get or set global warnings' state def warnings(settings=None): if settings is None: - return _warnings_enabled - - if type(settings) is dict: - for key in settings: - if key in _warnings_enabled: - _warnings_enabled[key] = settings[key] - -# Warn when load() is called without Loader=... -class YAMLLoadWarning(RuntimeWarning): - pass - -def load_warning(method): - if _warnings_enabled['YAMLLoadWarning'] is False: - return - - import warnings - - message = ( - "calling yaml.%s() without Loader=... is deprecated, as the " - "default Loader is unsafe. Please read " - "https://msg.pyyaml.org/load for full details." - ) % method - - warnings.warn(message, YAMLLoadWarning, stacklevel=3) + return {} #------------------------------------------------------------------------------ def scan(stream, Loader=Loader): @@ -100,30 +71,22 @@ def compose_all(stream, Loader=Loader): finally: loader.dispose() -def load(stream, Loader=None): +def load(stream, Loader): """ Parse the first YAML document in a stream and produce the corresponding Python object. """ - if Loader is None: - load_warning('load') - Loader = FullLoader - loader = Loader(stream) try: return loader.get_single_data() finally: loader.dispose() -def load_all(stream, Loader=None): +def load_all(stream, Loader): """ Parse all YAML documents in a stream and produce corresponding Python objects. """ - if Loader is None: - load_warning('load_all') - Loader = FullLoader - loader = Loader(stream) try: while loader.check_data(): diff --git a/python/tank_vendor/yaml/representer.py b/python/tank_vendor/yaml/representer.py index 3b0b192ef3..808ca06dfb 100644 --- a/python/tank_vendor/yaml/representer.py +++ b/python/tank_vendor/yaml/representer.py @@ -369,7 +369,7 @@ def represent_ordered_dict(self, data): Representer.add_representer(tuple, Representer.represent_tuple) -Representer.add_representer(type, +Representer.add_multi_representer(type, Representer.represent_name) Representer.add_representer(collections.OrderedDict, diff --git a/python/tank_vendor/yaml/resolver.py b/python/tank_vendor/yaml/resolver.py index 013896d2f1..3522bdaaf6 100644 --- a/python/tank_vendor/yaml/resolver.py +++ b/python/tank_vendor/yaml/resolver.py @@ -177,7 +177,7 @@ class Resolver(BaseResolver): Resolver.add_implicit_resolver( 'tag:yaml.org,2002:float', re.compile(r'''^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)? - |\.[0-9_]+(?:[eE][-+][0-9]+)? + |\.[0-9][0-9_]*(?:[eE][-+][0-9]+)? |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]* |[-+]?\.(?:inf|Inf|INF) |\.(?:nan|NaN|NAN))$''', re.X), diff --git a/python/tank_vendor/yaml/scanner.py b/python/tank_vendor/yaml/scanner.py index 7437ede1c6..de925b07f1 100644 --- a/python/tank_vendor/yaml/scanner.py +++ b/python/tank_vendor/yaml/scanner.py @@ -1211,7 +1211,7 @@ def scan_flow_scalar_non_spaces(self, double, start_mark): for k in range(length): if self.peek(k) not in '0123456789ABCDEFabcdef': raise ScannerError("while scanning a double-quoted scalar", start_mark, - "expected escape sequence of %d hexdecimal numbers, but found %r" % + "expected escape sequence of %d hexadecimal numbers, but found %r" % (length, self.peek(k)), self.get_mark()) code = int(self.prefix(length), 16) chunks.append(chr(code)) @@ -1403,7 +1403,7 @@ def scan_uri_escapes(self, name, start_mark): for k in range(2): if self.peek(k) not in '0123456789ABCDEFabcdef': raise ScannerError("while scanning a %s" % name, start_mark, - "expected URI escape sequence of 2 hexdecimal numbers, but found %r" + "expected URI escape sequence of 2 hexadecimal numbers, but found %r" % self.peek(k), self.get_mark()) codes.append(int(self.prefix(2), 16)) self.forward(2)