<commit_before>package policies

import (
	"github.com/keel-hq/keel/types"
)

// GetPolicy - gets policy
func GetPolicy(labels map[string]string) types.PolicyType {
	for k, v := range labels {
		switch k {
		case types.KeelPolicyLabel:
			return types.ParsePolicy(v)
		case "keel.observer/policy":
			return types.ParsePolicy(v)
		}
	}

	return types.PolicyTypeNone
}

// GetTriggerPolicy - checks for trigger label, if not set - returns
// default trigger type
func GetTriggerPolicy(labels map[string]string) types.TriggerType {
	trigger, ok := labels[types.KeelTriggerLabel]
	if ok {
		return types.ParseTrigger(trigger)
	}
	return types.TriggerTypeDefault
}<commit_msg>cleanup<commit_after>package policies

import (
	"github.com/keel-hq/keel/types"
)

// GetTriggerPolicy - checks for trigger label, if not set - returns
// default trigger type
func GetTriggerPolicy(labels map[string]string) types.TriggerType {
	trigger, ok := labels[types.KeelTriggerLabel]
	if ok {
		return types.ParseTrigger(trigger)
	}
	return types.TriggerTypeDefault
}
{'fraction_non_alphanumeric': 0.10219675262655205, 'fraction_numerical': 0.0, 'mean_word_length': 4.544973544973545, 'pattern_counts': {'":': 1, '<': 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': '1521194', 'n_tokens_mistral': 344, 'n_tokens_neox': 330, 'n_words': 82}