<commit_before>from .meta import SnorkelBase
import re
from sqlalchemy import Column, String, Integer, Float, ForeignKey, UniqueConstraint, Table
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import relationship, backref
from snorkel.utils import camel_to_under
from sqlalchemy.orm.collections import attribute_mapped_collection


annotation_key_set_annotation_key_association = \
    Table('annotation_key_set_annotation_key_association', SnorkelBase.metadata,
          Column('annotation_key_set_id', Integer, ForeignKey('annotation_key_set.id'), nullable=False),
          Column('annotation_key_id', Integer, ForeignKey('annotation_key.id'), nullable=False),
          UniqueConstraint('annotation_key_set_id', 'annotation_key_id',
                           name='unique_annotation_key_set_annotation_key_association'))


class AnnotationKeySet(SnorkelBase):
    """A many-to-many set of AnnotationKeys."""
    __tablename__ = 'annotation_key_set'
    id            = Column(Integer, primary_key=True)
    name          = Column(String, unique=True, nullable=False)
    keys          = relationship('AnnotationKey',
                                 secondary=annotation_key_set_annotation_key_association,
                                 collection_class=attribute_mapped_collection('name'),
                                 backref='sets')
    
    def append(self, a):
        self.keys[a.name] = a

    def remove(self, item):
        del self.keys[a.name]<commit_msg>Reverted AnnotationKeySet relationship container to default.<commit_after>from .meta import SnorkelBase
import re
from sqlalchemy import Column, String, Integer, Float, ForeignKey, UniqueConstraint, Table
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import relationship, backref
from snorkel.utils import camel_to_under
from sqlalchemy.orm.collections import attribute_mapped_collection


annotation_key_set_annotation_key_association = \
    Table('annotation_key_set_annotation_key_association', SnorkelBase.metadata,
          Column('annotation_key_set_id', Integer, ForeignKey('annotation_key_set.id'), nullable=False),
          Column('annotation_key_id', Integer, ForeignKey('annotation_key.id'), nullable=False),
          UniqueConstraint('annotation_key_set_id', 'annotation_key_id',
                           name='unique_annotation_key_set_annotation_key_association'))


class AnnotationKeySet(SnorkelBase):
    """A many-to-many set of AnnotationKeys."""
    __tablename__ = 'annotation_key_set'
    id            = Column(Integer, primary_key=True)
    name          = Column(String, unique=True, nullable=False)
    keys          = relationship('AnnotationKey',
                                 secondary=annotation_key_set_annotation_key_association,
                                 backref='sets')
    
    def append(self, a):
        self.keys[a.name] = a

    def remove(self, item):
        del self.keys[a.name]
{'fraction_non_alphanumeric': 0.08316498316498316, 'fraction_numerical': 0.0, 'mean_word_length': 3.4811463046757165, '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': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1181206', 'n_tokens_mistral': 822, 'n_tokens_neox': 801, 'n_words': 159}