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    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / sqlalchemy / orm / relationships.pyc
Size: Mime:
ó
‹EYc@@s¦dZddlmZddlmZmZmZmZm	Z	ddl
Z
ddlmZmZm
Z
ddlmZdd	lmZdd
lmZmZmZmZmZmZmZddlmZmZmZddlmZmZmZmZm Z dd
l!m"Z"ddlm#Z$ddl%Z%d„Z&d„Z'e	j(ej)j*dƒdefd„ƒYƒƒZ+d„Z,de-fd„ƒYZ.de-fd„ƒYZ/dS(sHeuristics related to join conditions as used in
:func:`.relationship`.

Provides the :class:`.JoinCondition` object, which encapsulates
SQL annotation and aliasing behavior focused on the `primaryjoin`
and `secondaryjoin` aspects of :func:`.relationship`.

i(tabsolute_importi(tsqltutiltexctschematlogNi(tCascadeOptionst
_orm_annotatet_orm_deannotate(t
dependency(t
attributes(t
ClauseAdaptertjoin_conditiont_shallow_annotatetvisit_binary_productt_deep_deannotatetselectables_overlaptadapt_criterion_to_null(t	operatorst
expressiontvisitors(t
MANYTOMANYt	MANYTOONEt	ONETOMANYtStrategizedPropertytPropComparator(tinspect(tmappercC@sttj|ƒitd6ƒS(sAnnotate a portion of a primaryjoin expression
    with a 'remote' annotation.

    See the section :ref:`relationship_custom_foreign` for a
    description of use.

    .. versionadded:: 0.8

    .. seealso::

        :ref:`relationship_custom_foreign`

        :func:`.foreign`

    tremote(t_annotate_columnsRt_clause_element_as_exprtTrue(texpr((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR$scC@sttj|ƒitd6ƒS(sAnnotate a portion of a primaryjoin expression
    with a 'foreign' annotation.

    See the section :ref:`relationship_custom_foreign` for a
    description of use.

    .. versionadded:: 0.8

    .. seealso::

        :ref:`relationship_custom_foreign`

        :func:`.remote`

    tforeign(RRRR(R ((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR!8sssqlalchemy.orm.propertiestRelationshipPropertyc!B@séeZdZdZeZeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed„ Zd„Z	de
fd„ƒYZed„Zeeed„Z
d„Zeed	„Zd
„Zd„Zejd„Zed
„Zd„Zejd„ƒZejejddƒd„ƒƒZd„Zd„Zd„Zd„Zd„Z d„Z!e"e e!ƒZ#d„Z$d„Z%d„Z&d„Z'ejd„ƒZ(ejd„ƒZ)eeeeed„Z*RS( søDescribes an object property that holds a single item or list
    of items that correspond to a related database table.

    Public constructor is the :func:`.orm.relationship` function.

    See also:

    :ref:`relationship_config_toplevel`

    trelationshipc""C@sòtt|ƒjƒ||_||_||_||_||_|
|_t	|_
|
|_||_||_
||_||_||_||_||_||_||_| |_||_||_||_||_||_||_||_||_||_|ptj|_ |j |t	ƒ|_!t"j#|ƒ|!t	k	rR|!|_$n|rd||_%n|j&d|jfƒ|_%t'ƒ|_(|t)k	r|nd|_*||_+|	|_,|j,rå|rÙt-j.dƒ‚nt	|_/n	||_/dS(sàzProvide a relationship between two mapped classes.

        This corresponds to a parent-child or associative table relationship.
        The constructed class is an instance of
        :class:`.RelationshipProperty`.

        A typical :func:`.relationship`, used in a classical mapping::

           mapper(Parent, properties={
             'children': relationship(Child)
           })

        Some arguments accepted by :func:`.relationship` optionally accept a
        callable function, which when called produces the desired value.
        The callable is invoked by the parent :class:`.Mapper` at "mapper
        initialization" time, which happens only when mappers are first used,
        and is assumed to be after all mappings have been constructed.  This
        can be used to resolve order-of-declaration and other dependency
        issues, such as if ``Child`` is declared below ``Parent`` in the same
        file::

            mapper(Parent, properties={
                "children":relationship(lambda: Child,
                                    order_by=lambda: Child.id)
            })

        When using the :ref:`declarative_toplevel` extension, the Declarative
        initializer allows string arguments to be passed to
        :func:`.relationship`.  These string arguments are converted into
        callables that evaluate the string as Python code, using the
        Declarative class-registry as a namespace.  This allows the lookup of
        related classes to be automatic via their string name, and removes the
        need to import related classes at all into the local module space::

            from sqlalchemy.ext.declarative import declarative_base

            Base = declarative_base()

            class Parent(Base):
                __tablename__ = 'parent'
                id = Column(Integer, primary_key=True)
                children = relationship("Child", order_by="Child.id")

        .. seealso::

          :ref:`relationship_config_toplevel` - Full introductory and
          reference documentation for :func:`.relationship`.

          :ref:`orm_tutorial_relationship` - ORM tutorial introduction.

        :param argument:
          a mapped class, or actual :class:`.Mapper` instance, representing
          the target of the relationship.

          :paramref:`~.relationship.argument` may also be passed as a callable
          function which is evaluated at mapper initialization time, and may
          be passed as a Python-evaluable string when using Declarative.

          .. seealso::

            :ref:`declarative_configuring_relationships` - further detail
            on relationship configuration when using Declarative.

        :param secondary:
          for a many-to-many relationship, specifies the intermediary
          table, and is typically an instance of :class:`.Table`.
          In less common circumstances, the argument may also be specified
          as an :class:`.Alias` construct, or even a :class:`.Join` construct.

          :paramref:`~.relationship.secondary` may
          also be passed as a callable function which is evaluated at
          mapper initialization time.  When using Declarative, it may also
          be a string argument noting the name of a :class:`.Table` that is
          present in the :class:`.MetaData` collection associated with the
          parent-mapped :class:`.Table`.

          The :paramref:`~.relationship.secondary` keyword argument is
          typically applied in the case where the intermediary :class:`.Table`
          is not otherwise expressed in any direct class mapping. If the
          "secondary" table is also explicitly mapped elsewhere (e.g. as in
          :ref:`association_pattern`), one should consider applying the
          :paramref:`~.relationship.viewonly` flag so that this
          :func:`.relationship` is not used for persistence operations which
          may conflict with those of the association object pattern.

          .. seealso::

              :ref:`relationships_many_to_many` - Reference example of "many
              to many".

              :ref:`orm_tutorial_many_to_many` - ORM tutorial introduction to
              many-to-many relationships.

              :ref:`self_referential_many_to_many` - Specifics on using
              many-to-many in a self-referential case.

              :ref:`declarative_many_to_many` - Additional options when using
              Declarative.

              :ref:`association_pattern` - an alternative to
              :paramref:`~.relationship.secondary` when composing association
              table relationships, allowing additional attributes to be
              specified on the association table.

              :ref:`composite_secondary_join` - a lesser-used pattern which
              in some cases can enable complex :func:`.relationship` SQL
              conditions to be used.

          .. versionadded:: 0.9.2 :paramref:`~.relationship.secondary` works
             more effectively when referring to a :class:`.Join` instance.

        :param active_history=False:
          When ``True``, indicates that the "previous" value for a
          many-to-one reference should be loaded when replaced, if
          not already loaded. Normally, history tracking logic for
          simple many-to-ones only needs to be aware of the "new"
          value in order to perform a flush. This flag is available
          for applications that make use of
          :func:`.attributes.get_history` which also need to know
          the "previous" value of the attribute.

        :param backref:
          indicates the string name of a property to be placed on the related
          mapper's class that will handle this relationship in the other
          direction. The other property will be created automatically
          when the mappers are configured.  Can also be passed as a
          :func:`.backref` object to control the configuration of the
          new relationship.

          .. seealso::

            :ref:`relationships_backref` - Introductory documentation and
            examples.

            :paramref:`~.relationship.back_populates` - alternative form
            of backref specification.

            :func:`.backref` - allows control over :func:`.relationship`
            configuration when using :paramref:`~.relationship.backref`.


        :param back_populates:
          Takes a string name and has the same meaning as
          :paramref:`~.relationship.backref`, except the complementing
          property is **not** created automatically, and instead must be
          configured explicitly on the other mapper.  The complementing
          property should also indicate
          :paramref:`~.relationship.back_populates` to this relationship to
          ensure proper functioning.

          .. seealso::

            :ref:`relationships_backref` - Introductory documentation and
            examples.

            :paramref:`~.relationship.backref` - alternative form
            of backref specification.

        :param bake_queries=True:
          Use the :class:`.BakedQuery` cache to cache the construction of SQL
          used in lazy loads, when the :func:`.bake_lazy_loaders` function has
          first been called.  Defaults to True and is intended to provide an
          "opt out" flag per-relationship when the baked query cache system is
          in use.

          .. warning::

              This flag **only** has an effect when the application-wide
              :func:`.bake_lazy_loaders` function has been called.   It
              defaults to True so is an "opt out" flag.

          Setting this flag to False when baked queries are otherwise in
          use might be to reduce
          ORM memory use for this :func:`.relationship`, or to work around
          unresolved stability issues observed within the baked query
          cache system.

          .. versionadded:: 1.0.0

          .. seealso::

            :ref:`baked_toplevel`

        :param cascade:
          a comma-separated list of cascade rules which determines how
          Session operations should be "cascaded" from parent to child.
          This defaults to ``False``, which means the default cascade
          should be used - this default cascade is ``"save-update, merge"``.

          The available cascades are ``save-update``, ``merge``,
          ``expunge``, ``delete``, ``delete-orphan``, and ``refresh-expire``.
          An additional option, ``all`` indicates shorthand for
          ``"save-update, merge, refresh-expire,
          expunge, delete"``, and is often used as in ``"all, delete-orphan"``
          to indicate that related objects should follow along with the
          parent object in all cases, and be deleted when de-associated.

          .. seealso::

            :ref:`unitofwork_cascades` - Full detail on each of the available
            cascade options.

            :ref:`tutorial_delete_cascade` - Tutorial example describing
            a delete cascade.

        :param cascade_backrefs=True:
          a boolean value indicating if the ``save-update`` cascade should
          operate along an assignment event intercepted by a backref.
          When set to ``False``, the attribute managed by this relationship
          will not cascade an incoming transient object into the session of a
          persistent parent, if the event is received via backref.

          .. seealso::

            :ref:`backref_cascade` - Full discussion and examples on how
            the :paramref:`~.relationship.cascade_backrefs` option is used.

        :param collection_class:
          a class or callable that returns a new list-holding object. will
          be used in place of a plain list for storing elements.

          .. seealso::

            :ref:`custom_collections` - Introductory documentation and
            examples.

        :param comparator_factory:
          a class which extends :class:`.RelationshipProperty.Comparator`
          which provides custom SQL clause generation for comparison
          operations.

          .. seealso::

            :class:`.PropComparator` - some detail on redefining comparators
            at this level.

            :ref:`custom_comparators` - Brief intro to this feature.


        :param distinct_target_key=None:
          Indicate if a "subquery" eager load should apply the DISTINCT
          keyword to the innermost SELECT statement.  When left as ``None``,
          the DISTINCT keyword will be applied in those cases when the target
          columns do not comprise the full primary key of the target table.
          When set to ``True``, the DISTINCT keyword is applied to the
          innermost SELECT unconditionally.

          It may be desirable to set this flag to False when the DISTINCT is
          reducing performance of the innermost subquery beyond that of what
          duplicate innermost rows may be causing.

          .. versionadded:: 0.8.3 -
             :paramref:`~.relationship.distinct_target_key` allows the
             subquery eager loader to apply a DISTINCT modifier to the
             innermost SELECT.

          .. versionchanged:: 0.9.0 -
             :paramref:`~.relationship.distinct_target_key` now defaults to
             ``None``, so that the feature enables itself automatically for
             those cases where the innermost query targets a non-unique
             key.

          .. seealso::

            :ref:`loading_toplevel` - includes an introduction to subquery
            eager loading.

        :param doc:
          docstring which will be applied to the resulting descriptor.

        :param extension:
          an :class:`.AttributeExtension` instance, or list of extensions,
          which will be prepended to the list of attribute listeners for
          the resulting descriptor placed on the class.

          .. deprecated:: 0.7 Please see :class:`.AttributeEvents`.

        :param foreign_keys:

          a list of columns which are to be used as "foreign key"
          columns, or columns which refer to the value in a remote
          column, within the context of this :func:`.relationship`
          object's :paramref:`~.relationship.primaryjoin` condition.
          That is, if the :paramref:`~.relationship.primaryjoin`
          condition of this :func:`.relationship` is ``a.id ==
          b.a_id``, and the values in ``b.a_id`` are required to be
          present in ``a.id``, then the "foreign key" column of this
          :func:`.relationship` is ``b.a_id``.

          In normal cases, the :paramref:`~.relationship.foreign_keys`
          parameter is **not required.** :func:`.relationship` will
          automatically determine which columns in the
          :paramref:`~.relationship.primaryjoin` conditition are to be
          considered "foreign key" columns based on those
          :class:`.Column` objects that specify :class:`.ForeignKey`,
          or are otherwise listed as referencing columns in a
          :class:`.ForeignKeyConstraint` construct.
          :paramref:`~.relationship.foreign_keys` is only needed when:

            1. There is more than one way to construct a join from the local
               table to the remote table, as there are multiple foreign key
               references present.  Setting ``foreign_keys`` will limit the
               :func:`.relationship` to consider just those columns specified
               here as "foreign".

               .. versionchanged:: 0.8
                    A multiple-foreign key join ambiguity can be resolved by
                    setting the :paramref:`~.relationship.foreign_keys`
                    parameter alone, without the need to explicitly set
                    :paramref:`~.relationship.primaryjoin` as well.

            2. The :class:`.Table` being mapped does not actually have
               :class:`.ForeignKey` or :class:`.ForeignKeyConstraint`
               constructs present, often because the table
               was reflected from a database that does not support foreign key
               reflection (MySQL MyISAM).

            3. The :paramref:`~.relationship.primaryjoin` argument is used to
               construct a non-standard join condition, which makes use of
               columns or expressions that do not normally refer to their
               "parent" column, such as a join condition expressed by a
               complex comparison using a SQL function.

          The :func:`.relationship` construct will raise informative
          error messages that suggest the use of the
          :paramref:`~.relationship.foreign_keys` parameter when
          presented with an ambiguous condition.   In typical cases,
          if :func:`.relationship` doesn't raise any exceptions, the
          :paramref:`~.relationship.foreign_keys` parameter is usually
          not needed.

          :paramref:`~.relationship.foreign_keys` may also be passed as a
          callable function which is evaluated at mapper initialization time,
          and may be passed as a Python-evaluable string when using
          Declarative.

          .. seealso::

            :ref:`relationship_foreign_keys`

            :ref:`relationship_custom_foreign`

            :func:`.foreign` - allows direct annotation of the "foreign"
            columns within a :paramref:`~.relationship.primaryjoin` condition.

          .. versionadded:: 0.8
              The :func:`.foreign` annotation can also be applied
              directly to the :paramref:`~.relationship.primaryjoin`
              expression, which is an alternate, more specific system of
              describing which columns in a particular
              :paramref:`~.relationship.primaryjoin` should be considered
              "foreign".

        :param info: Optional data dictionary which will be populated into the
            :attr:`.MapperProperty.info` attribute of this object.

            .. versionadded:: 0.8

        :param innerjoin=False:
          when ``True``, joined eager loads will use an inner join to join
          against related tables instead of an outer join.  The purpose
          of this option is generally one of performance, as inner joins
          generally perform better than outer joins.

          This flag can be set to ``True`` when the relationship references an
          object via many-to-one using local foreign keys that are not
          nullable, or when the reference is one-to-one or a collection that
          is guaranteed to have one or at least one entry.

          The option supports the same "nested" and "unnested" options as
          that of :paramref:`.joinedload.innerjoin`.  See that flag
          for details on nested / unnested behaviors.

          .. seealso::

            :paramref:`.joinedload.innerjoin` - the option as specified by
            loader option, including detail on nesting behavior.

            :ref:`what_kind_of_loading` - Discussion of some details of
            various loader options.


        :param join_depth:
          when non-``None``, an integer value indicating how many levels
          deep "eager" loaders should join on a self-referring or cyclical
          relationship.  The number counts how many times the same Mapper
          shall be present in the loading condition along a particular join
          branch.  When left at its default of ``None``, eager loaders
          will stop chaining when they encounter a the same target mapper
          which is already higher up in the chain.  This option applies
          both to joined- and subquery- eager loaders.

          .. seealso::

            :ref:`self_referential_eager_loading` - Introductory documentation
            and examples.

        :param lazy='select': specifies
          how the related items should be loaded.  Default value is
          ``select``.  Values include:

          * ``select`` - items should be loaded lazily when the property is
            first accessed, using a separate SELECT statement, or identity map
            fetch for simple many-to-one references.

          * ``immediate`` - items should be loaded as the parents are loaded,
            using a separate SELECT statement, or identity map fetch for
            simple many-to-one references.

          * ``joined`` - items should be loaded "eagerly" in the same query as
            that of the parent, using a JOIN or LEFT OUTER JOIN.  Whether
            the join is "outer" or not is determined by the
            :paramref:`~.relationship.innerjoin` parameter.

          * ``subquery`` - items should be loaded "eagerly" as the parents are
            loaded, using one additional SQL statement, which issues a JOIN to
            a subquery of the original statement, for each collection
            requested.

          * ``noload`` - no loading should occur at any time.  This is to
            support "write-only" attributes, or attributes which are
            populated in some manner specific to the application.

          * ``dynamic`` - the attribute will return a pre-configured
            :class:`.Query` object for all read
            operations, onto which further filtering operations can be
            applied before iterating the results.  See
            the section :ref:`dynamic_relationship` for more details.

          * True - a synonym for 'select'

          * False - a synonym for 'joined'

          * None - a synonym for 'noload'

          .. seealso::

            :doc:`/orm/loading_relationships` - Full documentation on relationship loader
            configuration.

            :ref:`dynamic_relationship` - detail on the ``dynamic`` option.

        :param load_on_pending=False:
          Indicates loading behavior for transient or pending parent objects.

          When set to ``True``, causes the lazy-loader to
          issue a query for a parent object that is not persistent, meaning it
          has never been flushed.  This may take effect for a pending object
          when autoflush is disabled, or for a transient object that has been
          "attached" to a :class:`.Session` but is not part of its pending
          collection.

          The :paramref:`~.relationship.load_on_pending` flag does not improve
          behavior when the ORM is used normally - object references should be
          constructed at the object level, not at the foreign key level, so
          that they are present in an ordinary way before a flush proceeds.
          This flag is not not intended for general use.

          .. seealso::

              :meth:`.Session.enable_relationship_loading` - this method
              establishes "load on pending" behavior for the whole object, and
              also allows loading on objects that remain transient or
              detached.

        :param order_by:
          indicates the ordering that should be applied when loading these
          items.  :paramref:`~.relationship.order_by` is expected to refer to
          one of the :class:`.Column` objects to which the target class is
          mapped, or the attribute itself bound to the target class which
          refers to the column.

          :paramref:`~.relationship.order_by` may also be passed as a callable
          function which is evaluated at mapper initialization time, and may
          be passed as a Python-evaluable string when using Declarative.

        :param passive_deletes=False:
           Indicates loading behavior during delete operations.

           A value of True indicates that unloaded child items should not
           be loaded during a delete operation on the parent.  Normally,
           when a parent item is deleted, all child items are loaded so
           that they can either be marked as deleted, or have their
           foreign key to the parent set to NULL.  Marking this flag as
           True usually implies an ON DELETE <CASCADE|SET NULL> rule is in
           place which will handle updating/deleting child rows on the
           database side.

           Additionally, setting the flag to the string value 'all' will
           disable the "nulling out" of the child foreign keys, when there
           is no delete or delete-orphan cascade enabled.  This is
           typically used when a triggering or error raise scenario is in
           place on the database side.  Note that the foreign key
           attributes on in-session child objects will not be changed
           after a flush occurs so this is a very special use-case
           setting.

           .. seealso::

                :ref:`passive_deletes` - Introductory documentation
                and examples.

        :param passive_updates=True:
          Indicates the persistence behavior to take when a referenced
          primary key value changes in place, indicating that the referencing
          foreign key columns will also need their value changed.

          When True, it is assumed that ``ON UPDATE CASCADE`` is configured on
          the foreign key in the database, and that the database will
          handle propagation of an UPDATE from a source column to
          dependent rows.  When False, the SQLAlchemy :func:`.relationship`
          construct will attempt to emit its own UPDATE statements to
          modify related targets.  However note that SQLAlchemy **cannot**
          emit an UPDATE for more than one level of cascade.  Also,
          setting this flag to False is not compatible in the case where
          the database is in fact enforcing referential integrity, unless
          those constraints are explicitly "deferred", if the target backend
          supports it.

          It is highly advised that an application which is employing
          mutable primary keys keeps ``passive_updates`` set to True,
          and instead uses the referential integrity features of the database
          itself in order to handle the change efficiently and fully.

          .. seealso::

              :ref:`passive_updates` - Introductory documentation and
              examples.

              :paramref:`.mapper.passive_updates` - a similar flag which
              takes effect for joined-table inheritance mappings.

        :param post_update:
          this indicates that the relationship should be handled by a
          second UPDATE statement after an INSERT or before a
          DELETE. Currently, it also will issue an UPDATE after the
          instance was UPDATEd as well, although this technically should
          be improved. This flag is used to handle saving bi-directional
          dependencies between two individual rows (i.e. each row
          references the other), where it would otherwise be impossible to
          INSERT or DELETE both rows fully since one row exists before the
          other. Use this flag when a particular mapping arrangement will
          incur two rows that are dependent on each other, such as a table
          that has a one-to-many relationship to a set of child rows, and
          also has a column that references a single child row within that
          list (i.e. both tables contain a foreign key to each other). If
          a flush operation returns an error that a "cyclical
          dependency" was detected, this is a cue that you might want to
          use :paramref:`~.relationship.post_update` to "break" the cycle.

          .. seealso::

              :ref:`post_update` - Introductory documentation and examples.

        :param primaryjoin:
          a SQL expression that will be used as the primary
          join of this child object against the parent object, or in a
          many-to-many relationship the join of the primary object to the
          association table. By default, this value is computed based on the
          foreign key relationships of the parent and child tables (or
          association table).

          :paramref:`~.relationship.primaryjoin` may also be passed as a
          callable function which is evaluated at mapper initialization time,
          and may be passed as a Python-evaluable string when using
          Declarative.

          .. seealso::

              :ref:`relationship_primaryjoin`

        :param remote_side:
          used for self-referential relationships, indicates the column or
          list of columns that form the "remote side" of the relationship.

          :paramref:`.relationship.remote_side` may also be passed as a
          callable function which is evaluated at mapper initialization time,
          and may be passed as a Python-evaluable string when using
          Declarative.

          .. versionchanged:: 0.8
              The :func:`.remote` annotation can also be applied
              directly to the ``primaryjoin`` expression, which is an
              alternate, more specific system of describing which columns in a
              particular ``primaryjoin`` should be considered "remote".

          .. seealso::

            :ref:`self_referential` - in-depth explanation of how
            :paramref:`~.relationship.remote_side`
            is used to configure self-referential relationships.

            :func:`.remote` - an annotation function that accomplishes the
            same purpose as :paramref:`~.relationship.remote_side`, typically
            when a custom :paramref:`~.relationship.primaryjoin` condition
            is used.

        :param query_class:
          a :class:`.Query` subclass that will be used as the base of the
          "appender query" returned by a "dynamic" relationship, that
          is, a relationship that specifies ``lazy="dynamic"`` or was
          otherwise constructed using the :func:`.orm.dynamic_loader`
          function.

          .. seealso::

            :ref:`dynamic_relationship` - Introduction to "dynamic"
            relationship loaders.

        :param secondaryjoin:
          a SQL expression that will be used as the join of
          an association table to the child object. By default, this value is
          computed based on the foreign key relationships of the association
          and child tables.

          :paramref:`~.relationship.secondaryjoin` may also be passed as a
          callable function which is evaluated at mapper initialization time,
          and may be passed as a Python-evaluable string when using
          Declarative.

          .. seealso::

              :ref:`relationship_primaryjoin`

        :param single_parent:
          when True, installs a validator which will prevent objects
          from being associated with more than one parent at a time.
          This is used for many-to-one or many-to-many relationships that
          should be treated either as one-to-one or one-to-many.  Its usage
          is optional, except for :func:`.relationship` constructs which
          are many-to-one or many-to-many and also
          specify the ``delete-orphan`` cascade option.  The
          :func:`.relationship` construct itself will raise an error
          instructing when this option is required.

          .. seealso::

            :ref:`unitofwork_cascades` - includes detail on when the
            :paramref:`~.relationship.single_parent` flag may be appropriate.

        :param uselist:
          a boolean that indicates if this property should be loaded as a
          list or a scalar. In most cases, this value is determined
          automatically by :func:`.relationship` at mapper configuration
          time, based on the type and direction
          of the relationship - one to many forms a list, many to one
          forms a scalar, many to many is a list. If a scalar is desired
          where normally a list would be present, such as a bi-directional
          one-to-one relationship, set :paramref:`~.relationship.uselist` to
          False.

          The :paramref:`~.relationship.uselist` flag is also available on an
          existing :func:`.relationship` construct as a read-only attribute,
          which can be used to determine if this :func:`.relationship` deals
          with collections or scalar attributes::

              >>> User.addresses.property.uselist
              True

          .. seealso::

              :ref:`relationships_one_to_one` - Introduction to the "one to
              one" relationship pattern, which is typically when the
              :paramref:`~.relationship.uselist` flag is needed.

        :param viewonly=False:
          when set to True, the relationship is used only for loading objects,
          and not for any persistence operation.  A :func:`.relationship`
          which specifies :paramref:`~.relationship.viewonly` can work
          with a wider range of SQL operations within the
          :paramref:`~.relationship.primaryjoin` condition, including
          operations that feature the use of a variety of comparison operators
          as well as SQL functions such as :func:`~.sql.expression.cast`.  The
          :paramref:`~.relationship.viewonly` flag is also of general use when
          defining any kind of :func:`~.relationship` that doesn't represent
          the full set of related objects, to prevent modifications of the
          collection from resulting in persistence operations.


        tlazyssave-update, mergesCbackref and back_populates keyword arguments are mutually exclusiveN(0tsuperR"t__init__tuselisttargumentt	secondarytprimaryjoint
secondaryjointpost_updatetNonet	directiontviewonlyR$t
single_parentt_user_defined_foreign_keystcollection_classtpassive_deletestcascade_backrefstpassive_updatestremote_sidetenable_typecheckstquery_classt	innerjointdistinct_target_keytdoctactive_historyt
join_depthtlocal_remote_pairst	extensiontbake_queriestload_on_pendingt
Comparatortcomparator_factoryt
comparatorRtset_creation_ordertinfotstrategy_classt_strategy_lookuptsett_reverse_propertytFalsetcascadetorder_bytback_populatestsa_exct
ArgumentErrortbackref("tselfR(R)R*R+tforeign_keysR'RMRQRNR,RLR?R/R$R2R3R5R6R7R=RCR0R9R:R;R<R4RAR@RGt_local_remote_pairsR8RF((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR&_sdÿÿÃ																											
				c	C@s;tj|j|jd|j||ƒd|d|jƒdS(NRDtparententityR;(R
tregister_descriptortclass_tkeyRCR;(RRR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytinstrument_class\s	RBcB@sÔeZdZdZddd„Zd„Zejd„ƒZ	ejd„ƒZ
d„Zd„Zd„Z
d„ZdZd	„Zdd
„Zdd„Zdd„Zd
„Zd„Zd„Zejd„ƒZRS(sÁProduce boolean, comparison, and other operators for
        :class:`.RelationshipProperty` attributes.

        See the documentation for :class:`.PropComparator` for a brief
        overview of ORM level operator definition.

        See also:

        :class:`.PropComparator`

        :class:`.ColumnProperty.Comparator`

        :class:`.ColumnOperators`

        :ref:`types_operators`

        :attr:`.TypeEngine.comparator_factory`

        cC@s1||_||_||_|r-||_ndS(sConstruction of :class:`.RelationshipProperty.Comparator`
            is internal to the ORM's attribute mechanics.

            N(tpropt
_parententityt_adapt_to_entityt_of_type(RRRZtparentmappertadapt_to_entitytof_type((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR&|s
			cC@s%|j|j|jd|d|jƒS(NR_R`(t	__class__tpropertyR[R](RRR_((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR_ˆscC@s
|jjS(sÑThe target :class:`.Mapper` referred to by this
            :class:`.RelationshipProperty.Comparator`.

            This is the "target" or "remote" side of the
            :func:`.relationship`.

            (RbR(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRs	cC@s
|jjS(N(Rbtparent(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR[˜scC@s$|jr|jjS|jjjSdS(N(R\t
selectableRbRct_with_polymorphic_selectable(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_source_selectableœs	
c	C@s|jƒ}|jr*t|jƒj}nd}|jjd|dtd|ƒ\}}}}}}|dk	rw||@S|SdS(Ntsource_selectabletsource_polymorphicR`(RfR]RRR-Rbt
_create_joinsR(	RRt
adapt_fromR`tpjtsjtsourcetdestR)ttarget_adapter((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt__clause_element__¢s	cC@s%tj|j|jd|jd|ƒS(sïProduce a construct that represents a particular 'subtype' of
            attribute for the parent class.

            Currently this is usable in conjunction with :meth:`.Query.join`
            and :meth:`.Query.outerjoin`.

            R_R`(R"RBRbR[R\(RRtcls((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR`³s
		cC@stdƒ‚dS(s†Produce an IN clause - this is not implemented
            for :func:`~.orm.relationship`-based attributes at this time.

            svin_() not yet supported for relationships.  For a simple many-to-one, use in_() against the set of foreign key values.N(tNotImplementedError(RRtother((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytin_ÁscC@s¡t|tjtjfƒr`|jjttgkr>|j	ƒSt
|jjdd|j
ƒƒSn=|jjr~tjdƒ‚nt
|jj|d|j
ƒƒSdS(s­Implement the ``==`` operator.

            In a many-to-one context, such as::

              MyClass.some_prop == <some object>

            this will typically produce a
            clause such as::

              mytable.related_id == <some id>

            Where ``<some id>`` is the primary key of the given
            object.

            The ``==`` operator provides partial functionality for non-
            many-to-one comparisons:

            * Comparisons against collections are not supported.
              Use :meth:`~.RelationshipProperty.Comparator.contains`.
            * Compared to a scalar one-to-many, will produce a
              clause that compares the target columns in the parent to
              the given target.
            * Compared to a scalar many-to-many, an alias
              of the association table will be rendered as
              well, forming a natural join that is part of the
              main body of the query. This will not work for
              queries that go beyond simple AND conjunctions of
              comparisons, such as those which use OR. Use
              explicit joins, outerjoins, or
              :meth:`~.RelationshipProperty.Comparator.has` for
              more comprehensive non-many-to-one scalar
              membership tests.
            * Comparisons against ``None`` given in a one-to-many
              or many-to-many context produce a NOT EXISTS clause.

            tadapt_sources]Can't compare a collection to an object or collection; use contains() to test for membership.N(t
isinstanceRtNoneTypeRtNullRbR.RRt_criterion_existsRt_optimized_compareR-tadapterR'ROtInvalidRequestError(RRRs((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt__eq__Ís%	cK@s,t|ddƒršt|jƒ}|j|j|j}}}|jjr`|r`|j	ƒ}n|j
}|dk	r¦|dk	rŽ||@}q—|}q¦nt}d}|jr¾|j
ƒ}nd}|jjdtd|d|ƒ\}	}
}}}
}xO|D]G}t|jjj|ƒ||k}|dkr;|}qþ||@}qþW|
dk	rht|	ƒ|
@}nt|	d|jjƒ}|dk	r«|r«|r«|j|ƒ}n|dk	rÐ|jitd6ƒ}n|tjj|ƒ@}tjdg|d|ƒj|ƒ}|
dk	r(|j|
ƒ}n|S(	NR]tdest_polymorphictdest_selectableRgtexcludetno_replacement_traverseitfrom_obj(tgetattrR-RR]RRdtis_aliased_classRbt_is_self_referentialtaliast_single_table_criterionRKR{RfRiRRWRR6ttraverset	_annotateRtTrue_t_ifnonetexiststcorrelate_except(RRt	criteriontkwargsRFt
target_mappert
to_selectableR„tsingle_critRgRkRlRmRnR)Rotktcrittjtex((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRysN	
	
"	$cK@s.|jjstjdƒ‚n|j||S(smProduce an expression that tests a collection against
            particular criterion, using EXISTS.

            An expression like::

                session.query(MyClass).filter(
                    MyClass.somereference.any(SomeRelated.x==2)
                )


            Will produce a query like::

                SELECT * FROM my_table WHERE
                EXISTS (SELECT 1 FROM related WHERE related.my_id=my_table.id
                AND related.x=2)

            Because :meth:`~.RelationshipProperty.Comparator.any` uses
            a correlated subquery, its performance is not nearly as
            good when compared against large target tables as that of
            using a join.

            :meth:`~.RelationshipProperty.Comparator.any` is particularly
            useful for testing for empty collections::

                session.query(MyClass).filter(
                    ~MyClass.somereference.any()
                )

            will produce::

                SELECT * FROM my_table WHERE
                NOT EXISTS (SELECT 1 FROM related WHERE
                related.my_id=my_table.id)

            :meth:`~.RelationshipProperty.Comparator.any` is only
            valid for collections, i.e. a :func:`.relationship`
            that has ``uselist=True``.  For scalar references,
            use :meth:`~.RelationshipProperty.Comparator.has`.

            s9'any()' not implemented for scalar attributes. Use has().(RbR'ROR|Ry(RRRŽR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytanyCs)cK@s.|jjrtjdƒ‚n|j||S(sâProduce an expression that tests a scalar reference against
            particular criterion, using EXISTS.

            An expression like::

                session.query(MyClass).filter(
                    MyClass.somereference.has(SomeRelated.x==2)
                )


            Will produce a query like::

                SELECT * FROM my_table WHERE
                EXISTS (SELECT 1 FROM related WHERE
                related.id==my_table.related_id AND related.x=2)

            Because :meth:`~.RelationshipProperty.Comparator.has` uses
            a correlated subquery, its performance is not nearly as
            good when compared against large target tables as that of
            using a join.

            :meth:`~.RelationshipProperty.Comparator.has` is only
            valid for scalar references, i.e. a :func:`.relationship`
            that has ``uselist=False``.  For collection references,
            use :meth:`~.RelationshipProperty.Comparator.any`.

            s4'has()' not implemented for collections.  Use any().(RbR'ROR|Ry(RRRŽR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pythastscK@sd|jjstjdƒ‚n|jj|d|jƒ}|jjdk	r`|j|ƒ|_	n|S(sd	Return a simple expression that tests a collection for
            containment of a particular item.

            :meth:`~.RelationshipProperty.Comparator.contains` is
            only valid for a collection, i.e. a
            :func:`~.orm.relationship` that implements
            one-to-many or many-to-many with ``uselist=True``.

            When used in a simple one-to-many context, an
            expression like::

                MyClass.contains(other)

            Produces a clause like::

                mytable.id == <some id>

            Where ``<some id>`` is the value of the foreign key
            attribute on ``other`` which refers to the primary
            key of its parent object. From this it follows that
            :meth:`~.RelationshipProperty.Comparator.contains` is
            very useful when used with simple one-to-many
            operations.

            For many-to-many operations, the behavior of
            :meth:`~.RelationshipProperty.Comparator.contains`
            has more caveats. The association table will be
            rendered in the statement, producing an "implicit"
            join, that is, includes multiple tables in the FROM
            clause which are equated in the WHERE clause::

                query(MyClass).filter(MyClass.contains(other))

            Produces a query like::

                SELECT * FROM my_table, my_association_table AS
                my_association_table_1 WHERE
                my_table.id = my_association_table_1.parent_id
                AND my_association_table_1.child_id = <some id>

            Where ``<some id>`` would be the primary key of
            ``other``. From the above, it is clear that
            :meth:`~.RelationshipProperty.Comparator.contains`
            will **not** work with many-to-many collections when
            used in queries that move beyond simple AND
            conjunctions, such as multiple
            :meth:`~.RelationshipProperty.Comparator.contains`
            expressions joined by OR. In such cases subqueries or
            explicit "outer joins" will need to be used instead.
            See :meth:`~.RelationshipProperty.Comparator.any` for
            a less-performant alternative using EXISTS, or refer
            to :meth:`.Query.outerjoin` as well as :ref:`ormtutorial_joins`
            for more details on constructing outer joins.

            s9'contains' not implemented for scalar attributes.  Use ==RuN(
RbR'ROR|RzR{R+R-t'_Comparator__negated_contains_or_equalstnegation_clause(RRRsRtclause((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytcontains–s8	c	@s
ˆjjtkr°tj|ƒ}‡fd†}‡fd†}ˆjjr°tjgˆjjD]H\}}tj	||ƒ|||ƒ||ƒk||ƒdkƒ^q^ŒSntjgtˆjjj
ˆjjj|ƒƒD]\}}||k^qތ}ˆj|ƒS(Nc
@sL|j}tj|dtdˆjj|ˆjjj|||dtj	ƒƒS(Ntuniquet	callable_tpassive(
tdictRt	bindparamRRbt_get_attr_w_warn_on_noneRt_get_state_attr_by_columnR
tPASSIVE_OFF(txtstatetcoltdict_(RR(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytstate_bindparamßs		c@sˆjrˆj|ƒS|SdS(N(R{(R§(RR(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytadaptês	
(RbR.RR
tinstance_statet_use_getRtand_R>tor_R-tzipRtprimary_keytprimary_key_from_instanceRy(RRRsR¦R©RªR¥tyRŽ((RRsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt__negated_contains_or_equalsÛs\7cC@st|tjtjfƒrZ|jjtkrMt|jj	dd|jƒƒS|jƒSn1|jj
rxtjdƒ‚nt|j|ƒƒSdS(s$Implement the ``!=`` operator.

            In a many-to-one context, such as::

              MyClass.some_prop != <some object>

            This will typically produce a clause such as::

              mytable.related_id != <some id>

            Where ``<some id>`` is the primary key of the
            given object.

            The ``!=`` operator provides partial functionality for non-
            many-to-one comparisons:

            * Comparisons against collections are not supported.
              Use
              :meth:`~.RelationshipProperty.Comparator.contains`
              in conjunction with :func:`~.expression.not_`.
            * Compared to a scalar one-to-many, will produce a
              clause that compares the target columns in the parent to
              the given target.
            * Compared to a scalar many-to-many, an alias
              of the association table will be rendered as
              well, forming a natural join that is part of the
              main body of the query. This will not work for
              queries that go beyond simple AND conjunctions of
              comparisons, such as those which use OR. Use
              explicit joins, outerjoins, or
              :meth:`~.RelationshipProperty.Comparator.has` in
              conjunction with :func:`~.expression.not_` for
              more comprehensive non-many-to-one scalar
              membership tests.
            * Comparisons against ``None`` given in a one-to-many
              or many-to-many context produce an EXISTS clause.

            Rus]Can't compare a collection to an object or collection; use contains() to test for membership.N(RvRRwRRxRbR.RRRzR-R{RyR'ROR|R™(RRRs((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt__ne__s'
cC@s#tjjrtjjƒn|jS(N(t	mapperlibtMappert_new_mapperst_configure_allRZ(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRb7sN(t__name__t
__module__t__doc__R-R]R&R_Rtmemoized_propertyRR[RfRpR`Rtt__hash__R}RyR—R˜RœR™R´Rb(((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRBes&					
	4B1"	E	&	6cC@s+|dk	st‚|j|dtd|ƒS(Ntvalue_is_parenttalias_secondary(R-tAssertionErrorRzR(RRtinstanceR¿((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_with_parent=sc@s5ˆdk	rtjˆƒ‰n|}ˆdkrDˆj|d|ƒS|sfˆjjˆjj}‰nˆjjˆjj}‰|r‘ˆj	‰n	ˆj
‰tjˆjƒƒ‰‡‡‡‡‡fd†}ˆj
dk	r|rtˆj
jƒƒj|ƒ}ntj|ii|d6ƒ}|r1||ƒ}n|S(NRuc@sN|jˆkrJˆjˆ|jˆjˆˆˆ|jdtjƒ|_ndS(NRŸ(t_identifying_keyR¢R£R
R¤tcallable(R¡(tbind_to_colR¨RRRR¦(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytvisit_bindparam_s

R¡(R-R
R«t_lazy_none_clauset_lazy_strategyt
_lazywheret_bind_to_colt_rev_lazywheret_rev_bind_to_colRRct
instance_dicttobjR)RR†RˆRtcloned_traverse(RRR¦R¾RuR¿treverse_directionRŽRÆ((RÅR¨RRRR¦sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRzBs4				c@s‡‡‡‡fd†}|S(Nc@s3ˆˆˆŽ}|dkr/tjdˆƒn|S(Ns Got None for value of column %s; this is unsupported for a relationship comparison and will not currently produce an IS comparison (but may in a future release)(R-Rtwarn(tvalue(targtcolumntfntkw(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_gous((RRRÔRÕRÓRÖR×((RÓRÔRÕRÖsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR¢ts	cC@sc|s"|jj|jj}}n|jj|jj}}t||ƒ}|r_||ƒ}n|S(N(RÈRÉRÊRËRÌR(RRRÐRuRŽRÅ((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRǀs		cC@st|jjjƒd|jS(Nt.(tstrRcRWR¹RX(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt__str__scC@sJ|r3x*|jD]}||f|krdSqWnd|jkrFdS|j|krYdS|jr |j|jƒj||ƒ}	t|	dƒr›|	j}	n|rÀ|j|jƒj||ƒng}
xv|	D]n}tj	|ƒ}tj
|ƒ}
t|||f<|j||
d|d|ƒ}|dk	rÍ|
j|ƒqÍqÍW|s~tj|||jƒ}x=|
D]}|j|ƒqdWqF|j|jƒj|||
ƒn¦||j}|dk	rtj	|ƒ}tj
|ƒ}
t|||f<|j||
d|d|ƒ}nd}|s$|||j<n"|j|jƒj|||dƒdS(Ntmerget_sa_adaptertloadt
_recursive(RJt_cascadeRXR'tget_impltgetthasattrRÜR
R«RÍRt_mergeR-tappendtinit_state_collectiontappend_without_eventt
_set_iterableRI(RRtsessiontsource_statetsource_dictt
dest_statet	dest_dictRÝRÞtrt	instancest	dest_listtcurrentt
current_statetcurrent_dictRÎtcolltc((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRۓsV	
	

cC@s«|j|j}|j||d|ƒ}|tjksC|dkrGgSt|dƒr‘g|j|||d|ƒD]}tj|ƒ|f^qrStj|ƒ|fgSdS(s”Return a list of tuples (state, obj) for the given
        key.

        returns an empty list if the value is None/empty/PASSIVE_NO_RESULT
        RŸtget_collectionN(	tmanagertimplRáR
tPASSIVE_NO_RESULTR-RâRõR«(RRR¦R¨RXRŸR÷R¥to((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_value_as_iterableØs8c

c@sw|dks|jr!tj}n	tj}|dkrX|j|jjj||ƒ}n|j|||jd|ƒ}|dkoŽd|j	k}xß|D]×\}	}
|	|kr¶q˜n|
dkrÈq˜ntj|
ƒ}|rï||	ƒrïq˜n|r|	jrq˜n|	jj}|j
|jjjƒsQtd|j|jj|
jfƒ‚n|j|	ƒ|
||	|fVq˜WdS(Ntdeletessave-updateRŸsrefresh-expires
delete-orphans@Attribute '%s' on class '%s' doesn't handle objects of type '%s'(R3R
tPASSIVE_NO_INITIALIZER¤RöRXR÷tget_all_pendingRúRßR-RÍRtisat
class_managerRÀRcRWRatadd(
RRttype_R¦R¨tvisited_statesthalt_onRŸttuplestskip_pendingR«RôRÍtinstance_mapper((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytcascade_iteratorìs8			
cC@s¿|jj|dtƒ}|jj|ƒ|jj|ƒ|jj|jƒsrtjd||||jfƒ‚n|j	t
tfkr»|j	|j	kr»tjd|||j	fƒ‚ndS(Nt_configure_mapperssereverse_property %r on relationship %s references relationship %s, which does not reference mapper %ssv%s and back-reference %s are both of the same direction %r.  Did you mean to set remote_side on the many-to-one side ?(Rtget_propertyRKRJRt
common_parentRcRORPR.RR(RRRXRs((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_add_reverse_property#scC@s±tj|jƒr=t|jttjfƒr=|jƒ}n	|j}t|tƒrmtj|dtƒ}n@t|jtjƒr‹|}n"t	j
d|jt|ƒfƒ‚|S(s–Return the targeted :class:`.Mapper` for this
        :class:`.RelationshipProperty`.

        This is a lazy-initializing static attribute.

        t	configuresErelationship '%s' expects a class or a mapper argument (received: %s)(RRÄR(RvttypeRµR¶tclass_mapperRKRORPRX(RRR(tmapper_((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR7s		s0.7sUse .targetcC@s|jS(s~Return the selectable linked to this
        :class:`.RelationshipProperty` object's target
        :class:`.Mapper`.
        (ttarget(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyttableQscC@sx|jƒ|jƒ|jƒ|j|jƒ|jƒ|jƒ|jjƒt	t
|ƒjƒ|jdƒ|_
dS(NR$tselect(slazysselect((slazysselect(t_check_conflictst_process_dependent_argumentst_setup_join_conditionst_check_cascade_settingsRßt
_post_initt_generate_backreft_join_conditiont"_warn_for_conflicting_sync_targetsR%R"tdo_initt
_get_strategyRÈ(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRZs





cC@sNxBd
D]:}t||ƒ}tj|ƒrt|||ƒƒqqWxNdD]F}t||ƒ}|d	k	rLt||ttj||ƒƒƒqLqLW|jt	k	rë|jd	k	rëgtj
|jƒD]}tj|dƒ^qÇ|_ntjd„tj|j
ƒDƒƒ|_
tjd„tj|jƒDƒƒ|_|jj|_d	S(sŠConvert incoming configuration arguments to their
        proper form.

        Callables are resolved, ORM annotations removed.

        RMR*R+R)R1R6cs@s!|]}tj|dƒVqdS(RSN(Rt_only_column_elements(t.0R¥((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pys	<genexpr>Šscs@s!|]}tj|dƒVqdS(R6N(RR(RR¥((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pys	<genexpr>‘sN(sorder_bysprimaryjoins
secondaryjoins	secondarys_user_defined_foreign_keyssremote_side(sprimaryjoins
secondaryjoin(RƒRRÄtsetattrR-RRRRMRKtto_listt
column_sett
to_column_setR1R6Rtmapped_tableR(RRtattrt
attr_valuetvalR¥((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRes,


4c!C@s td|jjd|jjd|jjd|jjd|jd|jd|jd|jjd	|jjd
|j	d|j
d|jd
|jd|d|j
d|jƒ|_}|j|_|j|_|j|_|j
|_
|j|_|j|_|j|_|j|_|j|_dS(Ntparent_selectabletchild_selectabletparent_local_selectabletchild_local_selectableR*R)R+tparent_equivalentstchild_equivalentstconsider_as_foreign_keysR>R6tself_referentialRZtsupport_synctcan_be_synced_fn(t
JoinConditionRcR#Rtlocal_tableR*R)R+t_equivalent_columnsR1R>R6R…R/t_columns_are_mappedRtdeannotated_primaryjointdeannotated_secondaryjoinR.tremote_columnst
local_columnstsynchronize_pairstforeign_key_columnst_calculated_foreign_keystsecondary_synchronize_pairs(RRtjc((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR—s4							
cC@sÙ|jjrhtj|jjdtƒj|jƒrhtj	d|j|jjj
|jjj
fƒ‚n|jjsÕx^|jjƒD]J}||jk	r„|j|jƒr„t
jd|j|j|fƒq„q„WndS(sOTest that this relationship is legal, warn about
        inheritance conflicts.RsÂAttempting to assign a new relationship '%s' to a non-primary mapper on class '%s'.  New relationships can only be added to the primary mapper, i.e. the very first mapper created for class '%s' s’Warning: relationship '%s' on mapper '%s' supersedes the same relationship on inherited mapper '%s'; this can cause dependency issues during flushN(Rctnon_primaryRµRRWRKthas_propertyRXRORPR¹tconcretetiterate_to_rootRRÑ(RRt
inheriting((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR´s	cC@s|jS(s\Return the current cascade setting for this
        :class:`.RelationshipProperty`.
        (Rß(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_get_cascadeÏscC@sPt|ƒ}d|jkr+|j|ƒn||_|jrL||j_ndS(NR(Rt__dict__RRßt_dependency_processorRL(RRRL((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_set_cascadeÕs		c	C@sè|jrG|jrG|jtks1|jtkrGtjd|ƒ‚n|jtkrs|jrstj	d|ƒn|jdkr°d|ksšd|kr°tjd|ƒ‚n|jrä|j
jƒjj
|j|jjfƒndS(NsªOn %s, delete-orphan cascade is not supported on a many-to-many or many-to-one relationship when single_parent is not set.   Set single_parent=True on the relationship().slOn %s, 'passive_deletes' is normally configured on one-to-many, one-to-one, many-to-many relationships only.tallRûs
delete-orphans^On %s, can't set passive_deletes='all' in conjunction with 'delete' or 'delete-orphan' cascade(t
delete_orphanR0R.RRRORPR3RRÑRtprimary_mappert_delete_orphansRäRXRcRW(RRRL((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRàs$	
	
	cG@srxk|D]c}|jdk	r7|jjj|ƒr7qn|jjjj|ƒr|jjj|ƒrtSqWtS(sˆReturn True if all columns in the given collection are
        mapped by the tables referenced by this :class:`.Relationship`.

        N(	R)R-Rôtcontains_columnRcR#RRKR(RRtcolsRô((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR4üs
cC@s|jjrdS|jdk	ró|jrót|jtjƒrQ|ji}}n|j\}}|jj	ƒ}t
|jƒƒj|j
ƒ}x<|D]4}|j|ƒr”tjd|||fƒ‚q”q”W|jdk	r|jd|jjƒ}|jd|jjƒ}nB|jd|jjƒ}|jddƒ}|rPtjdƒ‚n|jd|jƒ}|jj	ƒ}	|jd|jƒ|jd|jƒ|jd	|jƒ||_t|	|j||d|d
|j|}
|j||
ƒn|jr|j |jƒndS(shInterpret the 'backref' instruction to create a
        :func:`.relationship` complementary to this one.Ns]Error creating backref '%s' on relationship '%s': property of that name exists on mapper '%s'R*R+sOCan't assign 'secondaryjoin' on a backref against a non-secondary relationship.RSR/R,R5RN(!RcR>RQR-RNRvRtstring_typesRRIRIRAtuniontself_and_descendantsR?RORPR)tpopRtsecondaryjoin_minus_localtprimaryjoin_minus_localtprimaryjoin_reverse_remoteR|R1t
setdefaultR/R,R5R"RXt_configure_propertyR(RRtbackref_keyRRtchecktmRkRlRSRcR#((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR
sX
						cC@sI|jdkr$|jtk	|_n|jsEtjj|ƒ|_ndS(N(	R'R-R.RR/R	tDependencyProcessortfrom_relationshipRE(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRLs	cC@s|j}|jS(sPmemoize the 'use_get' attribute of this RelationshipLoader's
        lazyloader.(RÈtuse_get(RRtstrategy((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR¬Ss	cC@s|jj|jƒS(N(RR
Rc(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR…[sc
C@sH|dkr0|r0|jjr0|jj}q0nt}|dkr¢|ri|jjri|jj}t}n|jj}|jr¨|dkr¨|j	ƒ}t}q¨nt}|p´|j}|j
}|pÏ|dk	}|jj||||ƒ\}	}
}}}|dkr|jj
}n|dkr2|jj
}n|	|
||||fS(N(R-Rctwith_polymorphicReRKRRR#R…R†R‡Rtjoin_targetsR2(
RRRhRgR~RR`taliasedtdest_mapperR’R*R+R)Ro((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRi_s0			!	(+R¹RºR»tstrategy_wildcard_keyR-RERKRR&RYRRBRÂRzR¢RÇRÚRÛR
R¤RúRRRR¼Rt
deprecatedRRRRRRCRFRbRLRR4RRR¬R…Ri(((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR"Ms|ÿÿç		ÿÙ0			F6			2								B	c@s1‡‡fd†‰|dk	r-ˆ|ƒ}n|S(Nc@s>t|tjƒr*|jˆjƒƒ}n|jdˆƒ|S(Ntclone(RvRtColumnClauseR‰tcopyt_copy_internals(telem(tannotationsRc(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRc†s(R-(telementRh((RhRcsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR…sR1c
B@sâeZd&d&d&d&d&d&d&d&ed&ed„d„Zd„Zd„Zed„ƒZ	ed„ƒZ
ejd„ƒZ
d„Zejd„ƒZejd	„ƒZd
„Zd„Zd„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"e#j$ƒZ%d„Z&ejd„ƒZ'ejd„ƒZ(ejd„ƒZ)ejd „ƒZ*ejd!„ƒZ+d"„Z,d#„Z-d&d$„Z.ed%„Z/RS('cG@stS(N(R(Rô((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt<lambda>¢scC@s||_||_||_||_||_|	|_||_||_||_|
|_	||_
||_||_|
|_
||_||_|jƒ|jƒ|jƒ|jƒ|jƒ|j|jtƒ|jdk	rú|j|jtƒn|jƒ|jƒ|jƒdS(N(R'R)R(R*R+R,R*R+R)R-RTt_remote_sideRZR.R/R0t_determine_joinst
_annotate_fkst_annotate_remotet_annotate_localt_setup_pairst_check_foreign_colsRR-RKt_determine_directiont_check_remote_sidet
_log_joins(RRR'R(R)R*R*R)R+R+R,R-R>R6R.RZR/R0((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR&’s6																






cC@sP|jdkrdS|jj}|jd|j|jƒ|jd|j|jƒ|jd|jdjd„|jDƒƒƒ|jd|jdjd„|jp¤gDƒƒƒ|jd|jdjd	„|j	Dƒƒƒ|jd
|jdjd„|j
Dƒƒƒ|jd|jdjd
„|jDƒƒƒ|jd|j|jƒdS(Ns%s setup primary join %ss%s setup secondary join %ss%s synchronize pairs [%s]t,cs@s%|]\}}d||fVqdS(s
(%s => %s)N((RtlRí((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pys	<genexpr>Éss#%s secondary synchronize pairs [%s]cs@s%|]\}}d||fVqdS(s
(%s => %s)N((RRvRí((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pys	<genexpr>Ìss%s local/remote pairs [%s]cs@s%|]\}}d||fVqdS(s	(%s / %s)N((RRvRí((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pys	<genexpr>Ïss%s remote columns [%s]cs@s|]}d|VqdS(s%sN((RR§((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pys	<genexpr>Òss%s local columns [%s]cs@s|]}d|VqdS(s%sN((RR§((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pys	<genexpr>Õss%s relationship direction %s(
RZR-tloggerRFR*R+tjoinR9R<R>R7R8R.(RRR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRtÀs,

c	C@sÃ|jdk	r7|jdkr7tjd|jƒ‚nyÐ|jpFd}|jdk	rÍ|jdkr‘t|j|jd|j	d|ƒ|_n|j
dkrt|j|jd|jd|ƒ|_
qn9|j
dkrt|j|jd|jd|ƒ|_
nWnµtj
k
rd|jdk	rKtj
d|j|jfƒ‚q¿tj
d|jƒ‚n[tjk
r¾|jdk	r¥tjd|j|jfƒ‚q¿tjd|jƒ‚nXdS(	sõDetermine the 'primaryjoin' and 'secondaryjoin' attributes,
        if not passed to the constructor already.

        This is based on analysis of the foreign key relationships
        between the parent and target mapped selectables.

        sMProperty %s specified with secondary join condition but no secondary argumentta_subsetR-s1Could not determine join condition between parent/child tables on relationship %s - there are no foreign keys linking these tables via secondary table '%s'.  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify 'primaryjoin' and 'secondaryjoin' expressions.sCould not determine join condition between parent/child tables on relationship %s - there are no foreign keys linking these tables.  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify a 'primaryjoin' expression.slCould not determine join condition between parent/child tables on relationship %s - there are multiple foreign key paths linking the tables via secondary table '%s'.  Specify the 'foreign_keys' argument, providing a list of those columns which should be counted as containing a foreign key reference from the secondary table to each of the parent and child tables.s'Could not determine join condition between parent/child tables on relationship %s - there are multiple foreign key paths linking the tables.  Specify the 'foreign_keys' argument, providing a list of those columns which should be counted as containing a foreign key reference to the parent table.N(R+R-R)RORPRZR-RR(R*R*R'R)tNoForeignKeysErrortAmbiguousForeignKeysError(RRR-((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRlÚsR							cC@st|jddƒS(NtvaluestlocalR(slocalsremote(RR*(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRR5scC@st|jddƒS(NR|R}R(slocalsremote(RR+(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRQ9scC@sU|jr(d„}tj|ji|ƒS|jrDt|jddƒSt|jƒSdS(s(Return the primaryjoin condition suitable for the
        "reverse" direction.

        If the primaryjoin was delivered here with pre-existing
        "remote" annotations, the local/remote annotations
        are reversed.  Otherwise, the local/remote annotations
        are removed.

        cS@s|d|jkr<|jjƒ}|d=t|d<|j|ƒSd|jkrx|jjƒ}|d=t|d<|j|ƒSdS(NRR}(t_annotationsReRt_with_annotations(Ritv((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytreplaceJs


R|R}RN(slocalsremote(t_has_remote_annotationsRtreplacement_traverseR*t_has_foreign_annotationsR(RRR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRS>s			cC@s8x1tj|iƒD]}||jkrtSqWtSdS(N(RtiterateR~RRK(RRR›t
annotationR§((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_has_annotation_scC@s|j|jdƒS(NR!(R‡R*(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR„fscC@s|j|jdƒS(NR(R‡R*(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR‚jscC@s1|jr
dS|jr#|jƒn
|jƒdS(s‘Annotate the primaryjoin and secondaryjoin
        structures with 'foreign' annotations marking columns
        considered as foreign.

        N(R„R-t_annotate_from_fk_listt_annotate_present_fks(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRmns
		
c@s[‡fd†}tjˆji|ƒˆ_ˆjdk	rWtjˆji|ƒˆ_ndS(Nc@s'|ˆjkr#|jitd6ƒSdS(NR!(R-R‰R(R§(RR(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytcheck_fk}s(RRƒR*R+R-(RRRŠ((RRsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRˆ|sc@s¨|jdk	r'tj|jjƒ‰n	tƒ‰‡fd†‰‡fd†}tj|jii|d6ƒ|_|j	dk	r¤tj|j	ii|d6ƒ|_	ndS(Nc@s’t|tjƒrMt|tjƒrM|j|ƒr7|S|j|ƒrM|SnˆrŽ|ˆkro|ˆkro|S|ˆkrŽ|ˆkrŽ|SndS(N(RvRtColumnt
references(tatb(t
secondarycols(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt
is_foreign’sc@sát|jtjƒs,t|jtjƒr0dSd|jjkrÝd|jjkr݈|j|jƒ}|dk	rÝ|j|jƒr¦|jjit	d6ƒ|_qÚ|j|jƒrÚ|jjit	d6ƒ|_qÚqÝndS(NR!(
RvtleftRt
ColumnElementtrightR~R-tcompareR‰R(tbinaryR§(R(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytvisit_binary s		R•(
R)R-RR!RôRIRRÏR*R+(RRR–((RRsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR‰Œs	c@sU|j‰|j‰tg‰‡‡‡fd†}tj|jii|d6ƒˆdS(svReturn True if the join condition contains column
        comparisons where both columns are in both tables.

        c@s|j|j}}t|tjƒrŒt|tjƒrŒˆj|jƒrŒˆj|jƒrŒˆj|jƒrŒˆj|jƒrŒtˆd<ndS(Ni(R‘R“RvRRdtis_derived_fromRR(R•Rôtf(tmttpttresult(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR–ÅsR•i(R'R(RKRRˆR*(RRR–((R™RšR›sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_refers_to_parent_table¼s			cC@st|j|jƒS(s5Return True if parent/child tables have some overlap.(RR'R((RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_tables_overlap×scC@s‘|jr
dS|jdk	r)|jƒnd|js;|jrH|jƒnE|jƒrj|jd„t	ƒn#|j
ƒrƒ|jƒn
|jƒdS(s¢Annotate the primaryjoin and secondaryjoin
        structures with 'remote' annotations marking columns
        considered as part of the 'remote' side.

        NcS@s
d|jkS(NR!(R~(R§((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRjës(
R‚R)R-t_annotate_remote_secondaryRTRkt_annotate_remote_from_argsRœt_annotate_selfrefRKRt_annotate_remote_with_overlapt%_annotate_remote_distinct_selectables(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRnÝs	


c@sI‡fd†}tjˆji|ƒˆ_tjˆji|ƒˆ_dS(s^annotate 'remote' in primaryjoin, secondaryjoin
        when 'secondary' is present.

        c@s-ˆjjj|ƒr)|jitd6ƒSdS(NR(R)RôRKR‰R(Ri(RR(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytreplösN(RRƒR*R+(RRR£((RRsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRžñs
c@s;‡‡‡fd†}tjˆjii|d6ƒˆ_dS(sxannotate 'remote' in primaryjoin, secondaryjoin
        when the relationship is detected as self-referential.

        c@s¼|jj|jƒ}t|jtjƒr¥t|jtjƒr¥ˆ|jƒrm|jjitd6ƒ|_nˆ|jƒr¸|r¸|jjitd6ƒ|_q¸nˆs¸ˆjƒndS(NR(	R‘R”R“RvRRdR‰Rt_warn_non_column_elements(R•tequated(RÕtremote_side_givenRR(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR–	s	R•N(RRÏR*(RRRÕR¦R–((RÕR¦RRsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR þs
	c@s¨|jrI|jr$tjdƒ‚ng|jD]\}}|^q.‰n	|j‰|jƒrz|j‡fd†tƒn*‡fd†}tj|j	i|ƒ|_	dS(sannotate 'remote' in primaryjoin, secondaryjoin
        when the 'remote_side' or '_local_remote_pairs'
        arguments are used.

        sTremote_side argument is redundant against more detailed _local_remote_side argument.c@s
|ˆkS(N((R§(R6(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRj&	sc@s$|ˆkr |jitd6ƒSdS(NR(R‰R(Ri(R6(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR£(	sN(
RTRkRORPRœR RRRƒR*(RRRvRíR£((R6sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRŸ	s		%	c@sn‡fd†}ˆjdk	o3ˆjjˆjjk	‰‡‡fd†‰tjˆjii|d6ƒˆ_dS(sÆannotate 'remote' in primaryjoin, secondaryjoin
        when the parent/child tables have some set of
        tables in common, though is not a fully self-referential
        relationship.

        c@sFˆ|j|jƒ\|_|_ˆ|j|jƒ\|_|_dS(N(R‘R“(R•(tproc_left_right(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR–5	s		c@søt|tjƒrjt|tjƒrjˆjjj|ƒrîˆjjj|ƒrî|jitd6ƒ}qîn„ˆr§|j	j
dƒˆjjkr§|jitd6ƒ}nGˆrä|j	j
dƒˆjjkrä|jitd6ƒ}n
ˆj
ƒ||fS(NRR^(RvRRdR(RôRKR'R‰RR~RáRZRR¤(R‘R“(tcheck_entitiesRR(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR§>	s
R•N(RZR-RRcRRÏR*(RRR–((R¨R§RRsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR¡.	s	c@s.‡fd†}tjˆji|ƒˆ_dS(s}annotate 'remote' in primaryjoin, secondaryjoin
        when the parent/child tables are entirely
        separate.

        c@sXˆjjj|ƒrTˆjjj|ƒs@ˆjjj|ƒrT|jitd6ƒSdS(NR(R(RôRKR)R*R‰R(Ri(RR(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR£Y	s
	N(RRƒR*(RRR£((RRsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR¢S	scC@stjd|jƒdS(NsƒNon-simple column elements in primary join condition for property %s - consider using remote() annotations to mark the remote side.(RRÑRZ(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR¤c	sc@s“|j|jdƒrdS|jrPtjg|jD]\}}|^q2ƒ‰ntj|jjƒ‰‡fd†}tj|ji|ƒ|_dS(sCAnnotate the primaryjoin and secondaryjoin
        structures with 'local' annotations.

        This annotates all column elements found
        simultaneously in the parent table
        and the join condition that don't have a
        'remote' annotation set up from
        _annotate_remote() or user-defined.

        R}Nc@s3d|jkr/|ˆkr/|jitd6ƒSdS(NRR}(R~R‰R(Rg(t
local_side(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytlocals_	s(	R‡R*RTRR!R'RôRRƒ(RRRvRíRª((R©sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRok	s		%cC@s)|js%tjd|jfƒ‚ndS(NsRelationship %s could not determine any unambiguous local/remote column pairs based on join condition and remote_side arguments.  Consider using the remote() annotation to accurately mark those elements of the join condition that are on the remote side of the relationship.(R>RORPRZ(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRs‡	s	cC@st}|j|dƒ}t|ƒ}|r<t|jƒ}nt|jƒ}|jrZ|sj|jrn|rndS|jrÂ|rÂ|rÂd|r“dp–d||jf}|d7}tj|ƒ‚n;d|rÑdpÔd||jf}|d7}tj|ƒ‚dS(	sHCheck the foreign key columns collected and emit error
        messages.R!NsŒCould not locate any simple equality expressions involving locally mapped foreign key columns for %s join condition '%s' on relationship %s.tprimaryR)s  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or are annotated in the join condition with the foreign() annotation. To allow comparison operators other than '==', the relationship can be marked as viewonly=True.s`Could not locate any relevant foreign key columns for %s join condition '%s' on relationship %s.s¡  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or are annotated in the join condition with the foreign() annotation.(	RKt_gather_columns_with_annotationtboolR9R<R/RZRORP(RRRR«tcan_synctforeign_colsthas_foreignterr((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRq“	s2

c	C@s•|jdk	rt|_nvtj|jjƒ}tj|jjƒ}|j	|j
ƒ}|j	|j
ƒ}|rW|rW|j|jddƒ}t
g|j|jdƒD]}d|jkr¦|^q¦ƒ}|r|r|jj	|jƒ}|j|ƒ}|j|ƒ}n|r%|r%t|_q‘|r>|r>t|_q‘tjd|jƒ‚n:|rit|_n(|r{t|_ntjd|jƒ‚dS(s[Determine if this relationship is one to many, many to one,
        many to many.

        RR!sDCan't determine relationship direction for relationship '%s' - foreign key columns within the join condition are present in both the parent and the child's mapped tables.  Ensure that only those columns referring to a parent column are marked as foreign, either via the foreign() annotation or via the foreign_keys argument.s’Can't determine relationship direction for relationship '%s' - foreign key columns are present in neither the parent nor the child's mapped tablesN(R+R-RR.RR!R'RôR(tintersectionR:R¬R*RIR~R7R8t
differenceRRRORPRZ(	RRt
parentcolst
targetcolstonetomany_fktmanytoone_fktonetomany_localRôtmanytoone_localtself_equated((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRrÉ	sF	
	

cC@s/g|D]$\}}|jƒ|jƒf^qS(sÅprovide deannotation for the various lists of
        pairs, so that using them in hashes doesn't incur
        high-overhead __eq__() comparisons against
        original columns mapped.

        (t_deannotate(RRt
collectionR¥R²((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt_deannotate_pairs
sc@sµg}tjgƒ‰g}‡‡fd†}xKˆj|fˆj|fgD]+\}}|dkrjqLn|||ƒqLWˆjˆƒˆ_ˆj|ƒˆ_ˆj|ƒˆ_dS(Nc@s&‡‡‡fd†}t||ƒdS(Nc@sûd|jkrCd|jkrCˆj|ƒrCˆj||fƒnCd|jkr†d|jkr†ˆj|ƒr†ˆj||fƒn|jtjkr÷ˆj||ƒr÷d|jkrψj||fƒq÷d|jkr÷ˆj||fƒq÷ndS(NRR!(R~R0RtoperatorRteqRä(R•R‘R“(R¼tlrpRR(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR–(
s(R(tjoincondR¼R–(RÀRR(R¼sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytgo'
s(	Rt
OrderedSetR*R+R-R½R>R9R<(RRt
sync_pairstsecondary_sync_pairsRÂRÁR¼((RÀRRsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRp"
sc	@s‰|js
dSxug|jD]\}‰|ˆf^qg|jD]\}‰|ˆf^q?D]%\}‰tˆjƒdkrƒq\nˆ|jkrµtji||j6ƒ|jˆ<q\g}|jˆ}x`|j	ƒD]R\}}|j
tjkrÕ||k	rÕ||jj
krÕ|j||fƒqÕqÕW|rmtjd|j|ˆdj‡fd†|Dƒƒfƒn||jˆ|j<q\WdS(Nisôrelationship '%s' will copy column %s to column %s, which conflicts with relationship(s): %s. Consider applying viewonly=True to read-only relationships, or provide a primaryjoin condition marking writable columns with the foreign() annotation.s, c3@s(|]\}}d||ˆfVqdS(s'%s' (copies %s to %s)N((Rtprtfr_(tto_(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pys	<genexpr>v
s(R/R9R<tlenRSt_track_overlapping_sync_targetstweakreftWeakKeyDictionaryRZtitemsRRµt_mapper_registryRJRäRRÑRx(RRtfrom_tother_propstprop_to_fromRÆRÇ((RÈsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRH
s2	%3#
cC@s
|jdƒS(NR(t_gather_join_annotations(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR7|
scC@s
|jdƒS(NR}(RÒ(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR8€
scC@s
|jdƒS(NR!(RÒ(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR:„
scC@s
t|jƒS(N(RR*(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR5ˆ
scC@s$|jdk	rt|jƒSdSdS(N(R+R-R(RR((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR6Œ
s
cC@slt|j|j|ƒƒ}|jdk	rI|j|j|j|ƒƒntg|D]}|jƒ^qSƒS(N(RIR¬R*R+R-tupdateR»(RRR†tsR¥((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRÒ“
scG@sGt|ƒ}tgtj|iƒD]}|j|jƒr"|^q"ƒS(N(RIRR…tissubsetR~(RRR›R†R§((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR¬Ÿ
scC@s–t|itd6ƒ}|j|j|j}}}|dk	re|dk	rX||@}qe||@}n|r}|dk	rø|jdtƒ}t|ƒ}t|d|jƒj	|ƒ}	|dk	ræt|ƒj	t|d|j
ƒƒ}n|	j|ƒ}n^t|dtdƒd|jƒ}|dk	rP|j	t|dtdƒd|j
ƒƒnd}	|j|ƒ}|	pn|}
d|
_
nd}
||||
|fS(s7Given a source and destination selectable, create a
        join between them.

        This takes into account aliasing the join clause
        to reference the appropriate corresponding columns
        in the target objects, as well as the extra child
        criterion, equivalent column sets, etc.

        Rtflattequivalentst
exclude_fnR}RN(R
RR*R+R)R-R†RR,tchainR+Rˆt_ColInAnnotationsRØ(RRRgRR_R’R*R+R)tprimary_aliasizertsecondary_aliasizerRo((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR^¦
sL

				c	@sštjƒ‰tjƒ}|jdk	‰ˆrztjtƒ‰xŒ|jD]-\}}ˆ|j||fƒ|||<qFWnQˆs§xH|jD]\}}|||<qŠWn$x!|jD]\}}|||<q±W‡‡‡‡fd†}|j	}|jdksˆrt
j|i|ƒ}n|jdk	re|j}ˆrPt
j|i|ƒ}ntj
||ƒ}nt‡fd†ˆDƒƒ}t|ƒ}|||fS(Nc
@s„ˆrd|jksDˆr€ˆr.|ˆksDˆr€d|jkr€|ˆkrxtjddd|jdtƒˆ|<nˆ|SdS(NR}RRR(R~RR¡R-R
R(R§(tbindst
has_secondarytlookupRÐ(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytcol_to_binds"c3@s"|]}ˆ|j|fVqdS(N(RX(RR§(RÝ(sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pys	<genexpr>s(Rtcolumn_dictR+R-tcollectionstdefaultdicttlistR>RäR*RRƒRR­R R(	RRRÐtequated_columnsRvRíRàt	lazywhereR+RÅ((RÝRÞRßRÐsQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pytcreate_lazy_clauseî
s6		N(0R¹RºR-RKRR&RtRlRbRRRQRR¼RSR‡R„R‚RmRˆR‰RœRRnRžR RŸR¡R¢R¤RoRsRqRrR½RpRËRÌRÊRR7R8R:R5R6RÒR¬R^Rç(((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR1‘sb		[!				0				
			%					6	O	
	$	4		
ERÚcB@s eZdZd„Zd„ZRS(sKSeralizable equivalent to:

        lambda c: "name" in c._annotations
    cC@s
||_dS(N(tname(RRRè((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyR&)scC@s|j|jkS(N(RèR~(RRRô((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt__call__,s(R¹RºR»R&Ré(((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyRÚ#s	(0R»t
__future__RtRRRRORRRËRRRR	R
tsql.utilRRR
RRRRRRRt
interfacesRRRRRt
inspectionRRRµRâRR!tclass_loggertlanghelperstdependency_forR"RtobjectR1RÚ(((sQ/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/relationships.pyt<module>s<(4(		ÿÿÿÿÿÿÿ=	ÿÿÿ•