# Path: srsly/ruamel_yaml/compat.py
# def utf8(s):
#     # type: (str) -> str
#     return s


import warnings
import textwrap
from .compat import utf8
    from typing import Any, Dict, Optional, List, Text  # NOQA
    __slots__ = "name", "index", "line", "column", "buffer", "pointer"

    def __init__(self, name, index, line, column, buffer, pointer):
        # type: (Any, int, int, int, Any, Any) -> None
        StreamMark.__init__(self, name, index, line, column)
        self.buffer = buffer
        self.pointer = pointer

    def get_snippet(self, indent=4, max_length=75):
        # type: (int, int) -> Any
        if self.buffer is None:  # always False
            return None
        head = ""
        start = self.pointer
        while start > 0 and self.buffer[start - 1] not in u"\0\r\n\x85\u2028\u2029":
            start -= 1
            if self.pointer - start > max_length / 2 - 1:
                head = " ... "
                start += 5
                break
        tail = ""
        end = self.pointer
        while (
            end < len(self.buffer) and self.buffer[end] not in u"\0\r\n\x85\u2028\u2029"
        ):
            end += 1
            if end - self.pointer > max_length / 2 - 1:
                tail = " ... "
                end -= 5
                break

# Path: srsly/ruamel_yaml/compat.py
# def utf8(s):
#     # type: (str) -> str
#     return s


# Path: srsly/ruamel_yaml/error.py
import warnings
import textwrap
from .compat import utf8
    from typing import Any, Dict, Optional, List, Text  # NOQA

    __slots__ = "name", "index", "line", "column", "buffer", "pointer"

    def __init__(self, name, index, line, column, buffer, pointer):
        # type: (Any, int, int, int, Any, Any) -> None
        StreamMark.__init__(self, name, index, line, column)
        self.buffer = buffer
        self.pointer = pointer

    def get_snippet(self, indent=4, max_length=75):
        # type: (int, int) -> Any
        if self.buffer is None:  # always False
            return None
        head = ""
        start = self.pointer
        while start > 0 and self.buffer[start - 1] not in u"\0\r\n\x85\u2028\u2029":
            start -= 1
            if self.pointer - start > max_length / 2 - 1:
                head = " ... "
                start += 5
                break
        tail = ""
        end = self.pointer
        while (
            end < len(self.buffer) and self.buffer[end] not in u"\0\r\n\x85\u2028\u2029"
        ):
            end += 1
            if end - self.pointer > max_length / 2 - 1:
                tail = " ... "
                end -= 5
                break

        snippet = utf8(self.buffer[start:end])