<commit_before>import re
import uuid
import datetime

from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey, DateTime
from sqlalchemy.orm import relationship
import sqlalchemy.types as types
from sqlalchemy.types import String
from flask import g


_camelcase_re = re.compile(r'([A-Z]+)(?=[a-z0-9])')

class FileColumn(types.TypeDecorator):
    """
    Extends SQLA to support a File Column
    usefull to auto form generation.
    
    """
    impl = types.Text
    

class ImageColumn(types.TypeDecorator):
    impl = types.Text



class BaseMixin(object):
    __table_args__ = {'extend_existing': True}

    def __new__(self):
        if not self.__tablename__:
            
            self.__tablename__ = _camelcase_re.sub(_join, self.__class__.__name__).lstrip('_')
            print "NEW", self.__tablename__

class AuditMixin(BaseMixin):
    """
    AuditMixin<commit_msg>Update mixins.py<commit_after>import re
import uuid
import datetime

from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey, DateTime
from sqlalchemy.orm import relationship
import sqlalchemy.types as types
from sqlalchemy.types import String
from flask import g


_camelcase_re = re.compile(r'([A-Z]+)(?=[a-z0-9])')

class FileColumn(types.TypeDecorator):
    """
    Extends SQLA to support a File Column
    usefull to auto form generation.
    
    """
    impl = types.Text
    

class ImageColumn(types.TypeDecorator):
    impl = types.Text



class BaseMixin(object):
    __table_args__ = {'extend_existing': True}

    @declared_attr
    def __tablename__(cls):
        def _join(match):
            word = match.group()
            if len(word) > 1:
                return ('_%s_%s' % (word[:-1], word[-1])).lower()
            return '_' + word.lower()
        print "NEW", _camelcase_re.sub(_join, cls.__name__).lstrip('_')
        return _camelcase_re.sub(_join, cls.__name__).lstrip('_')
            

class AuditMixin(BaseMixin):
    """
    AuditMixin
{'fraction_non_alphanumeric': 0.10639312977099237, 'fraction_numerical': 0.0033396946564885495, 'mean_word_length': 3.2708757637474544, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3377211', 'n_tokens_mistral': 686, 'n_tokens_neox': 671, 'n_words': 166}