Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
‹EYc@s»dZddlmZmZmZddlmZddlZddlZddlm	Z	ddlm
Z
mZdd	lm
Z
mZdd
lmZddlmZddlmZdd
lmZdejfd„ƒYZdefd„ƒYZdejfd„ƒYZdejfd„ƒYZdefd„ƒYZdejfd„ƒYZdefd„ƒYZ dejfd„ƒYZ!dejfd„ƒYZ"d ejfd!„ƒYZ#dS("sORM event interfaces.

i(teventtexctutili(t_mapper_or_noneiÿÿÿÿN(t
interfaces(t	mapperlibtinstrumentation(tSessiontsessionmaker(tscoped_session(tQueryableAttribute(tQuery(tinspect_getargspectInstrumentationEventscBsheZdZdZejZed„ƒZee	d„ƒZ
ed„ƒZd„Zd„Z
d„ZRS(sqEvents related to class instrumentation events.

    The listeners here support being established against
    any new style class, that is any object that is a subclass
    of 'type'.  Events will then be fired off for events
    against that class.  If the "propagate=True" flag is passed
    to event.listen(), the event will fire off for subclasses
    of that class as well.

    The Python ``type`` builtin is also accepted as a target,
    which when used has the effect of events being emitted
    for all classes.

    Note the "propagate" flag here is defaulted to ``True``,
    unlike the other class level events where it defaults
    to ``False``.  This means that new subclasses will also
    be the subject of these events, when a listener
    is established on a superclass.

    .. versionchanged:: 0.8 - events here will emit based
       on comparing the incoming class to the type of class
       passed to :func:`.event.listen`.  Previously, the
       event would fire for any class unconditionally regardless
       of what class was sent for listening, despite
       documentation which stated the contrary.

    t
SomeBaseClasscCs!t|tƒrt|ƒSdSdS(N(t
isinstancettypet_InstrumentationEventsHoldtNone(tclsttarget((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt_accept_with7s
cs|j|j|j‰‰‰‡‡‡fd†‰‡‡fd†}tjˆj|ƒ‰|jtjƒj	ˆƒj
|dS(NcsOˆƒ}ˆr+t||ƒr+ˆ||ŒSˆrK||krKˆ||ŒSdS(N(t
issubclass(t
target_clstargt
listen_cls(tfnt	propagateR(sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytlistenDs
	
cs>tjjdˆˆtjƒ}ttjjˆƒj|ƒdS(N(	Rtregistryt	_EventKeyRRt_instrumentation_factorytgetattrtdispatchtremove(treftkey(t
identifierR(sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR"Ks
		(tdispatch_targetR%t
_listen_fntweakrefR#tclass_twith_dispatch_targetRRtwith_wrappertbase_listen(Rt	event_keyRtkwR"((RR%RRRsJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt_listen>scCs'tt|ƒjƒtjjjƒdS(N(tsuperR
t_clearRRR!(R((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR1XscCsdS(sCalled after the given class is instrumented.

        To get at the :class:`.ClassManager`, use
        :func:`.manager_of_class`.

        N((tselfR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytclass_instrument]scCsdS(sCalled before the given class is uninstrumented.

        To get at the :class:`.ClassManager`, use
        :func:`.manager_of_class`.

        N((R2R((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytclass_uninstrumentescCsdS(s)Called when an attribute is instrumented.N((R2RR$tinst((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytattribute_instrumentms(t__name__t
__module__t__doc__t_target_class_docRtInstrumentationFactoryt_dispatch_targettclassmethodRtTrueR/R1R3R4R6(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR
s			RcBs&eZdZd„ZejeƒZRS(swtemporary marker object used to transfer from _accept_with() to
    _listen() on the InstrumentationEvents class.

    cCs
||_dS(N(R)(R2R)((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt__init__ws(R7R8R9R?Rt
dispatcherR
R!(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRqs	tInstanceEventscBs¿eZdZdZejZed„ƒZee	j
dƒd„ƒƒZeeed„ƒZ
ed„ƒZd„Zd„Zd	„Zd
„Zd„Zd„Zd
„Zd„Zd„ZRS(sCDefine events specific to object lifecycle.

    e.g.::

        from sqlalchemy import event

        def my_load_listener(target, context):
            print "on load!"

        event.listen(SomeClass, 'load', my_load_listener)

    Available targets include:

    * mapped classes
    * unmapped superclasses of mapped or to-be-mapped classes
      (using the ``propagate=True`` flag)
    * :class:`.Mapper` objects
    * the :class:`.Mapper` class itself and the :func:`.mapper`
      function indicate listening for all mappers.

    .. versionchanged:: 0.8.0 instance events can be associated with
       unmapped superclasses of mapped classes.

    Instance events are closely related to mapper events, but
    are more specific to the instance and its instrumentation,
    rather than its system of persistence.

    When using :class:`.InstanceEvents`, several modifiers are
    available to the :func:`.event.listen` function.

    :param propagate=False: When True, the event listener should
       be applied to all inheriting classes as well as the
       class which is the target of this listener.
    :param raw=False: When True, the "target" argument passed
       to applicable event listener functions will be the
       instance's :class:`.InstanceState` management
       object, rather than the mapped instance itself.

    t	SomeClasscCstj||ƒdS(N(t_InstanceEventsHoldtpopulate(RR)tclassmanager((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt_new_classmanager_instanceªsssqlalchemy.ormcCs—t|tjƒr|St|tjƒr/|jS||jkrEtjSt|tƒr“t|tjƒrmtjStj	|ƒ}|r†|St
|ƒSndS(N(RRtClassManagerRtMappert
class_managertmapperRRtmanager_of_classRCR(RtormRtmanager((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR®s
c	s—|j|j|j}}‰|sD‡fd†}|j|ƒ}n|jd|||r“x3|jtƒD]}|j|ƒjdtƒqmWndS(Ncsˆ|jƒ||ŽS(N(tobj(tstateRR.(R(sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytwrapÉsR(R&R%R'R+R,tsubclass_managersR>R*(	RR-trawRR.RR%RPtmgr((RsJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR/ÂscCs!tt|ƒjƒtjƒdS(N(R0RAR1RC(R((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR1ÔscCsdS(s]Called when the first instance of a particular mapping is called.

        This event is called when the ``__init__`` method of a class
        is called the first time for that particular class.    The event
        invokes before ``__init__`` actually proceeds as well as before
        the :meth:`.InstanceEvents.init` event is invoked.

        N((R2RMR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt
first_initÙscCsdS(sÅReceive an instance when its constructor is called.

        This method is only called during a userland construction of
        an object, in conjunction with the object's constructor, e.g.
        its ``__init__`` method.  It is not called when an object is
        loaded from the database; see the :meth:`.InstanceEvents.load`
        event in order to intercept a database load.

        The event is called before the actual ``__init__`` constructor
        of the object is called.  The ``kwargs`` dictionary may be
        modified in-place in order to affect what is passed to
        ``__init__``.

        :param target: the mapped instance.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :param args: positional arguments passed to the ``__init__`` method.
         This is passed as a tuple and is currently immutable.
        :param kwargs: keyword arguments passed to the ``__init__`` method.
         This structure *can* be altered in place.

        .. seealso::

            :meth:`.InstanceEvents.init_failure`

            :meth:`.InstanceEvents.load`

        N((R2Rtargstkwargs((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytinitãscCsdS(sÇReceive an instance when its constructor has been called,
        and raised an exception.

        This method is only called during a userland construction of
        an object, in conjunction with the object's constructor, e.g.
        its ``__init__`` method. It is not called when an object is loaded
        from the database.

        The event is invoked after an exception raised by the ``__init__``
        method is caught.  After the event
        is invoked, the original exception is re-raised outwards, so that
        the construction of the object still raises an exception.   The
        actual exception and stack trace raised should be present in
        ``sys.exc_info()``.

        :param target: the mapped instance.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :param args: positional arguments that were passed to the ``__init__``
         method.
        :param kwargs: keyword arguments that were passed to the ``__init__``
         method.

        .. seealso::

            :meth:`.InstanceEvents.init`

            :meth:`.InstanceEvents.load`

        N((R2RRURV((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytinit_failurescCsdS(s—Receive an object instance after it has been created via
        ``__new__``, and after initial attribute population has
        occurred.

        This typically occurs when the instance is created based on
        incoming result rows, and is only called once for that
        instance's lifetime.

        Note that during a result-row load, this method is called upon
        the first row received for this instance.  Note that some
        attributes and collections may or may not be loaded or even
        initialized, depending on what's present in the result rows.

        :param target: the mapped instance.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :param context: the :class:`.QueryContext` corresponding to the
         current :class:`.Query` in progress.  This argument may be
         ``None`` if the load does not correspond to a :class:`.Query`,
         such as during :meth:`.Session.merge`.

        .. seealso::

            :meth:`.InstanceEvents.init`

            :meth:`.InstanceEvents.refresh`

        N((R2Rtcontext((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytload#scCsdS(s)Receive an object instance after one or more attributes have
        been refreshed from a query.

        Contrast this to the :meth:`.InstanceEvents.load` method, which
        is invoked when the object is first loaded from a query.

        :param target: the mapped instance.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :param context: the :class:`.QueryContext` corresponding to the
         current :class:`.Query` in progress.
        :param attrs: sequence of attribute names which
         were populated, or None if all column-mapped, non-deferred
         attributes were populated.

        .. seealso::

            :meth:`.InstanceEvents.load`

        N((R2RRYtattrs((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytrefreshBscCsdS(s„Receive an object instance after one or more attributes have
        been refreshed within the persistence of the object.

        This event is the same as :meth:`.InstanceEvents.refresh` except
        it is invoked within the unit of work flush process, and the values
        here typically come from the process of handling an INSERT or
        UPDATE, such as via the RETURNING clause or from Python-side default
        values.

        .. versionadded:: 1.0.5

        :param target: the mapped instance.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :param flush_context: Internal :class:`.UOWTransaction` object
         which handles the details of the flush.
        :param attrs: sequence of attribute names which
         were populated.

        N((R2Rt
flush_contextR[((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt
refresh_flushYscCsdS(sReceive an object instance after its attributes or some subset
        have been expired.

        'keys' is a list of attribute names.  If None, the entire
        state was expired.

        :param target: the mapped instance.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :param attrs: sequence of attribute
         names which were expired, or None if all attributes were
         expired.

        N((R2RR[((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytexpirepscCsdS(sÈReceive an object instance when its associated state is
        being pickled.

        :param target: the mapped instance.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :param state_dict: the dictionary returned by
         :class:`.InstanceState.__getstate__`, containing the state
         to be pickled.

        N((R2Rt
state_dict((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytpicklescCsdS(sÖReceive an object instance after its associated state has
        been unpickled.

        :param target: the mapped instance.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :param state_dict: the dictionary sent to
         :class:`.InstanceState.__setstate__`, containing the state
         dictionary which was pickled.

        N((R2RR`((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytunpickles(R7R8R9R:RRGR<R=RFRtdependenciesRtFalseR/R1RTRWRXRZR\R^R_RaRb(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRA}s$'		
		!					t_EventsHoldcBsTeZdZd„Zed„ƒZdefd„ƒYZd„Zed„ƒZ	RS(s¶Hold onto listeners against unmapped, uninstrumented classes.

    Establish _listen() for that class' mapper/instrumentation when
    those objects are created for that class.

    cCs
||_dS(N(R)(R2R)((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR?¦scCs|jjƒdS(N(t	all_holdstclear(R((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR1©st
HoldEventscBs#eZdZeeed„ƒZRS(cKs|j|j|j}}}|j|jkrB|j|j}ni}|j|j<tjj||ƒ|||f||j<|rt	|jj
ƒƒ}	xo|	r|	jdƒ}
|	j|
j
ƒƒ|j
|
ƒ}|dk	r|j|ƒjd|dt|qqWndS(NiRRR(R&R%RR)RfRRt_stored_in_collectiont_keytlistt__subclasses__tpoptextendtresolveRR*RRd(RR-RRRR.RR%Rt
collectiontstacktsubclasstsubject((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR/°s	N(R7R8RR<R=RdR/(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRh­scCsM|j|j|j}}}t|tƒrI|j|j}||j=ndS(N(R&R%RRReRfR)Rj(R2R-RR%RRp((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR"ÉscCs‹x„|jD]y}||jkr
|j|}xT|jƒD]C\}}}|sZ||kr9|j|ƒjd|dtƒq9q9Wq
q
WdS(NRRR(t__mro__RftvaluesR*RRd(RR)RsRrRpR-RRR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRDÑs
(
R7R8R9R?R=R1tobjectRhR"RD(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRežs		RCcBsHeZejƒZd„Zdejefd„ƒYZ	e
je	ƒZRS(cCs
tj|ƒS(N(RRK(R2R)((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRoästHoldInstanceEventscBseZRS((R7R8(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRwçs(
R7R8R(tWeakKeyDictionaryRfRoReRhRARwRR@R!(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRCás	tMapperEventscBsËeZdZdZejZed„ƒZee	j
dƒd„ƒƒZeeeed„ƒZ
ed„ƒZd„Zd„Zd	„Zd
„Zd„Zd„Zd
„Zd„Zd„Zd„ZRS(sTDefine events specific to mappings.

    e.g.::

        from sqlalchemy import event

        def my_before_insert_listener(mapper, connection, target):
            # execute a stored procedure upon INSERT,
            # apply the value to the row to be inserted
            target.calculated_value = connection.scalar(
                                        "select my_special_function(%d)"
                                        % target.special_number)

        # associate the listener function with SomeClass,
        # to execute during the "before_insert" hook
        event.listen(
            SomeClass, 'before_insert', my_before_insert_listener)

    Available targets include:

    * mapped classes
    * unmapped superclasses of mapped or to-be-mapped classes
      (using the ``propagate=True`` flag)
    * :class:`.Mapper` objects
    * the :class:`.Mapper` class itself and the :func:`.mapper`
      function indicate listening for all mappers.

    .. versionchanged:: 0.8.0 mapper events can be associated with
       unmapped superclasses of mapped classes.

    Mapper events provide hooks into critical sections of the
    mapper, including those related to object instrumentation,
    object loading, and object persistence. In particular, the
    persistence methods :meth:`~.MapperEvents.before_insert`,
    and :meth:`~.MapperEvents.before_update` are popular
    places to augment the state being persisted - however, these
    methods operate with several significant restrictions. The
    user is encouraged to evaluate the
    :meth:`.SessionEvents.before_flush` and
    :meth:`.SessionEvents.after_flush` methods as more
    flexible and user-friendly hooks in which to apply
    additional database state during a flush.

    When using :class:`.MapperEvents`, several modifiers are
    available to the :func:`.event.listen` function.

    :param propagate=False: When True, the event listener should
       be applied to all inheriting mappers and/or the mappers of
       inheriting classes, as well as any
       mapper which is the target of this listener.
    :param raw=False: When True, the "target" argument passed
       to applicable event listener functions will be the
       instance's :class:`.InstanceState` management
       object, rather than the mapped instance itself.
    :param retval=False: when True, the user-defined event function
       must have a return value, the purpose of which is either to
       control subsequent event propagation, or to otherwise alter
       the operation in progress by the mapper.   Possible return
       values are:

       * ``sqlalchemy.orm.interfaces.EXT_CONTINUE`` - continue event
         processing normally.
       * ``sqlalchemy.orm.interfaces.EXT_STOP`` - cancel all subsequent
         event handlers in the chain.
       * other values - the return value specified by specific listeners.

    RBcCstj||ƒdS(N(t_MapperEventsHoldRD(RR)RJ((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt_new_mapper_instance5sssqlalchemy.ormcCsl||jkrtjSt|tƒrdt|tjƒr;|St|ƒ}|dk	rW|St|ƒSn|SdS(N(	RJRRHRRRRRRz(RRLRRJ((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR9s
cs|j|j|j}}‰|d	krH|tjk	rHtjdƒnˆsVˆrӈs©t||ƒ}y!t|ƒdj	dƒd‰Wq©t
k
r¥d‰q©Xn‡‡‡‡fd†}	|j|	ƒ}n|rx=|j
D]"}
|j|
ƒjdt|qãWn
|j|dS(
Ntbefore_configuredtafter_configureds{'before_configured' and 'after_configured' ORM events only invoke with the mapper() function or Mapper class as the target.iRicsaˆr6ˆdk	r6t|ƒ}|ˆjƒ|ˆ<nˆsPˆ||ŽtjSˆ||ŽSdS(N(RRkRNRtEXT_CONTINUE(RR.(RRRtretvalttarget_index(sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRPas
R(sbefore_configuredsafter_configured(R&R%R'RRHRtwarnR Rtindext
ValueErrorRR+tself_and_descendantsR*R,R>(RR-RRRRR.RR%tmethRPRJ((RRRRR€sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR/Js(
!

	cCs!tt|ƒjƒtjƒdS(N(R0RyR1Rz(R((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR1sscCsdS(sReceive a class when the mapper is first constructed,
        before instrumentation is applied to the mapped class.

        This event is the earliest phase of mapper construction.
        Most attributes of the mapper are not yet initialized.

        This listener can either be applied to the :class:`.Mapper`
        class overall, or to any un-mapped class which serves as a base
        for classes that will be mapped (using the ``propagate=True`` flag)::

            Base = declarative_base()

            @event.listens_for(Base, "instrument_class", propagate=True)
            def on_new_class(mapper, cls_):
                " ... "

        :param mapper: the :class:`.Mapper` which is the target
         of this event.
        :param class\_: the mapped class.

        N((R2RJR)((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytinstrument_classxscCsdS(s×Called when a specific mapper has completed its own configuration
        within the scope of the :func:`.configure_mappers` call.

        The :meth:`.MapperEvents.mapper_configured` event is invoked
        for each mapper that is encountered when the
        :func:`.orm.configure_mappers` function proceeds through the current
        list of not-yet-configured mappers.
        :func:`.orm.configure_mappers` is typically invoked
        automatically as mappings are first used, as well as each time
        new mappers have been made available and new mapper use is
        detected.

        When the event is called, the mapper should be in its final
        state, but **not including backrefs** that may be invoked from
        other mappers; they might still be pending within the
        configuration operation.    Bidirectional relationships that
        are instead configured via the
        :paramref:`.orm.relationship.back_populates` argument
        *will* be fully available, since this style of relationship does not
        rely upon other possibly-not-configured mappers to know that they
        exist.

        For an event that is guaranteed to have **all** mappers ready
        to go including backrefs that are defined only on other
        mappings, use the :meth:`.MapperEvents.after_configured`
        event; this event invokes only after all known mappings have been
        fully configured.

        The :meth:`.MapperEvents.mapper_configured` event, unlike
        :meth:`.MapperEvents.before_configured` or
        :meth:`.MapperEvents.after_configured`,
        is called for each mapper/class individually, and the mapper is
        passed to the event itself.  It also is called exactly once for
        a particular mapper.  The event is therefore useful for
        configurational steps that benefit from being invoked just once
        on a specific mapper basis, which don't require that "backref"
        configurations are necessarily ready yet.

        :param mapper: the :class:`.Mapper` which is the target
         of this event.
        :param class\_: the mapped class.

        .. seealso::

            :meth:`.MapperEvents.before_configured`

            :meth:`.MapperEvents.after_configured`

        N((R2RJR)((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytmapper_configuredscCsdS(sšCalled before a series of mappers have been configured.

        The :meth:`.MapperEvents.before_configured` event is invoked
        each time the :func:`.orm.configure_mappers` function is
        invoked, before the function has done any of its work.
        :func:`.orm.configure_mappers` is typically invoked
        automatically as mappings are first used, as well as each time
        new mappers have been made available and new mapper use is
        detected.

        This event can **only** be applied to the :class:`.Mapper` class
        or :func:`.mapper` function, and not to individual mappings or
        mapped classes.  It is only invoked for all mappings as a whole::

            from sqlalchemy.orm import mapper

            @event.listens_for(mapper, "before_configured")
            def go():
                # ...

        Constrast this event to :meth:`.MapperEvents.after_configured`,
        which is invoked after the series of mappers has been configured,
        as well as :meth:`.MapperEvents.mapper_configured`, which is invoked
        on a per-mapper basis as each one is configured to the extent possible.

        Theoretically this event is called once per
        application, but is actually called any time new mappers
        are to be affected by a :func:`.orm.configure_mappers`
        call.   If new mappings are constructed after existing ones have
        already been used, this event will likely be called again.  To ensure
        that a particular event is only called once and no further, the
        ``once=True`` argument (new in 0.9.4) can be applied::

            from sqlalchemy.orm import mapper

            @event.listens_for(mapper, "before_configured", once=True)
            def go():
                # ...


        .. versionadded:: 0.9.3


        .. seealso::

            :meth:`.MapperEvents.mapper_configured`

            :meth:`.MapperEvents.after_configured`

        N((R2((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR|ÃscCsdS(s2Called after a series of mappers have been configured.

        The :meth:`.MapperEvents.after_configured` event is invoked
        each time the :func:`.orm.configure_mappers` function is
        invoked, after the function has completed its work.
        :func:`.orm.configure_mappers` is typically invoked
        automatically as mappings are first used, as well as each time
        new mappers have been made available and new mapper use is
        detected.

        Contrast this event to the :meth:`.MapperEvents.mapper_configured`
        event, which is called on a per-mapper basis while the configuration
        operation proceeds; unlike that event, when this event is invoked,
        all cross-configurations (e.g. backrefs) will also have been made
        available for any mappers that were pending.
        Also constrast to :meth:`.MapperEvents.before_configured`,
        which is invoked before the series of mappers has been configured.

        This event can **only** be applied to the :class:`.Mapper` class
        or :func:`.mapper` function, and not to individual mappings or
        mapped classes.  It is only invoked for all mappings as a whole::

            from sqlalchemy.orm import mapper

            @event.listens_for(mapper, "after_configured")
            def go():
                # ...

        Theoretically this event is called once per
        application, but is actually called any time new mappers
        have been affected by a :func:`.orm.configure_mappers`
        call.   If new mappings are constructed after existing ones have
        already been used, this event will likely be called again.  To ensure
        that a particular event is only called once and no further, the
        ``once=True`` argument (new in 0.9.4) can be applied::

            from sqlalchemy.orm import mapper

            @event.listens_for(mapper, "after_configured", once=True)
            def go():
                # ...

        .. seealso::

            :meth:`.MapperEvents.mapper_configured`

            :meth:`.MapperEvents.before_configured`

        N((R2((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR}÷scCsdS(sÁReceive an object instance before an INSERT statement
        is emitted corresponding to that instance.

        This event is used to modify local, non-object related
        attributes on the instance before an INSERT occurs, as well
        as to emit additional SQL statements on the given
        connection.

        The event is often called for a batch of objects of the
        same class before their INSERT statements are emitted at
        once in a later step. In the extremely rare case that
        this is not desirable, the :func:`.mapper` can be
        configured with ``batch=False``, which will cause
        batches of instances to be broken up into individual
        (and more poorly performing) event->persist->event
        steps.

        .. warning::

            Mapper-level flush events only allow **very limited operations**,
            on attributes local to the row being operated upon only,
            as well as allowing any SQL to be emitted on the given
            :class:`.Connection`.  **Please read fully** the notes
            at :ref:`session_persistence_mapper` for guidelines on using
            these methods; generally, the :meth:`.SessionEvents.before_flush`
            method should be preferred for general on-flush changes.

        :param mapper: the :class:`.Mapper` which is the target
         of this event.
        :param connection: the :class:`.Connection` being used to
         emit INSERT statements for this instance.  This
         provides a handle into the current transaction on the
         target database specific to this instance.
        :param target: the mapped instance being persisted.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :return: No return value is supported by this event.

        .. seealso::

            :ref:`session_persistence_events`

        N((R2RJt
connectionR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt
before_insert*scCsdS(s·Receive an object instance after an INSERT statement
        is emitted corresponding to that instance.

        This event is used to modify in-Python-only
        state on the instance after an INSERT occurs, as well
        as to emit additional SQL statements on the given
        connection.

        The event is often called for a batch of objects of the
        same class after their INSERT statements have been
        emitted at once in a previous step. In the extremely
        rare case that this is not desirable, the
        :func:`.mapper` can be configured with ``batch=False``,
        which will cause batches of instances to be broken up
        into individual (and more poorly performing)
        event->persist->event steps.

        .. warning::

            Mapper-level flush events only allow **very limited operations**,
            on attributes local to the row being operated upon only,
            as well as allowing any SQL to be emitted on the given
            :class:`.Connection`.  **Please read fully** the notes
            at :ref:`session_persistence_mapper` for guidelines on using
            these methods; generally, the :meth:`.SessionEvents.before_flush`
            method should be preferred for general on-flush changes.

        :param mapper: the :class:`.Mapper` which is the target
         of this event.
        :param connection: the :class:`.Connection` being used to
         emit INSERT statements for this instance.  This
         provides a handle into the current transaction on the
         target database specific to this instance.
        :param target: the mapped instance being persisted.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :return: No return value is supported by this event.

        .. seealso::

            :ref:`session_persistence_events`

        N((R2RJRˆR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_insertXscCsdS(s Receive an object instance before an UPDATE statement
        is emitted corresponding to that instance.

        This event is used to modify local, non-object related
        attributes on the instance before an UPDATE occurs, as well
        as to emit additional SQL statements on the given
        connection.

        This method is called for all instances that are
        marked as "dirty", *even those which have no net changes
        to their column-based attributes*. An object is marked
        as dirty when any of its column-based attributes have a
        "set attribute" operation called or when any of its
        collections are modified. If, at update time, no
        column-based attributes have any net changes, no UPDATE
        statement will be issued. This means that an instance
        being sent to :meth:`~.MapperEvents.before_update` is
        *not* a guarantee that an UPDATE statement will be
        issued, although you can affect the outcome here by
        modifying attributes so that a net change in value does
        exist.

        To detect if the column-based attributes on the object have net
        changes, and will therefore generate an UPDATE statement, use
        ``object_session(instance).is_modified(instance,
        include_collections=False)``.

        The event is often called for a batch of objects of the
        same class before their UPDATE statements are emitted at
        once in a later step. In the extremely rare case that
        this is not desirable, the :func:`.mapper` can be
        configured with ``batch=False``, which will cause
        batches of instances to be broken up into individual
        (and more poorly performing) event->persist->event
        steps.

        .. warning::

            Mapper-level flush events only allow **very limited operations**,
            on attributes local to the row being operated upon only,
            as well as allowing any SQL to be emitted on the given
            :class:`.Connection`.  **Please read fully** the notes
            at :ref:`session_persistence_mapper` for guidelines on using
            these methods; generally, the :meth:`.SessionEvents.before_flush`
            method should be preferred for general on-flush changes.

        :param mapper: the :class:`.Mapper` which is the target
         of this event.
        :param connection: the :class:`.Connection` being used to
         emit UPDATE statements for this instance.  This
         provides a handle into the current transaction on the
         target database specific to this instance.
        :param target: the mapped instance being persisted.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :return: No return value is supported by this event.

        .. seealso::

            :ref:`session_persistence_events`

        N((R2RJRˆR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt
before_update†scCsdS(sRReceive an object instance after an UPDATE statement
        is emitted corresponding to that instance.

        This event is used to modify in-Python-only
        state on the instance after an UPDATE occurs, as well
        as to emit additional SQL statements on the given
        connection.

        This method is called for all instances that are
        marked as "dirty", *even those which have no net changes
        to their column-based attributes*, and for which
        no UPDATE statement has proceeded. An object is marked
        as dirty when any of its column-based attributes have a
        "set attribute" operation called or when any of its
        collections are modified. If, at update time, no
        column-based attributes have any net changes, no UPDATE
        statement will be issued. This means that an instance
        being sent to :meth:`~.MapperEvents.after_update` is
        *not* a guarantee that an UPDATE statement has been
        issued.

        To detect if the column-based attributes on the object have net
        changes, and therefore resulted in an UPDATE statement, use
        ``object_session(instance).is_modified(instance,
        include_collections=False)``.

        The event is often called for a batch of objects of the
        same class after their UPDATE statements have been emitted at
        once in a previous step. In the extremely rare case that
        this is not desirable, the :func:`.mapper` can be
        configured with ``batch=False``, which will cause
        batches of instances to be broken up into individual
        (and more poorly performing) event->persist->event
        steps.

        .. warning::

            Mapper-level flush events only allow **very limited operations**,
            on attributes local to the row being operated upon only,
            as well as allowing any SQL to be emitted on the given
            :class:`.Connection`.  **Please read fully** the notes
            at :ref:`session_persistence_mapper` for guidelines on using
            these methods; generally, the :meth:`.SessionEvents.before_flush`
            method should be preferred for general on-flush changes.

        :param mapper: the :class:`.Mapper` which is the target
         of this event.
        :param connection: the :class:`.Connection` being used to
         emit UPDATE statements for this instance.  This
         provides a handle into the current transaction on the
         target database specific to this instance.
        :param target: the mapped instance being persisted.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :return: No return value is supported by this event.

        .. seealso::

            :ref:`session_persistence_events`

        N((R2RJRˆR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_updateÇscCsdS(s‹Receive an object instance before a DELETE statement
        is emitted corresponding to that instance.

        This event is used to emit additional SQL statements on
        the given connection as well as to perform application
        specific bookkeeping related to a deletion event.

        The event is often called for a batch of objects of the
        same class before their DELETE statements are emitted at
        once in a later step.

        .. warning::

            Mapper-level flush events only allow **very limited operations**,
            on attributes local to the row being operated upon only,
            as well as allowing any SQL to be emitted on the given
            :class:`.Connection`.  **Please read fully** the notes
            at :ref:`session_persistence_mapper` for guidelines on using
            these methods; generally, the :meth:`.SessionEvents.before_flush`
            method should be preferred for general on-flush changes.

        :param mapper: the :class:`.Mapper` which is the target
         of this event.
        :param connection: the :class:`.Connection` being used to
         emit DELETE statements for this instance.  This
         provides a handle into the current transaction on the
         target database specific to this instance.
        :param target: the mapped instance being deleted.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :return: No return value is supported by this event.

        .. seealso::

            :ref:`session_persistence_events`

        N((R2RJRˆR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt
before_deletescCsdS(s˜Receive an object instance after a DELETE statement
        has been emitted corresponding to that instance.

        This event is used to emit additional SQL statements on
        the given connection as well as to perform application
        specific bookkeeping related to a deletion event.

        The event is often called for a batch of objects of the
        same class after their DELETE statements have been emitted at
        once in a previous step.

        .. warning::

            Mapper-level flush events only allow **very limited operations**,
            on attributes local to the row being operated upon only,
            as well as allowing any SQL to be emitted on the given
            :class:`.Connection`.  **Please read fully** the notes
            at :ref:`session_persistence_mapper` for guidelines on using
            these methods; generally, the :meth:`.SessionEvents.before_flush`
            method should be preferred for general on-flush changes.

        :param mapper: the :class:`.Mapper` which is the target
         of this event.
        :param connection: the :class:`.Connection` being used to
         emit DELETE statements for this instance.  This
         provides a handle into the current transaction on the
         target database specific to this instance.
        :param target: the mapped instance being deleted.  If
         the event is configured with ``raw=True``, this will
         instead be the :class:`.InstanceState` state-management
         object associated with the instance.
        :return: No return value is supported by this event.

        .. seealso::

            :ref:`session_persistence_events`

        N((R2RJRˆR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_delete/s(R7R8R9R:RRHR<R=R{RRcRRdR/R1R†R‡R|R}R‰RŠR‹RŒRRŽ(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRyís&C	'		4	4	3	.	.	A	@	(RzcBsHeZejƒZd„Zdejefd„ƒYZ	e
je	ƒZRS(cCs
t|ƒS(N(R(R2R)((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRo[stHoldMapperEventscBseZRS((R7R8(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR^s(
R7R8R(RxRfRoReRhRyRRR@R!(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRzXs	t
SessionEventscBsïeZdZdZeZed„ƒZd„Zd„Z	d„Z
d„Zd„Zd„Z
d	„Zd
„Zd„Zd„Zd
„Zd„Zejdddddgd„ƒd„ƒZejdddddgd„ƒd„ƒZRS(s‰Define events specific to :class:`.Session` lifecycle.

    e.g.::

        from sqlalchemy import event
        from sqlalchemy.orm import sessionmaker

        def my_before_commit(session):
            print "before commit!"

        Session = sessionmaker()

        event.listen(Session, "before_commit", my_before_commit)

    The :func:`~.event.listen` function will accept
    :class:`.Session` objects as well as the return result
    of :class:`~.sessionmaker()` and :class:`~.scoped_session()`.

    Additionally, it accepts the :class:`.Session` class which
    will apply listeners to all :class:`.Session` instances
    globally.

    tSomeSessionOrFactorycCsÆt|tƒr]|j}t|tƒr]t|tƒsHt|tƒr]tjdƒ‚q]nt|tƒrs|j	St|tƒr«t|tƒr•tSt|tƒrÂ|Snt|tƒr¾|SdSdS(NsrSession event listen on a scoped_session requires that its creation callable is associated with the Session class.(RR	tsession_factoryRRRRRt
ArgumentErrorR)R(RR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRs"	cCsdS(sqExecute when a new :class:`.SessionTransaction` is created.

        This event differs from :meth:`~.SessionEvents.after_begin`
        in that it occurs for each :class:`.SessionTransaction`
        overall, as opposed to when transactions are begun
        on individual database connections.  It is also invoked
        for nested transactions and subtransactions, and is always
        matched by a corresponding
        :meth:`~.SessionEvents.after_transaction_end` event
        (assuming normal operation of the :class:`.Session`).

        :param session: the target :class:`.Session`.
        :param transaction: the target :class:`.SessionTransaction`.

         To detect if this is the outermost
         :class:`.SessionTransaction`, as opposed to a "subtransaction" or a
         SAVEPOINT, test that the :attr:`.SessionTransaction.parent` attribute
         is ``None``::

                @event.listens_for(session, "after_transaction_create")
                def after_transaction_create(session, transaction):
                    if transaction.parent is None:
                        # work with top-level transaction

         To detect if the :class:`.SessionTransaction` is a SAVEPOINT, use the
         :attr:`.SessionTransaction.nested` attribute::

                @event.listens_for(session, "after_transaction_create")
                def after_transaction_create(session, transaction):
                    if transaction.nested:
                        # work with SAVEPOINT transaction


        .. seealso::

            :class:`.SessionTransaction`

            :meth:`~.SessionEvents.after_transaction_end`

        N((R2tsessionttransaction((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_transaction_createœscCsdS(sßExecute when the span of a :class:`.SessionTransaction` ends.

        This event differs from :meth:`~.SessionEvents.after_commit`
        in that it corresponds to all :class:`.SessionTransaction`
        objects in use, including those for nested transactions
        and subtransactions, and is always matched by a corresponding
        :meth:`~.SessionEvents.after_transaction_create` event.

        :param session: the target :class:`.Session`.
        :param transaction: the target :class:`.SessionTransaction`.

         To detect if this is the outermost
         :class:`.SessionTransaction`, as opposed to a "subtransaction" or a
         SAVEPOINT, test that the :attr:`.SessionTransaction.parent` attribute
         is ``None``::

                @event.listens_for(session, "after_transaction_create")
                def after_transaction_end(session, transaction):
                    if transaction.parent is None:
                        # work with top-level transaction

         To detect if the :class:`.SessionTransaction` is a SAVEPOINT, use the
         :attr:`.SessionTransaction.nested` attribute::

                @event.listens_for(session, "after_transaction_create")
                def after_transaction_end(session, transaction):
                    if transaction.nested:
                        # work with SAVEPOINT transaction


        .. seealso::

            :class:`.SessionTransaction`

            :meth:`~.SessionEvents.after_transaction_create`

        N((R2R”R•((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_transaction_endÆscCsdS(s!Execute before commit is called.

        .. note::

            The :meth:`~.SessionEvents.before_commit` hook is *not* per-flush,
            that is, the :class:`.Session` can emit SQL to the database
            many times within the scope of a transaction.
            For interception of these events, use the
            :meth:`~.SessionEvents.before_flush`,
            :meth:`~.SessionEvents.after_flush`, or
            :meth:`~.SessionEvents.after_flush_postexec`
            events.

        :param session: The target :class:`.Session`.

        .. seealso::

            :meth:`~.SessionEvents.after_commit`

            :meth:`~.SessionEvents.after_begin`

            :meth:`~.SessionEvents.after_transaction_create`

            :meth:`~.SessionEvents.after_transaction_end`

        N((R2R”((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt
before_commitíscCsdS(sqExecute after a commit has occurred.

        .. note::

            The :meth:`~.SessionEvents.after_commit` hook is *not* per-flush,
            that is, the :class:`.Session` can emit SQL to the database
            many times within the scope of a transaction.
            For interception of these events, use the
            :meth:`~.SessionEvents.before_flush`,
            :meth:`~.SessionEvents.after_flush`, or
            :meth:`~.SessionEvents.after_flush_postexec`
            events.

        .. note::

            The :class:`.Session` is not in an active transaction
            when the :meth:`~.SessionEvents.after_commit` event is invoked,
            and therefore can not emit SQL.  To emit SQL corresponding to
            every transaction, use the :meth:`~.SessionEvents.before_commit`
            event.

        :param session: The target :class:`.Session`.

        .. seealso::

            :meth:`~.SessionEvents.before_commit`

            :meth:`~.SessionEvents.after_begin`

            :meth:`~.SessionEvents.after_transaction_create`

            :meth:`~.SessionEvents.after_transaction_end`

        N((R2R”((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_commit	scCsdS(sóExecute after a real DBAPI rollback has occurred.

        Note that this event only fires when the *actual* rollback against
        the database occurs - it does *not* fire each time the
        :meth:`.Session.rollback` method is called, if the underlying
        DBAPI transaction has already been rolled back.  In many
        cases, the :class:`.Session` will not be in
        an "active" state during this event, as the current
        transaction is not valid.   To acquire a :class:`.Session`
        which is active after the outermost rollback has proceeded,
        use the :meth:`.SessionEvents.after_soft_rollback` event, checking the
        :attr:`.Session.is_active` flag.

        :param session: The target :class:`.Session`.

        N((R2R”((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_rollback-scCsdS(s›Execute after any rollback has occurred, including "soft"
        rollbacks that don't actually emit at the DBAPI level.

        This corresponds to both nested and outer rollbacks, i.e.
        the innermost rollback that calls the DBAPI's
        rollback() method, as well as the enclosing rollback
        calls that only pop themselves from the transaction stack.

        The given :class:`.Session` can be used to invoke SQL and
        :meth:`.Session.query` operations after an outermost rollback
        by first checking the :attr:`.Session.is_active` flag::

            @event.listens_for(Session, "after_soft_rollback")
            def do_something(session, previous_transaction):
                if session.is_active:
                    session.execute("select * from some_table")

        :param session: The target :class:`.Session`.
        :param previous_transaction: The :class:`.SessionTransaction`
         transactional marker object which was just closed.   The current
         :class:`.SessionTransaction` for the given :class:`.Session` is
         available via the :attr:`.Session.transaction` attribute.

        .. versionadded:: 0.7.3

        N((R2R”tprevious_transaction((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_soft_rollback?scCsdS(sLExecute before flush process has started.

        :param session: The target :class:`.Session`.
        :param flush_context: Internal :class:`.UOWTransaction` object
         which handles the details of the flush.
        :param instances: Usually ``None``, this is the collection of
         objects which can be passed to the :meth:`.Session.flush` method
         (note this usage is deprecated).

        .. seealso::

            :meth:`~.SessionEvents.after_flush`

            :meth:`~.SessionEvents.after_flush_postexec`

            :ref:`session_persistence_events`

        N((R2R”R]t	instances((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytbefore_flush[scCsdS(sExecute after flush has completed, but before commit has been
        called.

        Note that the session's state is still in pre-flush, i.e. 'new',
        'dirty', and 'deleted' lists still show pre-flush state as well
        as the history settings on instance attributes.

        :param session: The target :class:`.Session`.
        :param flush_context: Internal :class:`.UOWTransaction` object
         which handles the details of the flush.

        .. seealso::

            :meth:`~.SessionEvents.before_flush`

            :meth:`~.SessionEvents.after_flush_postexec`

            :ref:`session_persistence_events`

        N((R2R”R]((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_flushoscCsdS(sÄExecute after flush has completed, and after the post-exec
        state occurs.

        This will be when the 'new', 'dirty', and 'deleted' lists are in
        their final state.  An actual commit() may or may not have
        occurred, depending on whether or not the flush started its own
        transaction or participated in a larger transaction.

        :param session: The target :class:`.Session`.
        :param flush_context: Internal :class:`.UOWTransaction` object
         which handles the details of the flush.


        .. seealso::

            :meth:`~.SessionEvents.before_flush`

            :meth:`~.SessionEvents.after_flush`

            :ref:`session_persistence_events`

        N((R2R”R]((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_flush_postexec…scCsdS(sExecute after a transaction is begun on a connection

        :param session: The target :class:`.Session`.
        :param transaction: The :class:`.SessionTransaction`.
        :param connection: The :class:`~.engine.Connection` object
         which will be used for SQL statements.

        .. seealso::

            :meth:`~.SessionEvents.before_commit`

            :meth:`~.SessionEvents.after_commit`

            :meth:`~.SessionEvents.after_transaction_create`

            :meth:`~.SessionEvents.after_transaction_end`

        N((R2R”R•Rˆ((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_beginscCsdS(s4Execute before an instance is attached to a session.

        This is called before an add, delete or merge causes
        the object to be part of the session.

        .. versionadded:: 0.8.  Note that :meth:`~.SessionEvents.after_attach`
           now fires off after the item is part of the session.
           :meth:`.before_attach` is provided for those cases where
           the item should not yet be part of the session state.

        .. seealso::

            :meth:`~.SessionEvents.after_attach`

            :ref:`session_lifecycle_events`

        N((R2R”tinstance((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt
before_attach±scCsdS(s­Execute after an instance is attached to a session.

        This is called after an add, delete or merge.

        .. note::

           As of 0.8, this event fires off *after* the item
           has been fully associated with the session, which is
           different than previous releases.  For event
           handlers that require the object not yet
           be part of session state (such as handlers which
           may autoflush while the target object is not
           yet complete) consider the
           new :meth:`.before_attach` event.

        .. seealso::

            :meth:`~.SessionEvents.before_attach`

            :ref:`session_lifecycle_events`

        N((R2R”R¢((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_attachÄss0.9R”tqueryt
query_contexttresultcCs|j|j|j|jfS(N(R”R¥RYR§(tupdate_context((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt<lambda>ÞscCsdS(s¬Execute after a bulk update operation to the session.

        This is called as a result of the :meth:`.Query.update` method.

        :param update_context: an "update context" object which contains
         details about the update, including these attributes:

            * ``session`` - the :class:`.Session` involved
            * ``query`` -the :class:`.Query` object that this update operation
              was called upon.
            * ``context`` The :class:`.QueryContext` object, corresponding
              to the invocation of an ORM query.
            * ``result`` the :class:`.ResultProxy` returned as a result of the
              bulk UPDATE operation.


        N((R2R¨((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_bulk_updateÜscCs|j|j|j|jfS(N(R”R¥RYR§(tdelete_context((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR©øscCsdS(s«Execute after a bulk delete operation to the session.

        This is called as a result of the :meth:`.Query.delete` method.

        :param delete_context: a "delete context" object which contains
         details about the update, including these attributes:

            * ``session`` - the :class:`.Session` involved
            * ``query`` -the :class:`.Query` object that this update operation
              was called upon.
            * ``context`` The :class:`.QueryContext` object, corresponding
              to the invocation of an ORM query.
            * ``result`` the :class:`.ResultProxy` returned as a result of the
              bulk DELETE operation.


        N((R2R«((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytafter_bulk_deleteös(R7R8R9R:RR<R=RR–R—R˜R™RšRœRžRŸR R¡R£R¤Rt_legacy_signatureRªR¬(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRds,	*	'		$										tAttributeEventscBs€eZdZdZeZed„ƒZed„ƒZ	ee
e
e
e
d„ƒZd„Zd„Z
d„Zd„Zd	„ZRS(
s®Define events for object attributes.

    These are typically defined on the class-bound descriptor for the
    target class.

    e.g.::

        from sqlalchemy import event

        def my_append_listener(target, value, initiator):
            print "received append event for target: %s" % target

        event.listen(MyClass.collection, 'append', my_append_listener)

    Listeners have the option to return a possibly modified version
    of the value, when the ``retval=True`` flag is passed
    to :func:`~.event.listen`::

        def validate_phone(target, value, oldvalue, initiator):
            "Strip non-numeric characters from a phone number"

            return re.sub(r'(?![0-9])', '', value)

        # setup listener on UserContact.phone attribute, instructing
        # it to use the return value
        listen(UserContact.phone, 'set', validate_phone, retval=True)

    A validation function like the above can also raise an exception
    such as :exc:`ValueError` to halt the operation.

    Several modifiers are available to the :func:`~.event.listen` function.

    :param active_history=False: When True, indicates that the
      "set" event would like to receive the "old" value being
      replaced unconditionally, even if this requires firing off
      database loads. Note that ``active_history`` can also be
      set directly via :func:`.column_property` and
      :func:`.relationship`.

    :param propagate=False: When True, the listener function will
      be established not just for the class attribute given, but
      for attributes of the same name on all current subclasses
      of that class, as well as all future subclasses of that
      class, using an additional listener that listens for
      instrumentation events.
    :param raw=False: When True, the "target" argument to the
      event will be the :class:`.InstanceState` management
      object, rather than the mapped instance itself.
    :param retval=False: when True, the user-defined event
      listening must return the "value" argument from the
      function.  This gives the listening function the opportunity
      to change the value that is ultimately used for a "set"
      or "append" event.

    sSomeClass.some_attributecCs"tjj||ƒ}t|_|S(N(RtEventst
_set_dispatchRdt_active_history(Rtdispatch_clsR!((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR°Ms	cCs0t|tjƒr(t|jj|jƒS|SdS(N(RRtMapperPropertyR tparentR)R$(RR((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRSscsÐ|j|j|j}}‰|r2t|j_nˆs@ˆrg‡‡‡fd†}|j|ƒ}n|jd|ƒ|rÌtj	|j
ƒ}	x:|	jtƒD]&}
|j|
|j
ƒjdtƒqŸWndS(NcsCˆs|jƒ}nˆs/ˆ|||Œ|Sˆ|||ŒSdS(N(RN(RtvalueR(RRRR(sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRPhsR(R&R%R'R>R!R±R+R,RRKR)RQR*R$(RR-tactive_historyRRRRRR%RPRMRS((RRRRsJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR/[scCsdS(s)Receive a collection append event.

        :param target: the object instance receiving the event.
          If the listener is registered with ``raw=True``, this will
          be the :class:`.InstanceState` object.
        :param value: the value being appended.  If this listener
          is registered with ``retval=True``, the listener
          function must return this value, or a new value which
          replaces it.
        :param initiator: An instance of :class:`.attributes.Event`
          representing the initiation of the event.  May be modified
          from its original value by backref handlers in order to control
          chained event propagation.

          .. versionchanged:: 0.9.0 the ``initiator`` argument is now
             passed as a :class:`.attributes.Event` object, and may be
             modified by backref handlers within a chain of backref-linked
             events.

        :return: if the event was registered with ``retval=True``,
         the given value, or a new effective value, should be returned.

        N((R2RRµt	initiator((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytappend{scCsdS(s4Receive a collection remove event.

        :param target: the object instance receiving the event.
          If the listener is registered with ``raw=True``, this will
          be the :class:`.InstanceState` object.
        :param value: the value being removed.
        :param initiator: An instance of :class:`.attributes.Event`
          representing the initiation of the event.  May be modified
          from its original value by backref handlers in order to control
          chained event propagation.

          .. versionchanged:: 0.9.0 the ``initiator`` argument is now
             passed as a :class:`.attributes.Event` object, and may be
             modified by backref handlers within a chain of backref-linked
             events.

        :return: No return value is defined for this event.
        N((R2RRµR·((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR"”scCsdS(s€Receive a scalar set event.

        :param target: the object instance receiving the event.
          If the listener is registered with ``raw=True``, this will
          be the :class:`.InstanceState` object.
        :param value: the value being set.  If this listener
          is registered with ``retval=True``, the listener
          function must return this value, or a new value which
          replaces it.
        :param oldvalue: the previous value being replaced.  This
          may also be the symbol ``NEVER_SET`` or ``NO_VALUE``.
          If the listener is registered with ``active_history=True``,
          the previous value of the attribute will be loaded from
          the database if the existing value is currently unloaded
          or expired.
        :param initiator: An instance of :class:`.attributes.Event`
          representing the initiation of the event.  May be modified
          from its original value by backref handlers in order to control
          chained event propagation.

          .. versionchanged:: 0.9.0 the ``initiator`` argument is now
             passed as a :class:`.attributes.Event` object, and may be
             modified by backref handlers within a chain of backref-linked
             events.

        :return: if the event was registered with ``retval=True``,
         the given value, or a new effective value, should be returned.

        N((R2RRµtoldvalueR·((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytset¨scCsdS(s3Receive a 'collection init' event.

        This event is triggered for a collection-based attribute, when
        the initial "empty collection" is first generated for a blank
        attribute, as well as for when the collection is replaced with
        a new one, such as via a set event.

        E.g., given that ``User.addresses`` is a relationship-based
        collection, the event is triggered here::

            u1 = User()
            u1.addresses.append(a1)  #  <- new collection

        and also during replace operations::

            u1.addresses = [a2, a3]  #  <- new collection

        :param target: the object instance receiving the event.
         If the listener is registered with ``raw=True``, this will
         be the :class:`.InstanceState` object.
        :param collection: the new collection.  This will always be generated
         from what was specified as
         :paramref:`.RelationshipProperty.collection_class`, and will always
         be empty.
        :param collection_adpater: the :class:`.CollectionAdapter` that will
         mediate internal access to the collection.

        .. versionadded:: 1.0.0 the :meth:`.AttributeEvents.init_collection`
           and :meth:`.AttributeEvents.dispose_collection` events supersede
           the :class:`.collection.linker` hook.

        N((R2RRptcollection_adapter((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytinit_collectionÇscCsdS(soReceive a 'collection dispose' event.

        This event is triggered for a collection-based attribute when
        a collection is replaced, that is::

            u1.addresses.append(a1)

            u1.addresses = [a2, a3]  # <- old collection is disposed

        The mechanics of the event will typically include that the given
        collection is empty, even if it stored objects while being replaced.

        .. versionadded:: 1.0.0 the :meth:`.AttributeEvents.init_collection`
           and :meth:`.AttributeEvents.dispose_collection` events supersede
           the :class:`.collection.linker` hook.

        N((R2RRptcollection_adpater((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytdispose_collectionés(R7R8R9R:R
R<tstaticmethodR°R=RRdR/R¸R"RºR¼R¾(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR®s7				"tQueryEventscBs5eZdZdZeZd„Zeed„ƒZ	RS(sqRepresent events within the construction of a :class:`.Query` object.

    The events here are intended to be used with an as-yet-unreleased
    inspection system for :class:`.Query`.   Some very basic operations
    are possible now, however the inspection system is intended to allow
    complex query manipulations to be automated.

    .. versionadded:: 1.0.0

    t	SomeQuerycCsdS(s¡Receive the :class:`.Query` object before it is composed into a
        core :class:`.Select` object.

        This event is intended to allow changes to the query given::

            @event.listens_for(Query, "before_compile", retval=True)
            def no_deleted(query):
                for desc in query.column_descriptions:
                    if desc['type'] is User:
                        entity = desc['entity']
                        query = query.filter(entity.deleted == False)
                return query

        The event should normally be listened with the ``retval=True``
        parameter set, so that the modified query may be returned.


        N((R2R¥((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pytbefore_compilescsD|j‰ˆs3‡‡fd†}|j|ƒ}n|j|dS(Ncs2ˆs!|d}ˆ||Ž|Sˆ||ŽSdS(Ni((RR.R¥(RR(sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRP&s


(R'R+R,(RR-RR.RP((RRsJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyR/ s
	(
R7R8R9R:RR<RÂR=RdR/(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyRÀýs
	($R9tRRRtbaseRtinspectR(RRRR”RRtscopingR	t
attributesR
R¥Rtsqlalchemy.util.compatRR¯R
RvRRAt
RefCollectionReRCRyRzRR®RÀ(((sJ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/events.pyt<module>
s2Zÿ"Cÿÿmÿ®ì