# Path: simple_monitor_alert/monitor.py
# def get_verbose_condition(observable):
#     value = observable.get_line_value('value')
#     expected = observable.get_matcher()
#     if hasattr(expected, 'pattern'):
#         expected = expected.pattern
#     elif expected:
#         expected = expected.parse()
#     if isinstance(expected, six.string_types) or isinstance(expected, int):
#         expected = '== {}'.format(expected)
#     return '{} {}'.format(value, expected)


import os
import importlib
import logging
import sys
import datetime
import dateutil
import dateutil.parser
from dateutil.tz.tz import tzlocal
from simple_monitor_alert.monitor import get_verbose_condition
        from simple_monitor_alert.utils.system import get_hostname
        from simple_monitor_alert import __version__
        from simple_monitor_alert.utils.system import get_hostname
class AlertBase(object):
    def __init__(self, config, section=None):
        self.config = config
        self.section = section
        self.init()

    def init(self):
        pass


class AlertCommand(AlertBase):
    pass


class ObservableCommunication(dict):
    alert_kwargs_keys = ('observable_name', 'name', 'extra_info', 'level', 'fail', 'condition', 'hostname',
                         'observable')

    def __init__(self, observable, fail, **kwargs):
        super(ObservableCommunication, self).__init__(**kwargs)
        self.observable = observable
        self['observable'] = observable
        self['fail'] = fail
        self['hostname'] = get_hostname()
        self['level'] = self.observable.get_line_value('level', 'warning')
        self['subject'] = '{} [{}] {}'.format(self['hostname'], 'ERROR' if fail else 'SOLVED',
                                              observable.get_verbose_name())
        self['name'] = observable.get_verbose_name()
        self['observable_name'] = observable.name
        self['extra_info'] = observable.get_line_value('extra_info') or '(No more info available)'

# Path: simple_monitor_alert/monitor.py
# def get_verbose_condition(observable):
#     value = observable.get_line_value('value')
#     expected = observable.get_matcher()
#     if hasattr(expected, 'pattern'):
#         expected = expected.pattern
#     elif expected:
#         expected = expected.parse()
#     if isinstance(expected, six.string_types) or isinstance(expected, int):
#         expected = '== {}'.format(expected)
#     return '{} {}'.format(value, expected)


# Path: simple_monitor_alert/alerts.py
import os
import importlib
import logging
import sys
import datetime
import dateutil
import dateutil.parser
from dateutil.tz.tz import tzlocal
from simple_monitor_alert.monitor import get_verbose_condition
        from simple_monitor_alert.utils.system import get_hostname
        from simple_monitor_alert import __version__
        from simple_monitor_alert.utils.system import get_hostname

class AlertBase(object):
    def __init__(self, config, section=None):
        self.config = config
        self.section = section
        self.init()

    def init(self):
        pass


class AlertCommand(AlertBase):
    pass


class ObservableCommunication(dict):
    alert_kwargs_keys = ('observable_name', 'name', 'extra_info', 'level', 'fail', 'condition', 'hostname',
                         'observable')

    def __init__(self, observable, fail, **kwargs):
        super(ObservableCommunication, self).__init__(**kwargs)
        self.observable = observable
        self['observable'] = observable
        self['fail'] = fail
        self['hostname'] = get_hostname()
        self['level'] = self.observable.get_line_value('level', 'warning')
        self['subject'] = '{} [{}] {}'.format(self['hostname'], 'ERROR' if fail else 'SOLVED',
                                              observable.get_verbose_name())
        self['name'] = observable.get_verbose_name()
        self['observable_name'] = observable.name
        self['extra_info'] = observable.get_line_value('extra_info') or '(No more info available)'

        self['condition'] = get_verbose_condition(observable)