# Path: sesql/utils.py
# class Timer(object):
#     def __init__(self):
#     def start(self):
#     def stop(self):
#     def __enter__(self):
#     def __exit__(self, *args, **kwargs):
#     def get_local(self):
#     def get_global(self):
#     def reset(self):
#     def peek(self):
# def safe_str(what):
# def log_time(function, message = None):
#     def log_time_inner(*args, **kwargs):
# def strip_ligatures(value):
# def format_time(timedelta, keep = 3):
# def print_eta(percent, timedelta):
# 
# Path: sesql/config.py
# CONFIG_PATH_FALLBACK = 'sesql_config'
#     CONFIG_PATH = getattr(settings, 'SESQL_CONFIG_PATH', CONFIG_PATH_FALLBACK)
#     CONFIG_PATH = CONFIG_PATH_FALLBACK
# 
# Path: sesql/typemap.py
# class TypeMap(object):
#     def __init__(self):
#     def all_subclasses(klass, done = None):
#     def all_tables(self):
#     def all_classes(self):
#     def all_class_names(self):
#     def get_class_names_for(self, table):
#     def get_classes_for(self, table):
#     def get_table_for(self, klass):
#     def get_class_by_name(self, klass):
# 
# Path: sesql/fieldmap.py
# class FieldMap(object):
#     def __init__(self):
#     def all_fields(self):
#     def get_field(self, field):
#     def get_primary(self):


import logging
from sesql import utils
from sesql import config
from sesql import typemap
from sesql import fieldmap
    log.info("%s : indexing entry in table %s" % (message, table_name))

    keys, placeholders, results = get_values(obj, config.FIELDS)

    query = "INSERT INTO %s (%s) VALUES (%s)" % (table_name,
                                                 ",".join(keys),
                                                 ",".join(placeholders))
    cursor.execute(query, results)


@index_log_wrap
def unindex(obj, message):
    """
    Unindex the object
    """
    return index(obj, noindex = True)

@index_log_wrap
@config.orm.transactional
def update(cursor, obj, message, fields):
    """
    Update only specific fields of given object
    """
    log.info("%s : entering for fields %s" % (message, ','.join(fields)))

    table_name = typemap.typemap.get_table_for(obj.__class__)
    if not table_name:
        log.info("%s : not table, skipping" % message)
        return


# Path: sesql/utils.py
# class Timer(object):
#     def __init__(self):
#     def start(self):
#     def stop(self):
#     def __enter__(self):
#     def __exit__(self, *args, **kwargs):
#     def get_local(self):
#     def get_global(self):
#     def reset(self):
#     def peek(self):
# def safe_str(what):
# def log_time(function, message = None):
#     def log_time_inner(*args, **kwargs):
# def strip_ligatures(value):
# def format_time(timedelta, keep = 3):
# def print_eta(percent, timedelta):
# 
# Path: sesql/config.py
# CONFIG_PATH_FALLBACK = 'sesql_config'
#     CONFIG_PATH = getattr(settings, 'SESQL_CONFIG_PATH', CONFIG_PATH_FALLBACK)
#     CONFIG_PATH = CONFIG_PATH_FALLBACK
# 
# Path: sesql/typemap.py
# class TypeMap(object):
#     def __init__(self):
#     def all_subclasses(klass, done = None):
#     def all_tables(self):
#     def all_classes(self):
#     def all_class_names(self):
#     def get_class_names_for(self, table):
#     def get_classes_for(self, table):
#     def get_table_for(self, klass):
#     def get_class_by_name(self, klass):
# 
# Path: sesql/fieldmap.py
# class FieldMap(object):
#     def __init__(self):
#     def all_fields(self):
#     def get_field(self, field):
#     def get_primary(self):


# Path: sesql/index.py
import logging
from sesql import utils
from sesql import config
from sesql import typemap
from sesql import fieldmap

    log.info("%s : indexing entry in table %s" % (message, table_name))

    keys, placeholders, results = get_values(obj, config.FIELDS)

    query = "INSERT INTO %s (%s) VALUES (%s)" % (table_name,
                                                 ",".join(keys),
                                                 ",".join(placeholders))
    cursor.execute(query, results)


@index_log_wrap
def unindex(obj, message):
    """
    Unindex the object
    """
    return index(obj, noindex = True)

@index_log_wrap
@config.orm.transactional
def update(cursor, obj, message, fields):
    """
    Update only specific fields of given object
    """
    log.info("%s : entering for fields %s" % (message, ','.join(fields)))

    table_name = typemap.typemap.get_table_for(obj.__class__)
    if not table_name:
        log.info("%s : not table, skipping" % message)
        return


    fields = [ fieldmap.fieldmap.get_field(field) for field in fields ]