comparison env/lib/python3.7/site-packages/ruamel/yaml/loader.py @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:26e78fe6e8c4
1 # coding: utf-8
2
3 from __future__ import absolute_import
4
5
6 from ruamel.yaml.reader import Reader
7 from ruamel.yaml.scanner import Scanner, RoundTripScanner
8 from ruamel.yaml.parser import Parser, RoundTripParser
9 from ruamel.yaml.composer import Composer
10 from ruamel.yaml.constructor import (
11 BaseConstructor,
12 SafeConstructor,
13 Constructor,
14 RoundTripConstructor,
15 )
16 from ruamel.yaml.resolver import VersionedResolver
17
18 if False: # MYPY
19 from typing import Any, Dict, List, Union, Optional # NOQA
20 from ruamel.yaml.compat import StreamTextType, VersionType # NOQA
21
22 __all__ = ['BaseLoader', 'SafeLoader', 'Loader', 'RoundTripLoader']
23
24
25 class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, VersionedResolver):
26 def __init__(self, stream, version=None, preserve_quotes=None):
27 # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None
28 Reader.__init__(self, stream, loader=self)
29 Scanner.__init__(self, loader=self)
30 Parser.__init__(self, loader=self)
31 Composer.__init__(self, loader=self)
32 BaseConstructor.__init__(self, loader=self)
33 VersionedResolver.__init__(self, version, loader=self)
34
35
36 class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, VersionedResolver):
37 def __init__(self, stream, version=None, preserve_quotes=None):
38 # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None
39 Reader.__init__(self, stream, loader=self)
40 Scanner.__init__(self, loader=self)
41 Parser.__init__(self, loader=self)
42 Composer.__init__(self, loader=self)
43 SafeConstructor.__init__(self, loader=self)
44 VersionedResolver.__init__(self, version, loader=self)
45
46
47 class Loader(Reader, Scanner, Parser, Composer, Constructor, VersionedResolver):
48 def __init__(self, stream, version=None, preserve_quotes=None):
49 # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None
50 Reader.__init__(self, stream, loader=self)
51 Scanner.__init__(self, loader=self)
52 Parser.__init__(self, loader=self)
53 Composer.__init__(self, loader=self)
54 Constructor.__init__(self, loader=self)
55 VersionedResolver.__init__(self, version, loader=self)
56
57
58 class RoundTripLoader(
59 Reader,
60 RoundTripScanner,
61 RoundTripParser,
62 Composer,
63 RoundTripConstructor,
64 VersionedResolver,
65 ):
66 def __init__(self, stream, version=None, preserve_quotes=None):
67 # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None
68 # self.reader = Reader.__init__(self, stream)
69 Reader.__init__(self, stream, loader=self)
70 RoundTripScanner.__init__(self, loader=self)
71 RoundTripParser.__init__(self, loader=self)
72 Composer.__init__(self, loader=self)
73 RoundTripConstructor.__init__(self, preserve_quotes=preserve_quotes, loader=self)
74 VersionedResolver.__init__(self, version, loader=self)