<commit_before>import json
import uuid
import couchdb
import time

from totalimpact.config import Configuration


class Dao(object):
    '''the dao that can be named is not the true dao'''
    __type__ = None

    def __init__(self, **kwargs):
        self.couch, self.db = self.connection()
        self._data = dict(kwargs)
        self._id = self.data.get('_id',None)
        self._version = self.data.get('_rev',None)

    @classmethod
    def connection(cls):
        config = Configuration()
        # read these from config
        couch_url = config.db_url
        couch_db = config.db_name
        
        # on first connect, create if not existing
        couch = couchdb.Server(url=couch_url)
        couch.resource.credentials = ( config.db_adminuser,config.db_password )
        try:
            db = couch[couch_db]
        except:
            db = couch.create(couch_db)
            db.save( config.db_views )
        return couch, db

    @property<commit_msg>fixing dao call to data<commit_after>import json
import uuid
import couchdb
import time

from totalimpact.config import Configuration


class Dao(object):
    '''the dao that can be named is not the true dao'''
    __type__ = None

    def __init__(self, **kwargs):
        self.couch, self.db = self.connection()
        self._data = dict(kwargs)
        self._id = self._data.get('_id',None)
        self._version = self._data.get('_rev',None)

    @classmethod
    def connection(cls):
        config = Configuration()
        # read these from config
        couch_url = config.db_url
        couch_db = config.db_name
        
        # on first connect, create if not existing
        couch = couchdb.Server(url=couch_url)
        couch.resource.credentials = ( config.db_adminuser,config.db_password )
        try:
            db = couch[couch_db]
        except:
            db = couch.create(couch_db)
            db.save( config.db_views )
        return couch, db

    @property
{'fraction_non_alphanumeric': 0.09257375381485249, 'fraction_numerical': 0.0, 'mean_word_length': 2.2620232172470978, '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': '7443255', 'n_tokens_mistral': 585, 'n_tokens_neox': 584, 'n_words': 153}