| | 1142 | |
| | 1143 | {{{ |
| | 1144 | #!python |
| | 1145 | Dumper(stream, |
| | 1146 | default_style=None, |
| | 1147 | default_flow_style=None, |
| | 1148 | canonical=None, |
| | 1149 | indent=None, |
| | 1150 | width=None, |
| | 1151 | allow_unicode=None, |
| | 1152 | line_break=None, |
| | 1153 | encoding=None, |
| | 1154 | explicit_start=None, |
| | 1155 | explicit_end=None, |
| | 1156 | version=None, |
| | 1157 | tags=None) |
| | 1158 | SafeDumper(stream, ...) |
| | 1159 | BaseDumper(stream, ...) |
| | 1160 | }}} |
| | 1161 | |
| | 1162 | '''`BaseDumper`''', '''`SafeDumper`''', and '''`Dumper`''' provide the following interfaces: |
| | 1163 | ''Emitter'', ''Serializer'', ''Representer'', ''Resolver''. |
| | 1164 | |
| | 1165 | '''`Dumper(stream)`''' is the most common of the above classes and should be used in most cases. |
| | 1166 | `stream` is an output YAML stream. It can be an open file or an open Unicode file. |
| | 1167 | |
| | 1168 | '''`Dumper`''' supports all predefined tags and may represent an arbitrary Python object. Therefore |
| | 1169 | it may produce a document that cannot be loaded by other YAML processors. By default, the functions |
| | 1170 | `emit`, `serialize`, `dump`, and others use `Dumper`. |
| | 1171 | |
| | 1172 | '''`SafeDumper(stream)`''' produces only standard YAML tags and thus cannot represent class instances and |
| | 1173 | probably more compatible with other YAML processors. The functions `safe_dump` and `safe_dump_all` |
| | 1174 | use `SafeDumper` to produce a YAML document. |
| | 1175 | |
| | 1176 | '''`BaseDumper(stream)`''' does not support any tags and is useful only for subclassing. |