_DEFAULT_YAML_VERSION = (1, 2)
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
    MAXSIZE = sys.maxsize
UNICODE_SIZE = 4 if sys.maxunicode > 65535 else 2
DBG_TOKEN = 1
DBG_EVENT = 2
DBG_NODE = 4
class ordereddict(OrderedDict):  # type: ignore
    class ObjectCounter(object):
class Nprint(object):
class MutableSliceableSequence(MutableSequence):  # type: ignore
        def insert(self, pos, key, value):
    def utf8(s):
    def to_str(s):
    def to_unicode(s):
    def utf8(s):
    def to_str(s):
    def to_unicode(s):
def with_metaclass(meta, *bases):
        def __init__(self):
        def __call__(self, k):
        def dump(self):
def dbg(val=None):
    def __init__(self, file_name=None):
    def __call__(self, *args, **kw):
    def set_max_print(self, i):
def check_namespace_char(ch):
def check_anchorname_char(ch):
def version_tnf(t1, t2=None):
    def __getitem__(self, index):
    def __setitem__(self, index, value):
    def __delitem__(self, index):
    def __getsingleitem__(self, index):
    def __setsingleitem__(self, index, value):
    def __delsingleitem__(self, index): class ordereddict(OrderedDict):  # type: ignore
    if not hasattr(OrderedDict, "insert"):

        def insert(self, pos, key, value):
            # type: (int, Any, Any) -> None
            if pos >= len(self):
                self[key] = value
                return
            od = ordereddict()
            od.update(self)
            for k in od:
                del self[k]
            for index, old_key in enumerate(od):
                if pos == index:
                    self[key] = value
                self[old_key] = od[old_key] _DEFAULT_YAML_VERSION = (1, 2)
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
    MAXSIZE = sys.maxsize
UNICODE_SIZE = 4 if sys.maxunicode > 65535 else 2
DBG_TOKEN = 1
DBG_EVENT = 2
DBG_NODE = 4
class ordereddict(OrderedDict):  # type: ignore
    class ObjectCounter(object):
class Nprint(object):
class MutableSliceableSequence(MutableSequence):  # type: ignore
        def insert(self, pos, key, value):
    def utf8(s):
    def to_str(s):
    def to_unicode(s):
    def utf8(s):
    def to_str(s):
    def to_unicode(s):
def with_metaclass(meta, *bases):
        def __init__(self):
        def __call__(self, k):
        def dump(self):
def dbg(val=None):
    def __init__(self, file_name=None):
    def __call__(self, *args, **kw):
    def set_max_print(self, i):
def check_namespace_char(ch):
def check_anchorname_char(ch):
def version_tnf(t1, t2=None):
    def __getitem__(self, index):
    def __setitem__(self, index, value):
    def __delitem__(self, index):
    def __getsingleitem__(self, index):
    def __setsingleitem__(self, index, value):
    def __delsingleitem__(self, index): class LiteralScalarString(ScalarString):
    __slots__ = "comment"  # the comment after the | on the first line

    style = "|"

    def __new__(cls, value, anchor=None):
        # type: (Text, Any) -> Any
        return ScalarString.__new__(cls, value, anchor=anchor) class FoldedScalarString(ScalarString):
    __slots__ = ("fold_pos", "comment")  # the comment after the > on the first line

    style = ">"

    def __new__(cls, value, anchor=None):
        # type: (Text, Any) -> Any
        return ScalarString.__new__(cls, value, anchor=anchor) class SingleQuotedScalarString(ScalarString):
    __slots__ = ()

    style = "'"

    def __new__(cls, value, anchor=None):
        # type: (Text, Any) -> Any
        return ScalarString.__new__(cls, value, anchor=anchor) class DoubleQuotedScalarString(ScalarString):
    __slots__ = ()

    style = '"'

    def __new__(cls, value, anchor=None):
        # type: (Text, Any) -> Any
        return ScalarString.__new__(cls, value, anchor=anchor) class PlainScalarString(ScalarString):
    __slots__ = ()

    style = ""

    def __new__(cls, value, anchor=None):
        # type: (Text, Any) -> Any
        return ScalarString.__new__(cls, value, anchor=anchor) class ScalarInt(no_limit_int):
    def __new__(cls, *args, **kw):
        # type: (Any, Any, Any) -> Any
        width = kw.pop("width", None)  # type: ignore
        underscore = kw.pop("underscore", None)  # type: ignore
        anchor = kw.pop("anchor", None)  # type: ignore
        v = no_limit_int.__new__(cls, *args, **kw)  # type: ignore
        v._width = width
        v._underscore = underscore
        if anchor is not None:
            v.yaml_set_anchor(anchor, always_dump=True)
        return v

    def __iadd__(self, a):  # type: ignore
        # type: (Any) -> Any
        x = type(self)(self + a)
        x._width = self._width  # type: ignore
        x._underscore = (  # type: ignore
            self._underscore[:]
            if self._underscore is not None
            else None  # type: ignore
        )  # NOQA
        return x

    def __ifloordiv__(self, a):  # type: ignore
        # type: (Any) -> Any
        x = type(self)(self // a)
        x._width = self._width  # type: ignore
        x._underscore = (  # type: ignore
            self._underscore[:]
            if self._underscore is not None
            else None  # type: ignore
        )  # NOQA
        return x

    def __imul__(self, a):  # type: ignore
        # type: (Any) -> Any
        x = type(self)(self * a)
        x._width = self._width  # type: ignore
        x._underscore = (  # type: ignore
            self._underscore[:]
            if self._underscore is not None
            else None  # type: ignore
        )  # NOQA
        return x

    def __ipow__(self, a):  # type: ignore
        # type: (Any) -> Any
        x = type(self)(self ** a)
        x._width = self._width  # type: ignore
        x._underscore = (  # type: ignore
            self._underscore[:]
            if self._underscore is not None
            else None  # type: ignore
        )  # NOQA
        return x

    def __isub__(self, a):  # type: ignore
        # type: (Any) -> Any
        x = type(self)(self - a)
        x._width = self._width  # type: ignore
        x._underscore = (  # type: ignore
            self._underscore[:]
            if self._underscore is not None
            else None  # type: ignore
        )  # NOQA
        return x

    @property
    def anchor(self):
        # type: () -> Any
        if not hasattr(self, Anchor.attrib):
            setattr(self, Anchor.attrib, Anchor())
        return getattr(self, Anchor.attrib)

    def yaml_anchor(self, any=False):
        # type: (bool) -> Any
        if not hasattr(self, Anchor.attrib):
            return None
        if any or self.anchor.always_dump:
            return self.anchor
        return None

    def yaml_set_anchor(self, value, always_dump=False):
        # type: (Any, bool) -> None
        self.anchor.value = value
        self.anchor.always_dump = always_dump class BinaryInt(ScalarInt):
    def __new__(cls, value, width=None, underscore=None, anchor=None):
        # type: (Any, Any, Any, Any) -> Any
        return ScalarInt.__new__(
            cls, value, width=width, underscore=underscore, anchor=anchor
        ) class OctalInt(ScalarInt):
    def __new__(cls, value, width=None, underscore=None, anchor=None):
        # type: (Any, Any, Any, Any) -> Any
        return ScalarInt.__new__(
            cls, value, width=width, underscore=underscore, anchor=anchor
        ) class HexInt(ScalarInt):
    """uses lower case (a-f)"""

    def __new__(cls, value, width=None, underscore=None, anchor=None):
        # type: (Any, Any, Any, Any) -> Any
        return ScalarInt.__new__(
            cls, value, width=width, underscore=underscore, anchor=anchor
        ) class HexCapsInt(ScalarInt):
    """uses upper case (A-F)"""

    def __new__(cls, value, width=None, underscore=None, anchor=None):
        # type: (Any, Any, Any, Any) -> Any
        return ScalarInt.__new__(
            cls, value, width=width, underscore=underscore, anchor=anchor
        ) class ScalarFloat(float):
    def __new__(cls, *args, **kw):
        # type: (Any, Any, Any) -> Any
        width = kw.pop("width", None)  # type: ignore
        prec = kw.pop("prec", None)  # type: ignore
        m_sign = kw.pop("m_sign", None)  # type: ignore
        m_lead0 = kw.pop("m_lead0", 0)  # type: ignore
        exp = kw.pop("exp", None)  # type: ignore
        e_width = kw.pop("e_width", None)  # type: ignore
        e_sign = kw.pop("e_sign", None)  # type: ignore
        underscore = kw.pop("underscore", None)  # type: ignore
        anchor = kw.pop("anchor", None)  # type: ignore
        v = float.__new__(cls, *args, **kw)  # type: ignore
        v._width = width
        v._prec = prec
        v._m_sign = m_sign
        v._m_lead0 = m_lead0
        v._exp = exp
        v._e_width = e_width
        v._e_sign = e_sign
        v._underscore = underscore
        if anchor is not None:
            v.yaml_set_anchor(anchor, always_dump=True)
        return v

    def __iadd__(self, a):  # type: ignore
        # type: (Any) -> Any
        return float(self) + a
        x = type(self)(self + a)
        x._width = self._width
        x._underscore = (
            self._underscore[:] if self._underscore is not None else None
        )  # NOQA
        return x

    def __ifloordiv__(self, a):  # type: ignore
        # type: (Any) -> Any
        return float(self) // a
        x = type(self)(self // a)
        x._width = self._width
        x._underscore = (
            self._underscore[:] if self._underscore is not None else None
        )  # NOQA
        return x

    def __imul__(self, a):  # type: ignore
        # type: (Any) -> Any
        return float(self) * a
        x = type(self)(self * a)
        x._width = self._width
        x._underscore = (
            self._underscore[:] if self._underscore is not None else None
        )  # NOQA
        x._prec = self._prec  # check for others
        return x

    def __ipow__(self, a):  # type: ignore
        # type: (Any) -> Any
        return float(self) ** a
        x = type(self)(self ** a)
        x._width = self._width
        x._underscore = (
            self._underscore[:] if self._underscore is not None else None
        )  # NOQA
        return x

    def __isub__(self, a):  # type: ignore
        # type: (Any) -> Any
        return float(self) - a
        x = type(self)(self - a)
        x._width = self._width
        x._underscore = (
            self._underscore[:] if self._underscore is not None else None
        )  # NOQA
        return x

    @property
    def anchor(self):
        # type: () -> Any
        if not hasattr(self, Anchor.attrib):
            setattr(self, Anchor.attrib, Anchor())
        return getattr(self, Anchor.attrib)

    def yaml_anchor(self, any=False):
        # type: (bool) -> Any
        if not hasattr(self, Anchor.attrib):
            return None
        if any or self.anchor.always_dump:
            return self.anchor
        return None

    def yaml_set_anchor(self, value, always_dump=False):
        # type: (Any, bool) -> None
        self.anchor.value = value
        self.anchor.always_dump = always_dump

    def dump(self, out=sys.stdout):
        # type: (Any) -> Any
        out.write(
            "ScalarFloat({}| w:{}, p:{}, s:{}, lz:{}, _:{}|{}, w:{}, s:{})\n".format(
                self,
                self._width,  # type: ignore
                self._prec,  # type: ignore
                self._m_sign,  # type: ignore
                self._m_lead0,  # type: ignore
                self._underscore,  # type: ignore
                self._exp,  # type: ignore
                self._e_width,  # type: ignore
                self._e_sign,  # type: ignore
            )
        ) class ScalarBoolean(int):
    def __new__(cls, *args, **kw):
        # type: (Any, Any, Any) -> Any
        anchor = kw.pop("anchor", None)  # type: ignore
        b = int.__new__(cls, *args, **kw)  # type: ignore
        if anchor is not None:
            b.yaml_set_anchor(anchor, always_dump=True)
        return b

    @property
    def anchor(self):
        # type: () -> Any
        if not hasattr(self, Anchor.attrib):
            setattr(self, Anchor.attrib, Anchor())
        return getattr(self, Anchor.attrib)

    def yaml_anchor(self, any=False):
        # type: (bool) -> Any
        if not hasattr(self, Anchor.attrib):
            return None
        if any or self.anchor.always_dump:
            return self.anchor
        return None

    def yaml_set_anchor(self, value, always_dump=False):
        # type: (Any, bool) -> None
        self.anchor.value = value
        self.anchor.always_dump = always_dump class TimeStamp(datetime.datetime):
    def __init__(self, *args, **kw):
        # type: (Any, Any) -> None
        self._yaml = dict(t=False, tz=None, delta=0)  # type: Dict[Any, Any]

    def __new__(cls, *args, **kw):  # datetime is immutable
        # type: (Any, Any) -> Any
        return datetime.datetime.__new__(cls, *args, **kw)  # type: ignore

    def __deepcopy__(self, memo):
        # type: (Any) -> Any
        ts = TimeStamp(self.year, self.month, self.day, self.hour, self.minute, self.second)
        ts._yaml = copy.deepcopy(self._yaml)
        return ts class Comment(object):
class Format(object):
class LineCol(object):
class Tag(object):
class CommentedBase(object):
class CommentedSeq(MutableSliceableSequence, list, CommentedBase):  # type: ignore
class CommentedKeySeq(tuple, CommentedBase):  # type: ignore
class CommentedMapView(Sized):
class CommentedMapKeysView(CommentedMapView, Set):  # type: ignore
class CommentedMapItemsView(CommentedMapView, Set):  # type: ignore
class CommentedMapValuesView(CommentedMapView):
class CommentedMap(ordereddict, CommentedBase):  # type: ignore
class CommentedKeyMap(CommentedBase, Mapping):  # type: ignore
class CommentedOrderedMap(CommentedMap):
class CommentedSet(MutableSet, CommentedBase):  # type: ignore  # NOQA
class TaggedScalar(CommentedBase):
    def __init__(self):
    def __str__(self):
    def items(self):
    def end(self):
    def end(self, value):
    def start(self):
    def start(self, value):
def NoComment():
    def __init__(self):
    def set_flow_style(self):
    def set_block_style(self):
    def flow_style(self, default=None):
    def __init__(self):
    def add_kv_line_col(self, key, data):
    def key(self, k):
    def value(self, k):
    def _kv(self, k, x0, x1):
    def item(self, idx):
    def add_idx_line_col(self, key, data):
    def __init__(self):
    def __repr__(self):
    def ca(self):
    def yaml_end_comment_extend(self, comment, clear=False):
    def yaml_key_comment_extend(self, key, comment, clear=False):
    def yaml_value_comment_extend(self, key, comment, clear=False):
    def yaml_set_start_comment(self, comment, indent=0):
    def yaml_set_comment_before_after_key(
        self, key, before=None, indent=0, after=None, after_indent=None
    ):
        def comment_token(s, mark):
    def fa(self):
    def yaml_add_eol_comment(self, comment, key=NoComment, column=None):
    def lc(self):
    def _yaml_set_line_col(self, line, col):
    def _yaml_set_kv_line_col(self, key, data):
    def _yaml_set_idx_line_col(self, key, data):
    def anchor(self):
    def yaml_anchor(self):
    def yaml_set_anchor(self, value, always_dump=False):
    def tag(self):
    def yaml_set_tag(self, value):
    def copy_attributes(self, t, memo=None):
    def _yaml_add_eol_comment(self, comment, key):
    def _yaml_get_pre_comment(self):
    def _yaml_get_column(self, key):
    def __init__(self, *args, **kw):
    def __getsingleitem__(self, idx):
    def __setsingleitem__(self, idx, value):
    def __delsingleitem__(self, idx=None):
    def __len__(self):
    def insert(self, idx, val):
    def extend(self, val):
    def __eq__(self, other):
    def _yaml_add_comment(self, comment, key=NoComment):
    def _yaml_add_eol_comment(self, comment, key):
    def _yaml_get_columnX(self, key):
    def _yaml_get_column(self, key):
    def _yaml_get_pre_comment(self):
    def __deepcopy__(self, memo):
    def __add__(self, other):
    def sort(self, key=None, reverse=False):  # type: ignore
    def __repr__(self):
    def _yaml_add_comment(self, comment, key=NoComment):
    def _yaml_add_eol_comment(self, comment, key):
    def _yaml_get_columnX(self, key):
    def _yaml_get_column(self, key):
    def _yaml_get_pre_comment(self):
    def __init__(self, mapping):
    def __len__(self):
    def _from_iterable(self, it):
    def __contains__(self, key):
    def __iter__(self):
    def _from_iterable(self, it):
    def __contains__(self, item):
    def __iter__(self):
    def __contains__(self, value):
    def __iter__(self):
    def __init__(self, *args, **kw):
    def _yaml_add_comment(self, comment, key=NoComment, value=NoComment):
    def _yaml_add_eol_comment(self, comment, key):
    def _yaml_get_columnX(self, key):
    def _yaml_get_column(self, key):
    def _yaml_get_pre_comment(self):
    def update(self, vals):
    def insert(self, pos, key, value, comment=None):
    def mlget(self, key, default=None, list_ok=False):
        def get_one_level(key_list, level, d):
    def __getitem__(self, key):
    def __setitem__(self, key, value):
    def _unmerged_contains(self, key):
    def __contains__(self, key):
    def get(self, key, default=None):
    def __repr__(self):
    def non_merged_items(self):
    def __delitem__(self, key):
    def __iter__(self):
    def _keys(self):
    def __len__(self):
    def __eq__(self, other):
        def keys(self):
        def iterkeys(self):
        def viewkeys(self):
        def keys(self):
        def _values(self):
        def values(self):
        def itervalues(self):
        def viewvalues(self):
        def values(self):
    def _items(self):
        def items(self):
        def iteritems(self):
        def viewitems(self):
        def items(self):
    def merge(self):
    def copy(self):
    def add_referent(self, cm):
    def add_yaml_merge(self, value):
    def update_key_value(self, key):
    def __deepcopy__(self, memo):
def raise_immutable(cls, *args, **kwargs):
    def __init__(self, *args, **kw):
    def __getitem__(self, index):
    def __iter__(self):
    def __len__(self):
    def __hash__(self):
    def __repr__(self):
    def fromkeys(keys, v=None):
    def _yaml_add_comment(self, comment, key=NoComment):
    def _yaml_add_eol_comment(self, comment, key):
    def _yaml_get_columnX(self, key):
    def _yaml_get_column(self, key):
    def _yaml_get_pre_comment(self):
    def __init__(self, values=None):
    def _yaml_add_comment(self, comment, key=NoComment, value=NoComment):
    def _yaml_add_eol_comment(self, comment, key):
    def add(self, value):
    def discard(self, value):
    def __contains__(self, x):
    def __iter__(self):
    def __len__(self):
    def __repr__(self):
    def __init__(self, value=None, style=None, tag=None):
    def __str__(self):
def dump_comments(d, name="", sep=".", out=sys.stdout):
from .error import *  # NOQA
from .nodes import *  # NOQA
from .compat import text_type, binary_type, to_unicode, PY2, PY3
from .compat import ordereddict  # type: ignore
from .compat import nprint, nprintf  # NOQA
from .scalarstring import (
    LiteralScalarString,
    FoldedScalarString,
    SingleQuotedScalarString,
    DoubleQuotedScalarString,
    PlainScalarString,
)
from .scalarint import ScalarInt, BinaryInt, OctalInt, HexInt, HexCapsInt
from .scalarfloat import ScalarFloat
from .scalarbool import ScalarBoolean
from .timestamp import TimeStamp
    from typing import Dict, List, Any, Union, Text, Optional  # NOQA
from .comments import (
    CommentedMap,
    CommentedOrderedMap,
    CommentedSeq,
    CommentedKeySeq,
    CommentedKeyMap,
    CommentedSet,
    comment_attrib,
    merge_attrib,
    TaggedScalar,
)  # NOQA
import datetime
import sys
import types
    import copyreg
    import base64
    import copy_reg as copyreg  # type: ignore
    import collections
    import collections
        if t:
            if t.startswith("!!"):
                tag = "tag:yaml.org,2002:" + t[2:]
            else:
                tag = t
        else:
            tag = u"tag:yaml.org,2002:map"
        return self.represent_mapping(tag, data)

    def represent_list(self, data):
        # type: (Any) -> Any
        try:
            t = data.tag.value
        except AttributeError:
            t = None
        if t:
            if t.startswith("!!"):
                tag = "tag:yaml.org,2002:" + t[2:]
            else:
                tag = t
        else:
            tag = u"tag:yaml.org,2002:seq"
        return self.represent_sequence(tag, data)

    def represent_datetime(self, data):
        # type: (Any) -> Any
        inter = "T" if data._yaml["t"] else " "
        _yaml = data._yaml
        if _yaml["delta"]:
            data += _yaml["delta"]
            value = data.isoformat(inter)
        else:
            value = data.isoformat(inter)
        if _yaml["tz"]:
            value += _yaml["tz"]
        return self.represent_scalar(u"tag:yaml.org,2002:timestamp", to_unicode(value))

    def represent_tagged_scalar(self, data):
        # type: (Any) -> Any
        try:
            tag = data.tag.value
        except AttributeError:
            tag = None
        try:
            anchor = data.yaml_anchor()
        except AttributeError:
            anchor = None
        return self.represent_scalar(tag, data.value, style=data.style, anchor=anchor)

    def represent_scalar_bool(self, data):
        # type: (Any) -> Any
        try:
            anchor = data.yaml_anchor()
        except AttributeError:
            anchor = None
        return SafeRepresenter.represent_bool(self, data, anchor=anchor)


RoundTripRepresenter.add_representer(type(None), RoundTripRepresenter.represent_none)

RoundTripRepresenter.add_representer(
    LiteralScalarString, RoundTripRepresenter.represent_literal_scalarstring
)

RoundTripRepresenter.add_representer(
    FoldedScalarString, RoundTripRepresenter.represent_folded_scalarstring
)

RoundTripRepresenter.add_representer(
    SingleQuotedScalarString, RoundTripRepresenter.represent_single_quoted_scalarstring
)

RoundTripRepresenter.add_representer(
    DoubleQuotedScalarString, RoundTripRepresenter.represent_double_quoted_scalarstring
)

RoundTripRepresenter.add_representer(
    PlainScalarString, RoundTripRepresenter.represent_plain_scalarstring
)

# RoundTripRepresenter.add_representer(tuple, Representer.represent_tuple)

RoundTripRepresenter.add_representer(
    ScalarInt, RoundTripRepresenter.represent_scalar_int
)

RoundTripRepresenter.add_representer(
    BinaryInt, RoundTripRepresenter.represent_binary_int
)

RoundTripRepresenter.add_representer(OctalInt, RoundTripRepresenter.represent_octal_int)

RoundTripRepresenter.add_representer(HexInt, RoundTripRepresenter.represent_hex_int)

RoundTripRepresenter.add_representer(
    HexCapsInt, RoundTripRepresenter.represent_hex_caps_int
)

RoundTripRepresenter.add_representer(
    ScalarFloat, RoundTripRepresenter.represent_scalar_float
)

RoundTripRepresenter.add_representer(
    ScalarBoolean, RoundTripRepresenter.represent_scalar_bool
)

RoundTripRepresenter.add_representer(CommentedSeq, RoundTripRepresenter.represent_list)

RoundTripRepresenter.add_representer(CommentedMap, RoundTripRepresenter.represent_dict)

RoundTripRepresenter.add_representer(
    CommentedOrderedMap, RoundTripRepresenter.represent_ordereddict
)

if sys.version_info >= (2, 7):

    RoundTripRepresenter.add_representer(
        collections.OrderedDict, RoundTripRepresenter.represent_ordereddict
    )


RoundTripRepresenter.add_representer(CommentedSet, RoundTripRepresenter.represent_set)