# 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
# Copyright (c) Pilot Systems and Libération, 2010-2011

# This file is part of SeSQL.

# SeSQL is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.

# SeSQL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with SeSQL.  If not, see <http://www.gnu.org/licenses/>.


log = logging.getLogger('sesql')

def index_log_wrap(function):
    """
    Log wrap the method, giving it a name and logging its time
    """
    def inner(obj, *args, **kwargs):
        try:
            classname, objid = get_sesql_id(obj)
            message = "%s (%s:%s)" % (function.__name__, classname, objid)
        except (TypeError, AttributeError, ValueError):
            message = "%s (invalid object %r)" % (function.__name__, obj)

# 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

# Copyright (c) Pilot Systems and Libération, 2010-2011

# This file is part of SeSQL.

# SeSQL is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.

# SeSQL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with SeSQL.  If not, see <http://www.gnu.org/licenses/>.


log = logging.getLogger('sesql')

def index_log_wrap(function):
    """
    Log wrap the method, giving it a name and logging its time
    """
    def inner(obj, *args, **kwargs):
        try:
            classname, objid = get_sesql_id(obj)
            message = "%s (%s:%s)" % (function.__name__, classname, objid)
        except (TypeError, AttributeError, ValueError):
            message = "%s (invalid object %r)" % (function.__name__, obj)

        return utils.log_time(function, message)(obj, message, *args, **kwargs)