# Path: solace/signals.py
# def _ref(func):
#     def __init__(self, im_self, im_func, im_class):
#     def resolve(self):
# def SIG(name, args=None):
#     def __init__(self, name, args=None, _frm=None):
#     def connect(self, func):
#     def is_connected(self, func):
#     def get_connections(self):
#     def disconnect(self, func):
#     def emit(self, **args):
#     def __reduce__(self):
#     def __repr__(self):
#     def emit(self, **args):
# def temporary_connection(func, signal):
# def handler(signal):
#     def decorator(func):
# class _MethodRef(object):
# class Signal(object):
# class _BroadcastSignal(Signal):
# 
# Path: solace/settings.py
# def configure(**values):
# def revert_to_default():
# def autodiscover_settings():
# def configure_from_file(filename):
# def describe_settings():


import sys
import time
    import solace.schema
    import solace.schema
from threading import Lock
from datetime import datetime
from babel import Locale
from sqlalchemy.types import TypeDecorator
from sqlalchemy.engine.url import make_url
from sqlalchemy.interfaces import ConnectionProxy
from sqlalchemy.orm.session import Session
from sqlalchemy.orm.interfaces import SessionExtension, MapperExtension, \
     EXT_CONTINUE
from sqlalchemy.util import to_list
from sqlalchemy import String, orm, sql, create_engine, MetaData
            from solace.badges import badges_by_id
        from solace.application import Request
from solace.signals import after_request_shutdown, before_response_sent, \
     after_cursor_executed, before_cursor_executed, before_models_committed, \
     after_models_committed
from solace import settings
class SignalTrackingMapperExtension(MapperExtension):
    """Remembers model changes for the session commit code."""

    def after_delete(self, mapper, connection, instance):
        return self._record(instance, 'delete')

    def after_insert(self, mapper, connection, instance):
        return self._record(instance, 'insert')

    def after_update(self, mapper, connection, instance):
        return self._record(instance, 'update')

    def _record(self, model, operation):
        pk = tuple(orm.object_mapper(model).primary_key_from_instance(model))
        orm.object_session(model)._model_changes[pk] = (model, operation)
        return EXT_CONTINUE


class SignalEmittingSessionExtension(SessionExtension):
    """Emits signals the mapper extension accumulated."""

    def before_commit(self, session):
        d = session._model_changes
        if d:
            before_models_committed.emit(changes=d.values())
        return EXT_CONTINUE

    def after_commit(self, session):
        d = session._model_changes
        if d:

# Path: solace/signals.py
# def _ref(func):
#     def __init__(self, im_self, im_func, im_class):
#     def resolve(self):
# def SIG(name, args=None):
#     def __init__(self, name, args=None, _frm=None):
#     def connect(self, func):
#     def is_connected(self, func):
#     def get_connections(self):
#     def disconnect(self, func):
#     def emit(self, **args):
#     def __reduce__(self):
#     def __repr__(self):
#     def emit(self, **args):
# def temporary_connection(func, signal):
# def handler(signal):
#     def decorator(func):
# class _MethodRef(object):
# class Signal(object):
# class _BroadcastSignal(Signal):
# 
# Path: solace/settings.py
# def configure(**values):
# def revert_to_default():
# def autodiscover_settings():
# def configure_from_file(filename):
# def describe_settings():


# Path: solace/database.py
import sys
import time
    import solace.schema
    import solace.schema
from threading import Lock
from datetime import datetime
from babel import Locale
from sqlalchemy.types import TypeDecorator
from sqlalchemy.engine.url import make_url
from sqlalchemy.interfaces import ConnectionProxy
from sqlalchemy.orm.session import Session
from sqlalchemy.orm.interfaces import SessionExtension, MapperExtension, \
     EXT_CONTINUE
from sqlalchemy.util import to_list
from sqlalchemy import String, orm, sql, create_engine, MetaData
            from solace.badges import badges_by_id
        from solace.application import Request
from solace.signals import after_request_shutdown, before_response_sent, \
     after_cursor_executed, before_cursor_executed, before_models_committed, \
     after_models_committed
from solace import settings

class SignalTrackingMapperExtension(MapperExtension):
    """Remembers model changes for the session commit code."""

    def after_delete(self, mapper, connection, instance):
        return self._record(instance, 'delete')

    def after_insert(self, mapper, connection, instance):
        return self._record(instance, 'insert')

    def after_update(self, mapper, connection, instance):
        return self._record(instance, 'update')

    def _record(self, model, operation):
        pk = tuple(orm.object_mapper(model).primary_key_from_instance(model))
        orm.object_session(model)._model_changes[pk] = (model, operation)
        return EXT_CONTINUE


class SignalEmittingSessionExtension(SessionExtension):
    """Emits signals the mapper extension accumulated."""

    def before_commit(self, session):
        d = session._model_changes
        if d:
            before_models_committed.emit(changes=d.values())
        return EXT_CONTINUE

    def after_commit(self, session):
        d = session._model_changes
        if d:

            after_models_committed.emit(changes=d.values())