1
      00000069
  C   ˆl–äY>”êa,j€và…q–ÔÅ£�þBd
ÍÈëàŒO¸&ˆçÃ„qÖÙwÂ_ŠI|¥�+Wé3ž¯ÂÁ  5   ˆl–ß=¿Jõ4Ÿº‚ œP.\·˜´o�þB g Ùm–D7óÅƒh¹ÄÃÂ ?÷     # coding: utf-8

# Emitter expects events obeying the following grammar:
# stream ::= STREAM-START document* STREAM-END
# document ::= DOCUMENT-START node DOCUMENT-END
# node ::= SCALAR | sequence | mapping
# sequence ::= SEQUENCE-START node* SEQUENCE-END
# mapping ::= MAPPING-START (node node)* MAPPING-END

import sys
from ruamel.yaml.error import YAMLError, YAMLStreamError
from ruamel.yaml.events import *  # NOQA

# fmt: off
from ruamel.yaml.compat import _F, nprint, dbg, DBG_EVENT, \
    check_anchorname_char, nprintf  # NOQA
# fmt: on

if False:  # MYPY
    from typing import Any, Dict, List, Union, Text, Tuple, Optional  # NOQA
    from ruamel.yaml.compat import StreamType  # NOQA

__all__ = ['Emitter', 'EmitterError']


class EmitterError(YAMLError):
    pass


class ScalarAnalysis:
    def __init__(
        self,
        scalar,
        empty,
        multiline,
        allow_flow_plain,
        allow_block_plain,
        allow_single_quoted,
        allow_double_quoted,
        allow_block,
    ):
        # type: (Any, Any, Any, bool, bool, bool, bool, bool) -> None
        self.scalar = scalar
        self.empty = empty
        self.multiline = multiline
        self.allow_flow_plain = allow_flow_plain
        self.allow_block_plain = allow_block_plain
        self.allow_single_quoted = allow_single_quoted
        self.allow_double_quoted = allow_double_quoted
        self.allow_block = allow_block


class Indents:
    # replacement for the list based stack of None/int
    def __init__(self):
        # type: () -> None
        self.values = []  # type: List[Tuple[Any, bool]]

    def append(self, val, seq):
        # type: (Any, Any) -> None
        self.values.append((val, seq))

    def pop(self):
        # type: () -> Any
        return self.values.pop()[0]

    def last_seq(self):
        # type: () -> bool
        # return the seq(uence) value for the element added before the last one
        # in increase_indent()
        try:
            return self.values[-2][1]
        except IndexError:
            return False

    def seq_flow_align(self, seq_indent, column, pre_comment=False):
        # type: (int, int, Optional[bool]) -> int
        # extra spaces because of dash
        # nprint('seq_flow_align', self.values, pre_comment)
        if len(self.values) < 2 or not self.values[-1][1]:
            if len(self.values) == 0 or not pre_comment:
                return 0
        base = self.values[-1][0] if self.values[-1][0] is not None else 0
        if pre_comment:
            return base + seq_indent  # type: ignore
            # return (len(self.values)) * seq_indent
        # -1 for the dash
        return base + seq_indent - column - 1  # type: ignore

    def __len__(self):
        # type: () -> int
        return len(self.values)


class Emitter:
    # fmt: off
    DEFAULT_TAG_PREFIXES = {
        '!': '!',
        'tag:yaml.org,2002:': '!!',
    }
    # fmt: on

    MAX_SIMPLE_KEY_LENGTH = 128

    def __init__(
        self,
        stream,
        canonical=None,
        indent=None,
        width=None,
        allow_unicode=None,
        line_break=None,
        block_seq_indent=None,
        top_level_colon_align=None,
        prefix_colon=None,
        brace_single_entry_mapping_in_flow_sequence=None,
        dumper=None,
    ):
        # type: (StreamType, Any, Optional[int], Optional[int], Optional[bool], Any, Optional[int], Optional[bool], Any, Optional[bool], Any) -> None  # NOQA
        self.dumper = dumper
        if self.dumper is not None and getattr(self.dumper, '_emitter', None) is None:
            self.dumper._emitter = self
        self.stream = stream

        # Encoding can be overriden by STREAM-START.
        self.encoding = None  # type: Optional[Text]
        self.allow_space_break = None

        # Emitter is a state machine with a stack of states to handle nested
        # structures.
        self.states = []