debputy.yaml.compat

src/debputy/yaml/compat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
__all__ = [
    "YAML",
    "YAMLError",
    "MarkedYAMLError",
    "Node",
    "LineCol",
    "CommentedBase",
    "CommentedMap",
    "CommentedSeq",
]

try:
    from ruyaml import YAML, Node
    from ruyaml.comments import LineCol, CommentedBase, CommentedMap, CommentedSeq
    from ruyaml.error import YAMLError, MarkedYAMLError
except (ImportError, ModuleNotFoundError):
    from ruamel.yaml import YAML, Node  # type: ignore
    from ruamel.yaml.comments import LineCol, CommentedBase, CommentedMap, CommentedSeq  # type: ignore
    from ruamel.yaml.error import YAMLError, MarkedYAMLError  # type: ignore