<commit_before>from channelgroup import *
from alert import *
import drivers
import inspectors
import config

class Server:
	def __init__(self, name, config):
		self._name = name
		self._driver = drivers.createDriver(config.get("driver"), config.get("config", {}))
		self._alerts = config.get("alerts", [])
		self._summary = config.get("summary", [])
		self._channels = config.get("channels", [])


	def createAlerts(self):
		alerts = []

		for alert in self._alerts:
			alert_type = alert.get('type')
			alert_alarms = alert.get('alarms', {})
			alert_config = alert.get('config', {})

			if config.VERBOSE: print "Creating inspector: %s..." % alert_type

			try:
				inspector = inspectors.createInspector(alert_type, self._driver, alert_config)
				if not inspector:
					raise Exception("Unknown inspector type: %s" % alert_type)
<commit_msg>Allow alert to default if summary isn't provided<commit_after>from channelgroup import *
from alert import *
import drivers
import inspectors
import config

class Server:
	def __init__(self, name, config):
		self._name = name
		self._driver = drivers.createDriver(config.get("driver"), config.get("config", {}))
		self._alerts = config.get("alerts", [])
		self._summary = config.get("summary") or config.get("alerts") or []
		self._channels = config.get("channels", [])


	def createAlerts(self):
		alerts = []

		for alert in self._alerts:
			alert_type = alert.get('type')
			alert_alarms = alert.get('alarms', {})
			alert_config = alert.get('config', {})

			if config.VERBOSE: print "Creating inspector: %s..." % alert_type

			try:
				inspector = inspectors.createInspector(alert_type, self._driver, alert_config)
				if not inspector:
					raise Exception("Unknown inspector type: %s" % alert_type)

{'fraction_non_alphanumeric': 0.13976041072447234, 'fraction_numerical': 0.0, 'mean_word_length': 4.447204968944099, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6566352', 'n_tokens_mistral': 610, 'n_tokens_neox': 538, 'n_words': 136}