Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/ruamel/yaml/cyaml.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author | shellac |
---|---|
date | Mon, 01 Jun 2020 08:59:25 -0400 |
parents | 79f47841a781 |
children |
comparison
equal
deleted
inserted
replaced
4:79f47841a781 | 5:9b1c78e6ba9c |
---|---|
1 # coding: utf-8 | |
2 | |
3 from __future__ import absolute_import | |
4 | |
5 from _ruamel_yaml import CParser, CEmitter # type: ignore | |
6 | |
7 from ruamel.yaml.constructor import Constructor, BaseConstructor, SafeConstructor | |
8 from ruamel.yaml.representer import Representer, SafeRepresenter, BaseRepresenter | |
9 from ruamel.yaml.resolver import Resolver, BaseResolver | |
10 | |
11 if False: # MYPY | |
12 from typing import Any, Union, Optional # NOQA | |
13 from ruamel.yaml.compat import StreamTextType, StreamType, VersionType # NOQA | |
14 | |
15 __all__ = ['CBaseLoader', 'CSafeLoader', 'CLoader', 'CBaseDumper', 'CSafeDumper', 'CDumper'] | |
16 | |
17 | |
18 # this includes some hacks to solve the usage of resolver by lower level | |
19 # parts of the parser | |
20 | |
21 | |
22 class CBaseLoader(CParser, BaseConstructor, BaseResolver): # type: ignore | |
23 def __init__(self, stream, version=None, preserve_quotes=None): | |
24 # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None | |
25 CParser.__init__(self, stream) | |
26 self._parser = self._composer = self | |
27 BaseConstructor.__init__(self, loader=self) | |
28 BaseResolver.__init__(self, loadumper=self) | |
29 # self.descend_resolver = self._resolver.descend_resolver | |
30 # self.ascend_resolver = self._resolver.ascend_resolver | |
31 # self.resolve = self._resolver.resolve | |
32 | |
33 | |
34 class CSafeLoader(CParser, SafeConstructor, Resolver): # type: ignore | |
35 def __init__(self, stream, version=None, preserve_quotes=None): | |
36 # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None | |
37 CParser.__init__(self, stream) | |
38 self._parser = self._composer = self | |
39 SafeConstructor.__init__(self, loader=self) | |
40 Resolver.__init__(self, loadumper=self) | |
41 # self.descend_resolver = self._resolver.descend_resolver | |
42 # self.ascend_resolver = self._resolver.ascend_resolver | |
43 # self.resolve = self._resolver.resolve | |
44 | |
45 | |
46 class CLoader(CParser, Constructor, Resolver): # type: ignore | |
47 def __init__(self, stream, version=None, preserve_quotes=None): | |
48 # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None | |
49 CParser.__init__(self, stream) | |
50 self._parser = self._composer = self | |
51 Constructor.__init__(self, loader=self) | |
52 Resolver.__init__(self, loadumper=self) | |
53 # self.descend_resolver = self._resolver.descend_resolver | |
54 # self.ascend_resolver = self._resolver.ascend_resolver | |
55 # self.resolve = self._resolver.resolve | |
56 | |
57 | |
58 class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): # type: ignore | |
59 def __init__( | |
60 self, | |
61 stream, | |
62 default_style=None, | |
63 default_flow_style=None, | |
64 canonical=None, | |
65 indent=None, | |
66 width=None, | |
67 allow_unicode=None, | |
68 line_break=None, | |
69 encoding=None, | |
70 explicit_start=None, | |
71 explicit_end=None, | |
72 version=None, | |
73 tags=None, | |
74 block_seq_indent=None, | |
75 top_level_colon_align=None, | |
76 prefix_colon=None, | |
77 ): | |
78 # type: (StreamType, Any, Any, Any, Optional[bool], Optional[int], Optional[int], Optional[bool], Any, Any, Optional[bool], Optional[bool], Any, Any, Any, Any, Any) -> None # NOQA | |
79 CEmitter.__init__( | |
80 self, | |
81 stream, | |
82 canonical=canonical, | |
83 indent=indent, | |
84 width=width, | |
85 encoding=encoding, | |
86 allow_unicode=allow_unicode, | |
87 line_break=line_break, | |
88 explicit_start=explicit_start, | |
89 explicit_end=explicit_end, | |
90 version=version, | |
91 tags=tags, | |
92 ) | |
93 self._emitter = self._serializer = self._representer = self | |
94 BaseRepresenter.__init__( | |
95 self, | |
96 default_style=default_style, | |
97 default_flow_style=default_flow_style, | |
98 dumper=self, | |
99 ) | |
100 BaseResolver.__init__(self, loadumper=self) | |
101 | |
102 | |
103 class CSafeDumper(CEmitter, SafeRepresenter, Resolver): # type: ignore | |
104 def __init__( | |
105 self, | |
106 stream, | |
107 default_style=None, | |
108 default_flow_style=None, | |
109 canonical=None, | |
110 indent=None, | |
111 width=None, | |
112 allow_unicode=None, | |
113 line_break=None, | |
114 encoding=None, | |
115 explicit_start=None, | |
116 explicit_end=None, | |
117 version=None, | |
118 tags=None, | |
119 block_seq_indent=None, | |
120 top_level_colon_align=None, | |
121 prefix_colon=None, | |
122 ): | |
123 # type: (StreamType, Any, Any, Any, Optional[bool], Optional[int], Optional[int], Optional[bool], Any, Any, Optional[bool], Optional[bool], Any, Any, Any, Any, Any) -> None # NOQA | |
124 self._emitter = self._serializer = self._representer = self | |
125 CEmitter.__init__( | |
126 self, | |
127 stream, | |
128 canonical=canonical, | |
129 indent=indent, | |
130 width=width, | |
131 encoding=encoding, | |
132 allow_unicode=allow_unicode, | |
133 line_break=line_break, | |
134 explicit_start=explicit_start, | |
135 explicit_end=explicit_end, | |
136 version=version, | |
137 tags=tags, | |
138 ) | |
139 self._emitter = self._serializer = self._representer = self | |
140 SafeRepresenter.__init__( | |
141 self, default_style=default_style, default_flow_style=default_flow_style | |
142 ) | |
143 Resolver.__init__(self) | |
144 | |
145 | |
146 class CDumper(CEmitter, Representer, Resolver): # type: ignore | |
147 def __init__( | |
148 self, | |
149 stream, | |
150 default_style=None, | |
151 default_flow_style=None, | |
152 canonical=None, | |
153 indent=None, | |
154 width=None, | |
155 allow_unicode=None, | |
156 line_break=None, | |
157 encoding=None, | |
158 explicit_start=None, | |
159 explicit_end=None, | |
160 version=None, | |
161 tags=None, | |
162 block_seq_indent=None, | |
163 top_level_colon_align=None, | |
164 prefix_colon=None, | |
165 ): | |
166 # type: (StreamType, Any, Any, Any, Optional[bool], Optional[int], Optional[int], Optional[bool], Any, Any, Optional[bool], Optional[bool], Any, Any, Any, Any, Any) -> None # NOQA | |
167 CEmitter.__init__( | |
168 self, | |
169 stream, | |
170 canonical=canonical, | |
171 indent=indent, | |
172 width=width, | |
173 encoding=encoding, | |
174 allow_unicode=allow_unicode, | |
175 line_break=line_break, | |
176 explicit_start=explicit_start, | |
177 explicit_end=explicit_end, | |
178 version=version, | |
179 tags=tags, | |
180 ) | |
181 self._emitter = self._serializer = self._representer = self | |
182 Representer.__init__( | |
183 self, default_style=default_style, default_flow_style=default_flow_style | |
184 ) | |
185 Resolver.__init__(self) |