# Path: simple_monitor_alert/exceptions.py
# class InvalidScriptLineError(InvalidScriptLineBase, SyntaxError):
#     pass


import re
import string
import sys
import six
from simple_monitor_alert.exceptions import InvalidScriptLineError

class HeaderLine(KeyValueLine):
    def __init__(self, key, value):
        super(HeaderLine, self).__init__(key, value)

    def __str__(self):
        return '{}: {}'.format(self.key, self.value)


class RawLine(object):
    pattern = None

    def __init__(self, line, monitor):
        self.line, self.monitor = line, monitor
        match = self.pattern.match(self.line)
        if match is None:
            raise InvalidScriptLineError(line, monitor.script_path)
        for key, value in match.groupdict().items():
            setattr(self, key, value)

    @staticmethod
    def parse(line, monitor):
        if isinstance(line, bytes):
            line = line.decode(ENCODING)
        line = line.strip(string.whitespace)
        if not line or line.startswith('#'):
            return
        for line_type_class in [RawItemLine, RawHeaderLine]:
            try:
                return line_type_class(line, monitor)

# Path: simple_monitor_alert/exceptions.py
# class InvalidScriptLineError(InvalidScriptLineBase, SyntaxError):
#     pass


# Path: simple_monitor_alert/lines.py
import re
import string
import sys
import six
from simple_monitor_alert.exceptions import InvalidScriptLineError


class HeaderLine(KeyValueLine):
    def __init__(self, key, value):
        super(HeaderLine, self).__init__(key, value)

    def __str__(self):
        return '{}: {}'.format(self.key, self.value)


class RawLine(object):
    pattern = None

    def __init__(self, line, monitor):
        self.line, self.monitor = line, monitor
        match = self.pattern.match(self.line)
        if match is None:
            raise InvalidScriptLineError(line, monitor.script_path)
        for key, value in match.groupdict().items():
            setattr(self, key, value)

    @staticmethod
    def parse(line, monitor):
        if isinstance(line, bytes):
            line = line.decode(ENCODING)
        line = line.strip(string.whitespace)
        if not line or line.startswith('#'):
            return
        for line_type_class in [RawItemLine, RawHeaderLine]:
            try:
                return line_type_class(line, monitor)

            except InvalidScriptLineError: