<commit_before>__author__ = 'jcorbett'


from mongoengine import *

from .types import AllTypes

AutomaticTestrunGroupSystemConfigurationType = "auto-add-to-testrungroup"


class AutomaticTestrunGroupSystemConfiguration(Document):
    meta = {'collection': 'system-configurations'}
    name = StringField()
    enabled = BooleanField()
    configurationType = StringField(required=True, default=AutomaticTestrunGroupSystemConfigurationType, choices=[AutomaticTestrunGroupSystemConfigurationType,])
    template = StringField()
    matchers = ListField(EmbeddedDocumentField(TestrunMatch))

    @queryset_manager
    def objects(doc_cls, queryset):
        """Custom QuerySet Manager that filters based on the configurationType"""
        return queryset.filter(configurationType=AutomaticTestrunGroupSystemConfigurationType)


class TestrunMatch(EmbeddedDocument):
    propertyName = StringField()
    propertyValue = StringField()

AllTypes[AutomaticTestrunGroupSystemConfigurationType] = AutomaticTestrunGroupSystemConfiguration<commit_msg>Classes must be defined before using them, duh<commit_after>__author__ = 'jcorbett'


from mongoengine import *

from .types import AllTypes

AutomaticTestrunGroupSystemConfigurationType = "auto-add-to-testrungroup"

class TestrunMatch(EmbeddedDocument):
    propertyName = StringField()
    propertyValue = StringField()


class AutomaticTestrunGroupSystemConfiguration(Document):
    meta = {'collection': 'system-configurations'}
    name = StringField()
    enabled = BooleanField()
    configurationType = StringField(required=True, default=AutomaticTestrunGroupSystemConfigurationType, choices=[AutomaticTestrunGroupSystemConfigurationType,])
    template = StringField()
    matchers = ListField(EmbeddedDocumentField(TestrunMatch))

    @queryset_manager
    def objects(doc_cls, queryset):
        """Custom QuerySet Manager that filters based on the configurationType"""
        return queryset.filter(configurationType=AutomaticTestrunGroupSystemConfigurationType)


AllTypes[AutomaticTestrunGroupSystemConfigurationType] = AutomaticTestrunGroupSystemConfiguration
{'fraction_non_alphanumeric': 0.07416154936230515, 'fraction_numerical': 0.0, 'mean_word_length': 6.673913043478261, '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': '6539657', 'n_tokens_mistral': 540, 'n_tokens_neox': 521, 'n_words': 108}