Determines if the alert should be evaluated or not.
181120
private boolean _shouldEvaluateAlert(Alert alert, BigInteger alertId) {
		if (alert == null) {
			_logger.warn(MessageFormat.format("Could not find alert ID {0}", alertId));
			return false;
		}
		if(!alert.isEnabled()) {
			_logger.warn(MessageFormat.format("Alert {0} has been disabled. Will not evaluate.", alert.getId().intValue()));
			return false;
		}

		return true;
	}
322520
def is_valid(self, value):
        ''' 

        '''
        try:
            if validation_on():
                self.validate(value, False)
        except ValueError:
            return False
        else:
            return True
1004607
def set_alert_callback(self, callback):
        
        if callable(callable):
            self.http.alert_callback = functools.partial(callback, self)
        else:
            self.http.alert_callback = None
1156279
def is_ignored(self, event):
        
        for each in self._ignored:
            if event.name == each:
                return True
        return False
984640
def assert_is(expected, actual, message=None, extra=None):
    """"""
    assert expected is actual, _assert_fail_message(
        message, expected, actual, "is not", extra
    )
419841
def _notify_on_condition(self, test_message=None, **kwargs):
        
        if test_message:
            return True
        else:
            return self.enabled and self.notify_on_condition(**kwargs)
1345196
@Transactional
	protected synchronized void _checkAlertExistence(boolean enabled) {
		for (String alertName : new String[] { FILE_DESCRIPTORS_ALERT, PHYSICAL_MEMORY_ALERT, SWAP_SPACE_ALERT }) {
			if (_alertService.findAlertByNameAndOwner(_constructAlertName(alertName), _adminUser) == null) {
				String metricExpression = null;
				TriggerType triggerType = null;
				String triggerName = null;
				double triggerThreshold = Double.NaN;

				switch (alertName) {
				case FILE_DESCRIPTORS_ALERT:

					String openFileDescMetricExp = MessageFormat.format("-1h:{0}:{1}'{'host={2}'}':avg", Counter.OPEN_DESCRIPTORS.getScope(),
							Counter.OPEN_DESCRIPTORS.getMetric(), HOSTNAME);
					String maxFileDescMetricExp = MessageFormat.format("-1h:{0}:{1}'{'host={2}'}':avg", Counter.MAX_DESCRIPTORS.getScope(),
							Counter.MAX_DESCRIPTORS.getMetric(), HOSTNAME);

					metricExpression = MessageFormat.format("{0}({1}, {2})", Function.DIVIDE.getName(), openFileDescMetricExp,
							maxFileDescMetricExp);
					triggerType = TriggerType.GREATER_THAN;
					triggerName = "Open FD > 95% of Max FD";
					triggerThreshold = 0.95;
					break;
				case PHYSICAL_MEMORY_ALERT:

					String freeMemMetricExp = MessageFormat.format("-1h:{0}:{1}'{'host={2}'}':avg", Counter.FREE_PHYSICAL_MEM.getScope(),
							Counter.FREE_PHYSICAL_MEM.getMetric(), HOSTNAME);
					String maxMemMetricExp = MessageFormat.format("-1h:{0}:{1}'{'host={2}'}':avg", Counter.MAX_PHYSICAL_MEM.getScope(),
							Counter.MAX_PHYSICAL_MEM.getMetric(), HOSTNAME);

					metricExpression = MessageFormat.format("{0}({1}, {2})", Function.DIVIDE.getName(), freeMemMetricExp, maxMemMetricExp);
					triggerType = TriggerType.LESS_THAN;
					triggerName = "Free Mem < 5% of Tot Mem";
					triggerThreshold = 0.05;
					break;
				case SWAP_SPACE_ALERT:

					String freeSSMetricExp = MessageFormat.format("-1h:{0}:{1}'{'host={2}'}':avg", Counter.FREE_SWAP_SPACE.getScope(),
							Counter.FREE_SWAP_SPACE.getMetric(), HOSTNAME);
					String maxSSMetricExp = MessageFormat.format("-1h:{0}:{1}'{'host={2}'}':avg", Counter.MAX_SWAP_SPACE.getScope(),
							Counter.MAX_SWAP_SPACE.getMetric(), HOSTNAME);

					metricExpression = MessageFormat.format("{0}({1}, {2})", Function.DIVIDE.getName(), freeSSMetricExp, maxSSMetricExp);
					triggerType = TriggerType.LESS_THAN;
					triggerName = "Free Swap Space < 5% of Tot Swap Space";
					triggerThreshold = 0.05;
					break;
				default:
					throw new SystemException("Attempting to create an unsupported monitoring alert" + alertName);
				}
				requireArgument(metricExpression != null && triggerType != null & triggerName != null, "Unsupported monitor alert " + alertName);

				Alert alert = new Alert(_adminUser, _adminUser, _constructAlertName(alertName), metricExpression, "0 * * * *");
				Notification notification = new Notification(NOTIFICATION_NAME, alert, AuditNotifier.class.getName(), new ArrayList<String>(),
						60000L);
				Trigger trigger = new Trigger(alert, triggerType, triggerName, triggerThreshold, 0);
				List<Trigger> triggers = Arrays.asList(new Trigger[] { trigger });

				notification.setTriggers(triggers);
				alert.setNotifications(Arrays.asList(new Notification[] { notification }));
				alert.setTriggers(triggers);
				alert.setEnabled(enabled);
				_alertService.updateAlert(alert);
			} else { // end if

				Alert alert = _alertService.findAlertByNameAndOwner(_constructAlertName(alertName), _adminUser);

				alert.setEnabled(enabled);
				_alertService.updateAlert(alert);
			} // end if-else
		} // end for
	}
703460
def delete_alert(self, alert):
        
        assert alert is not None
        assert isinstance(alert.id, str), "Value must be a string"
        assert isinstance(alert.trigger_id, str), "Value must be a string"
        status, _ = self.http_client.delete(
            NAMED_ALERT_URI % (alert.trigger_id, alert.id),
            params={'appid': self.API_key},
            headers={'Content-Type': 'application/json'})
1054850
def is_check(self) -> bool:
        """"""
        king = self.king(self.turn)
        return king is not None and self.is_attacked_by(not self.turn, king)
355626
public void showAlertEditDialog(Alert alert) {
        if (dialogAlertAdd == null || !dialogAlertAdd.isVisible()) {
            dialogAlertAdd = new AlertAddDialog(getView().getMainFrame(), false);
            dialogAlertAdd.setVisible(true);
            dialogAlertAdd.setAlert(alert);
        }
    }
849682
def should_submit(stack):
    
    if stack.enabled:
        return True

    logger.debug("Stack %s is not enabled.  Skipping.", stack.name)
    return False
125691
private void setCalculateHighestAlertIfSameAlert(Alert alert) {
        if (highestAlert != null && highestAlert.getAlertId() == alert.getAlertId()) {
            calculateHighestAlert = true;
            highestAlert = null;
        }
    }
12633
public void notifyBeforeEvaluation(String expression) {
        for (EvaluationListener listener : listeners) {
            try {
                listener.beforeEvaluation(this, expression);
            } catch (Throwable t) {
                Util.handleThrowable(t);
                // Ignore - no option to log
            }
        }
    }
1198521
def assert_is_not(expected, actual, message=None, extra=None):
    """"""
    assert expected is not actual, _assert_fail_message(
        message, expected, actual, "is", extra
    )
1373107
def get_alert(self, stat, header=""):
        """"""
        if not isinstance(stat['size'], numbers.Number):
            ret = 'DEFAULT'
        else:
            ret = 'OK'

            if stat['critical'] is not None and \
               stat['size'] > int(stat['critical']) * 1000000:
                ret = 'CRITICAL'
            elif stat['warning'] is not None and \
                    stat['size'] > int(stat['warning']) * 1000000:
                ret = 'WARNING'
            elif stat['careful'] is not None and \
                    stat['size'] > int(stat['careful']) * 1000000:
                ret = 'CAREFUL'

        # Get stat name
        stat_name = self.get_stat_name(header=header)

        # Manage threshold
        self.manage_threshold(stat_name, ret)

        # Manage action
        self.manage_action(stat_name,
                           ret.lower(),
                           header,
                           stat[self.get_key()])

        return ret
1140357
def __evaluation_error(self, result, condition, throw):
        """"""
        self.log.error("Result does not match condition, dropping item. "
                       "Result %s; Condition: %s; Throw: %s",
                       result, condition, throw)
        return False
945931
public void check(String locator) {
        getDispatcher().beforeCheck(this, locator);
        
        this.check();
        validatePresenceOfAlert();
        WebDriverWaitUtils.waitUntilElementIsPresent(locator);
        
        getDispatcher().afterUncheck(this, locator);
    }