<s> """<STR_LIT>""" <EOL> from . import event , exc <EOL> from . pool import Pool <EOL> from . engine import Connectable , Engine , Dialect <EOL> from . sql . base import SchemaEventTarget <EOL> class DDLEvents ( event . Events ) : <EOL> """<STR_LIT>""" <EOL> _target_class_doc = "<STR_LIT>" <EOL> _dispatch_target = SchemaEventTarget <EOL> def before_create ( self , target , connection , ** kw ) : <EOL> """<STR_LIT>""" <EOL> def after_create ( self , target , connection , ** kw ) : <EOL> """<STR_LIT>""" <EOL> def before_drop ( self , target , connection , ** kw ) : <EOL> """<STR_LIT>""" <EOL> def after_drop ( self , target , connection , ** kw ) : <EOL> """<STR_LIT>""" <EOL> def before_parent_attach ( self , target , parent ) : <EOL> """<STR_LIT>""" <EOL> def after_parent_attach ( self , target , parent ) : <EOL> """<STR_LIT>""" <EOL> def column_reflect ( self , inspector , table , column_info ) : <EOL> """<STR_LIT>""" <EOL> class PoolEvents ( event . Events ) : <EOL> """<STR_LIT>""" <EOL> _target_class_doc = "<STR_LIT>" <EOL> _dispatch_target = Pool <EOL> @ classmethod <EOL> def _accept_with ( cls , target ) : <EOL> if isinstance ( target , type ) : <EOL> if issubclass ( target , Engine ) : <EOL> return Pool <EOL> elif issubclass ( target , Pool ) : <EOL> return target <EOL> elif isinstance ( target , Engine ) : <EOL> return target . pool <EOL> else : <EOL> return target <EOL> def connect ( self , dbapi_connection , connection_record ) : <EOL> """<STR_LIT>""" <EOL> def first_connect ( self , dbapi_connection , connection_record ) : <EOL> """<STR_LIT>""" <EOL> def checkout ( self , dbapi_connection , connection_record , connection_proxy ) : <EOL> """<STR_LIT>""" <EOL> def checkin ( self , dbapi_connection , connection_record ) : <EOL> """<STR_LIT>""" <EOL> def reset ( self , dbapi_connection , connection_record ) : <EOL> """<STR_LIT>""" <EOL> def invalidate ( self , dbapi_connection , connection_record , exception ) : <EOL> """<STR_LIT>""" <EOL> def soft_invalidate ( self , dbapi_connection , connection_record , exception ) : <EOL> """<STR_LIT>""" <EOL> def close ( self , dbapi_connection , connection_record ) : <EOL> """<STR_LIT>""" <EOL> def detach ( self , dbapi_connection , connection_record ) : <EOL> """<STR_LIT>""" <EOL> def close_detached ( self , dbapi_connection ) : <EOL> """<STR_LIT>""" <EOL> class ConnectionEvents ( event . Events ) : <EOL> """<STR_LIT>""" <EOL> _target_class_doc = "<STR_LIT>" <EOL> _dispatch_target = Connectable <EOL> @ classmethod <EOL> def _listen ( cls , event_key , retval = False ) : <EOL> target , identifier , fn = event_key . dispatch_target , event_key . identifier , event_key . _listen_fn <EOL> target . _has_events = True <EOL> if not retval : <EOL> if identifier == '<STR_LIT>' : <EOL> orig_fn = fn <EOL> def wrap_before_execute ( conn , clauseelement , <EOL> multiparams , params ) : <EOL> orig_fn ( conn , clauseelement , multiparams , params ) <EOL> return clauseelement , multiparams , params <EOL> fn = wrap_before_execute <EOL> elif identifier == '<STR_LIT>' : <EOL> orig_fn = fn <EOL> def wrap_before_cursor_execute ( conn , cursor , statement , <EOL> parameters , context , <EOL> executemany ) : <EOL> orig_fn ( conn , cursor , statement , <EOL> parameters , context , executemany ) <EOL> return statement , parameters <EOL> fn = wrap_before_cursor_execute <EOL> elif retval and identifier not in ( '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ) : <EOL> raise exc . ArgumentError ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> event_key . with_wrapper ( fn ) . base_listen ( ) <EOL> def before_execute ( self , conn , clauseelement , multiparams , params ) : <EOL> """<STR_LIT>""" <EOL> def after_execute ( self , conn , clauseelement , multiparams , params , result ) : <EOL> """<STR_LIT>""" <EOL> def before_cursor_execute ( self , conn , cursor , statement , <EOL> parameters , context , executemany ) : <EOL> """<STR_LIT>""" <EOL> def after_cursor_execute ( self , conn , cursor , statement , <EOL> parameters , context , executemany ) : <EOL> """<STR_LIT>""" <EOL> def dbapi_error ( self , conn , cursor , statement , parameters , <EOL> context , exception ) : <EOL> """<STR_LIT>""" <EOL> def handle_error ( self , exception_context ) : <EOL> """<STR_LIT>""" <EOL> def engine_connect ( self , conn , branch ) : <EOL> """<STR_LIT>""" <EOL> def set_connection_execution_options ( self , conn , opts ) : <EOL> """<STR_LIT>""" <EOL> def set_engine_execution_options ( self , engine , opts ) : <EOL> """<STR_LIT>""" <EOL> def engine_disposed ( self , engine ) : <EOL> """<STR_LIT>""" <EOL> def begin ( self , conn ) : <EOL> """<STR_LIT>""" <EOL> def rollback ( self , conn ) : <EOL> """<STR_LIT>""" <EOL> def commit ( self , conn ) : <EOL> """<STR_LIT>""" <EOL> def savepoint ( self , conn , name ) : <EOL> """<STR_LIT>""" <EOL> def rollback_savepoint ( self , conn , name , context ) : <EOL> """<STR_LIT>""" <EOL> def release_savepoint ( self , conn , name , context ) : <EOL> """<STR_LIT>""" <EOL> def begin_twophase ( self , conn , xid ) : <EOL> """<STR_LIT>""" <EOL> def prepare_twophase ( self , conn , xid ) : <EOL> """<STR_LIT>""" <EOL> def rollback_twophase ( self , conn , xid , is_prepared ) : <EOL> """<STR_LIT>""" <EOL> def commit_twophase ( self , conn , xid , is_prepared ) : <EOL> """<STR_LIT>""" <EOL> class DialectEvents ( event . Events ) : <EOL> """<STR_LIT>""" <EOL> _target_class_doc = "<STR_LIT>" <EOL> _dispatch_target = Dialect <EOL> @ classmethod <EOL> def _listen ( cls , event_key , retval = False ) : <EOL> target , identifier , fn = event_key . dispatch_target , event_key . identifier , event_key . fn <EOL> target . _has_events = True <EOL> event_key . base_listen ( ) <EOL> @ classmethod <EOL> def _accept_with ( cls , target ) : <EOL> if isinstance ( target , type ) : <EOL> if issubclass ( target , Engine ) : <EOL> return Dialect <EOL> elif issubclass ( target , Dialect ) : <EOL> return target <EOL> elif isinstance ( target , Engine ) : <EOL> return target . dialect <EOL> else : <EOL> return target <EOL> def do_connect ( self , dialect , conn_rec , cargs , cparams ) : <EOL> """<STR_LIT>""" <EOL> def do_executemany ( self , cursor , statement , parameters , context ) : <EOL> """<STR_LIT>""" <EOL> def do_execute_no_params ( self , cursor , statement , context ) : <EOL> """<STR_LIT>""" <EOL> def do_execute ( self , cursor , statement , parameters , context ) : <EOL> """<STR_LIT>""" </s>
