<commit_before>from . import config
from elasticsearch import Elasticsearch, client, helpers
from .config import logger
from .relationship import relationship
from .es_types import *
from .base import VWBase
import json
import inspect

class MapperError(Exception):
    pass

# tools for creating or reindexing elasticsearch mapping
class Mapper(object):
    def __init__(self):
        self._es = Elasticsearch(config.dsn)
        self._esc = client.IndicesClient(self._es)

    # Retrieves the mapping as defined by the server
    def get_server_mapping(self,**kwargs):
        indexes = []
        if isinstance(kwargs.get('index'),list):
            indexes = kwargs.get('index')
        elif kwargs.get('index'):
            indexes.append(kwargs.get('index'))

        # if the model arguent is a VWBase object
        if isinstance(kwargs.get('index'), VWBase):
            try:<commit_msg>added connect args to the mapper<commit_after>from . import config
from elasticsearch import Elasticsearch, client, helpers
from .config import logger
from .relationship import relationship
from .es_types import *
from .base import VWBase
import json
import inspect

class MapperError(Exception):
    pass

# tools for creating or reindexing elasticsearch mapping
class Mapper(object):
    def __init__(self,connect_args={}):
        self._es = Elasticsearch(config.dsn,**connect_args)
        self._esc = client.IndicesClient(self._es)

    # Retrieves the mapping as defined by the server
    def get_server_mapping(self,**kwargs):
        indexes = []
        if isinstance(kwargs.get('index'),list):
            indexes = kwargs.get('index')
        elif kwargs.get('index'):
            indexes.append(kwargs.get('index'))

        # if the model arguent is a VWBase object
        if isinstance(kwargs.get('index'), VWBase):
            try:
{'fraction_non_alphanumeric': 0.09273318872017354, 'fraction_numerical': 0.0, 'mean_word_length': 3.2708333333333335, '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': '2064658', 'n_tokens_mistral': 502, 'n_tokens_neox': 502, 'n_words': 156}