<commit_before>from collections import OrderedDict
import re
from uuid import UUID

from thunderdome import columns
from thunderdome.connection import execute_query, ThunderdomeQueryError
from thunderdome.exceptions import ModelException, ValidationError
from thunderdome.query import QuerySet, QueryException
from thunderdome.gremlin import BaseGremlinMethod

#dict of node and edge types for rehydrating results
vertex_types = {}
edge_types = {}

class ElementDefinitionException(ModelException): pass

class BaseElement(object):
    """
    The base model class, don't inherit from this, inherit from Model, defined below
    """
    
    class DoesNotExist(QueryException): pass
    class MultipleObjectsReturned(QueryException): pass

    def __init__(self, **values):
        self.eid = values.get('_id')
        self._values = {}
        for name, column in self._columns.items():
            value =  values.get(name, None)
            if value is not None: value = column.to_python(value)
            value_mngr = column.value_manager(self, column, value)
            self._values[name] = value_mngr

    @classmethod
    def _type_name(cls, manual_name):
        """<commit_msg>Fix exceptions<commit_after>from collections import OrderedDict
import re
from uuid import UUID

from thunderdome import columns
from thunderdome.connection import execute_query, ThunderdomeQueryError
from thunderdome.exceptions import ModelException, ValidationError, ThunderdomeException
from thunderdome.gremlin import BaseGremlinMethod

#dict of node and edge types for rehydrating results
vertex_types = {}
edge_types = {}

class ElementDefinitionException(ModelException): pass

class BaseElement(object):
    """
    The base model class, don't inherit from this, inherit from Model, defined below
    """
    
    class DoesNotExist(ThunderdomeException): pass
    class MultipleObjectsReturned(ThunderdomeException): pass

    def __init__(self, **values):
        self.eid = values.get('_id')
        self._values = {}
        for name, column in self._columns.items():
            value =  values.get(name, None)
            if value is not None: value = column.to_python(value)
            value_mngr = column.value_manager(self, column, value)
            self._values[name] = value_mngr

    @classmethod
    def _type_name(cls, manual_name):
        """
{'fraction_non_alphanumeric': 0.07597623089983022, 'fraction_numerical': 0.0, 'mean_word_length': 3.7616161616161614, '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': '1267962', 'n_tokens_mistral': 660, 'n_tokens_neox': 629, 'n_words': 195}