comparison env/lib/python3.9/site-packages/_yaml/__init__.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 # This is a stub package designed to roughly emulate the _yaml
2 # extension module, which previously existed as a standalone module
3 # and has been moved into the `yaml` package namespace.
4 # It does not perfectly mimic its old counterpart, but should get
5 # close enough for anyone who's relying on it even when they shouldn't.
6 import yaml
7
8 # in some circumstances, the yaml module we imoprted may be from a different version, so we need
9 # to tread carefully when poking at it here (it may not have the attributes we expect)
10 if not getattr(yaml, '__with_libyaml__', False):
11 from sys import version_info
12
13 exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
14 raise exc("No module named '_yaml'")
15 else:
16 from yaml._yaml import *
17 import warnings
18 warnings.warn(
19 'The _yaml extension module is now located at yaml._yaml'
20 ' and its location is subject to change. To use the'
21 ' LibYAML-based parser and emitter, import from `yaml`:'
22 ' `from yaml import CLoader as Loader, CDumper as Dumper`.',
23 DeprecationWarning
24 )
25 del warnings
26 # Don't `del yaml` here because yaml is actually an existing
27 # namespace member of _yaml.
28
29 __name__ = '_yaml'
30 # If the module is top-level (i.e. not a part of any specific package)
31 # then the attribute should be set to ''.
32 # https://docs.python.org/3.8/library/types.html
33 __package__ = ''