Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/__pycache__/mapper.cpython-311.pyc

�

�܋f~�����dZddlmZddlmZddlmZddlZddlZddl	Z	ddl
mZddl
mZ
dd	l
mZdd
l
mZddl
mZddl
mZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl
m Z ddl
mZ!ddl
m"Z"ddl
m#Z#ddl
m$Z$ddl
m%Z%ddl
mZddl%m&Z&ddl%m'Z'ddl%mZ(ddl%m)Z)e	j*��Z+d a,ej-��Z.ej/d!��Z0ej1�2��Z3e"j4e#j5Gd"�d#e������Z6Gd$�d%e7��Z8d&�Z9d'�Z:d(�Z;d)�Z<d*�Z=d+�Z>Gd,�d-e?��Z@dS).a5Logic to map Python classes to and from selectables.

Defines the :class:`~sqlalchemy.orm.mapper.Mapper` class, the central
configurational unit which associates a class with a database table.

This is a semi-private module; the main configurational API of the ORM is
available in :class:`~sqlalchemy.orm.`.

�)�absolute_import)�deque)�chainN�)�
attributes)�exc)�instrumentation)�loading)�
properties)�util)�_class_to_mapper)�
_INSTRUMENTOR)�
_state_mapper)�class_mapper)�	state_str)�_MappedAttribute)�EXT_SKIP)�InspectionAttr)�MapperProperty)�PathRegistry�)�event)�
inspection)�log)�schema)�sql)�
expression)�	operators)�visitorsF�NO_ATTRIBUTEc��eZdZdZdZdZejddd���																													drd
���ZdZ		dZ
ed���Zed���Z
dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	dZ	eej d
d��d�����Z!ej"d���Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+e,d���Z-d�Z.d�Z/d�Z0dsd�Z1dZ2e3d���Z4e3d���Z5e3d ���Z6d!�Z7dtd"�Z8d#�Z9d$�Z:d%�Z;d&�Z<d'�Z=ed(���Z>d)�Z?d*�Z@d+�ZAd,�ZBd-�ZCd.�ZDdud/�ZEd0�ZFed1���ZGd2�ZHd3�ZIe3d4���ZJe3d5���ZKe3d6���ZLeKZM	e3d7���ZNe3d8���ZOe3d9���ZPe3d:���ZQe3d;���ZRe3d<���ZSe3d=���ZTe3d>���ZUed?���ZV	dvd@�ZWe3dA���ZXdwdB�ZYe3dC���ZZe3dD���Z[e3dE���Z\e3dF���Z]e3dG���Z^e3dH���Z_dI�Z`e3dJ���Zae3dK���ZbdL�ZcdM�ZddN�ZedO�ZfdP�ZgdQ�Zhe3dR���ZidS�ZjdT�ZkedU���ZldwdV�ZmdxdW�ZndwdX�ZodY�ZpeqjrfdZ�Zsd[�Zte3d\���Zue3d]���Zve3d^���Zwe3d_���Zxe3d`���Zyeqjrfda�Zzdb�Z{dc�Z|dd�Z}eqjrfde�Z~df�Zdg�Z�dh�Z�ej�didj��dk���Z�e3dl���Z�dwdm�Z�e3dn���Z�e3do���Z�dp�Z�ej"dq���Z�dS)y�MapperaDefine the correlation of class attributes to database table
    columns.

    The :class:`_orm.Mapper` object is instantiated using the
    :func:`~sqlalchemy.orm.mapper` function.    For information
    about instantiating new :class:`_orm.Mapper` objects, see
    that function's documentation.


    When :func:`.mapper` is used
    explicitly to link a user defined class with table
    metadata, this is referred to as *classical mapping*.
    Modern SQLAlchemy usage tends to favor the
    :mod:`sqlalchemy.ext.declarative` extension for class
    configuration, which
    makes usage of :func:`.mapper` behind the scenes.

    Given a particular class known to be mapped by the ORM,
    the :class:`_orm.Mapper` which maintains it can be acquired
    using the :func:`_sa.inspect` function::

        from sqlalchemy import inspect

        mapper = inspect(MyClass)

    A class which was mapped by the :mod:`sqlalchemy.ext.declarative`
    extension will also have its mapper available via the ``__mapper__``
    attribute.


    F)z0.7z�:class:`.MapperExtension` is deprecated in favor of the :class:`.MapperEvents` listener interface.  The :paramref:`.mapper.extension` parameter will be removed in a future release.)z1.1z�The :paramref:`.mapper.order_by` parameter is deprecated, and will be removed in a future release. Use :meth:`_query.Query.order_by` to determine the ordering of a result set.)�1.3aThe :paramref:`.mapper.non_primary` parameter is deprecated, and will be removed in a future release.  The functionality of non primary mappers is now better suited using the :class:`.AliasedClass` construct, which can also be used as the target of a :func:`_orm.relationship` in 1.3.)�	extension�order_by�non_primaryNT�dc�T�tj|td��|_d|_tj|��|_||_|
durtj|
��|_n|
|_||_	t|t��r||_d|_
n||_
|
durd|_n|
�	d�|_n|
|_||_d|_||_||_||_||_|pi|_g|_||_||_||_t5j|��|_g|_tj��|_||_ ||_!||_"d|_#d|_$d|_%i|_&||_'d|_(tj|	pg��|_)||_*|jr|jsd|_+n||_+t|jt4j,��rt[j.d���|�/|��||_0||_1|�i|_2n||_2|�tj3|��|_4nd|_4|rtj3|��|_5nd|_5d|_6tn�8��	|j9j:�;||��|�<��|�=��|�>��|�?��|�@��|�A��|�B��dt�_D|�Ed��|�F��tn�G��dS#tn�G��wxYw)a�NReturn a new :class:`_orm.Mapper` object.

        This function is typically used behind the scenes
        via the Declarative extension.   When using Declarative,
        many of the usual :func:`.mapper` arguments are handled
        by the Declarative extension itself, including ``class_``,
        ``local_table``, ``properties``, and  ``inherits``.
        Other options are passed to :func:`.mapper` using
        the ``__mapper_args__`` class variable::

           class MyClass(Base):
               __tablename__ = 'my_table'
               id = Column(Integer, primary_key=True)
               type = Column(String(50))
               alt = Column("some_alt", Integer)

               __mapper_args__ = {
                   'polymorphic_on' : type
               }


        Explicit use of :func:`.mapper`
        is often referred to as *classical mapping*.  The above
        declarative example is equivalent in classical form to::

            my_table = Table("my_table", metadata,
                Column('id', Integer, primary_key=True),
                Column('type', String(50)),
                Column("some_alt", Integer)
            )

            class MyClass(object):
                pass

            mapper(MyClass, my_table,
                polymorphic_on=my_table.c.type,
                properties={
                    'alt':my_table.c.some_alt
                })

        .. seealso::

            :ref:`classical_mapping` - discussion of direct usage of
            :func:`.mapper`

        :param class\_: The class to be mapped.  When using Declarative,
          this argument is automatically passed as the declared class
          itself.

        :param local_table: The :class:`_schema.Table` or other selectable
           to which the class is mapped.  May be ``None`` if
           this mapper inherits from another mapper using single-table
           inheritance.   When using Declarative, this argument is
           automatically passed by the extension, based on what
           is configured via the ``__table__`` argument or via the
           :class:`_schema.Table`
           produced as a result of the ``__tablename__``
           and :class:`_schema.Column` arguments present.

        :param always_refresh: If True, all query operations for this mapped
           class will overwrite all data within object instances that already
           exist within the session, erasing any in-memory changes with
           whatever information was loaded from the database. Usage of this
           flag is highly discouraged; as an alternative, see the method
           :meth:`_query.Query.populate_existing`.

        :param allow_partial_pks: Defaults to True.  Indicates that a
           composite primary key with some NULL values should be considered as
           possibly existing within the database. This affects whether a
           mapper will assign an incoming row to an existing identity, as well
           as if :meth:`.Session.merge` will check the database first for a
           particular primary key value. A "partial primary key" can occur if
           one has mapped to an OUTER JOIN, for example.

        :param batch: Defaults to ``True``, indicating that save operations
           of multiple entities can be batched together for efficiency.
           Setting to False indicates
           that an instance will be fully saved before saving the next
           instance.  This is used in the extremely rare case that a
           :class:`.MapperEvents` listener requires being called
           in between individual row persistence operations.

        :param column_prefix: A string which will be prepended
           to the mapped attribute name when :class:`_schema.Column`
           objects are automatically assigned as attributes to the
           mapped class.  Does not affect explicitly specified
           column-based properties.

           See the section :ref:`column_prefix` for an example.

        :param concrete: If True, indicates this mapper should use concrete
           table inheritance with its parent mapper.

           See the section :ref:`concrete_inheritance` for an example.

        :param confirm_deleted_rows: defaults to True; when a DELETE occurs
          of one more rows based on specific primary keys, a warning is
          emitted when the number of rows matched does not equal the number
          of rows expected.  This parameter may be set to False to handle the
          case where database ON DELETE CASCADE rules may be deleting some of
          those rows automatically.  The warning may be changed to an
          exception in a future release.

          .. versionadded:: 0.9.4 - added
             :paramref:`.mapper.confirm_deleted_rows` as well as conditional
             matched row checking on delete.

        :param eager_defaults: if True, the ORM will immediately fetch the
          value of server-generated default values after an INSERT or UPDATE,
          rather than leaving them as expired to be fetched on next access.
          This can be used for event schemes where the server-generated values
          are needed immediately before the flush completes.   By default,
          this scheme will emit an individual ``SELECT`` statement per row
          inserted or updated, which note can add significant performance
          overhead.  However, if the
          target database supports :term:`RETURNING`, the default values will
          be returned inline with the INSERT or UPDATE statement, which can
          greatly enhance performance for an application that needs frequent
          access to just-generated server defaults.

          .. seealso::

                :ref:`orm_server_defaults`

          .. versionchanged:: 0.9.0 The ``eager_defaults`` option can now
             make use of :term:`RETURNING` for backends which support it.

        :param exclude_properties: A list or set of string column names to
          be excluded from mapping.

          See :ref:`include_exclude_cols` for an example.

        :param extension: A :class:`.MapperExtension` instance or
           list of :class:`.MapperExtension` instances which will be applied
           to all operations by this :class:`_orm.Mapper`.

        :param include_properties: An inclusive list or set of string column
          names to map.

          See :ref:`include_exclude_cols` for an example.

        :param inherits: A mapped class or the corresponding
          :class:`_orm.Mapper`
          of one indicating a superclass to which this :class:`_orm.Mapper`
          should *inherit* from.   The mapped class here must be a subclass
          of the other mapper's class.   When using Declarative, this argument
          is passed automatically as a result of the natural class
          hierarchy of the declared classes.

          .. seealso::

            :ref:`inheritance_toplevel`

        :param inherit_condition: For joined table inheritance, a SQL
           expression which will
           define how the two tables are joined; defaults to a natural join
           between the two tables.

        :param inherit_foreign_keys: When ``inherit_condition`` is used and
           the columns present are missing a :class:`_schema.ForeignKey`
           configuration, this parameter can be used to specify which columns
           are "foreign".  In most cases can be left as ``None``.

        :param legacy_is_orphan: Boolean, defaults to ``False``.
          When ``True``, specifies that "legacy" orphan consideration
          is to be applied to objects mapped by this mapper, which means
          that a pending (that is, not persistent) object is auto-expunged
          from an owning :class:`.Session` only when it is de-associated
          from *all* parents that specify a ``delete-orphan`` cascade towards
          this mapper.  The new default behavior is that the object is
          auto-expunged when it is de-associated with *any* of its parents
          that specify ``delete-orphan`` cascade.  This behavior is more
          consistent with that of a persistent object, and allows behavior to
          be consistent in more scenarios independently of whether or not an
          orphan object has been flushed yet or not.

          See the change note and example at :ref:`legacy_is_orphan_addition`
          for more detail on this change.

        :param non_primary: Specify that this :class:`_orm.Mapper`
          is in addition
          to the "primary" mapper, that is, the one used for persistence.
          The :class:`_orm.Mapper` created here may be used for ad-hoc
          mapping of the class to an alternate selectable, for loading
          only.

          :paramref:`_orm.Mapper.non_primary` is not an often used option, but
          is useful in some specific :func:`_orm.relationship` cases.

          .. seealso::

              :ref:`relationship_non_primary_mapper`

        :param order_by: A single :class:`_schema.Column` or list of
           :class:`_schema.Column`
           objects for which selection operations should use as the default
           ordering for entities.  By default mappers have no pre-defined
           ordering.

        :param passive_deletes: Indicates DELETE behavior of foreign key
           columns when a joined-table inheritance entity is being deleted.
           Defaults to ``False`` for a base mapper; for an inheriting mapper,
           defaults to ``False`` unless the value is set to ``True``
           on the superclass mapper.

           When ``True``, it is assumed that ON DELETE CASCADE is configured
           on the foreign key relationships that link this mapper's table
           to its superclass table, so that when the unit of work attempts
           to delete the entity, it need only emit a DELETE statement for the
           superclass table, and not this table.

           When ``False``, a DELETE statement is emitted for this mapper's
           table individually.  If the primary key attributes local to this
           table are unloaded, then a SELECT must be emitted in order to
           validate these attributes; note that the primary key columns
           of a joined-table subclass are not part of the "primary key" of
           the object as a whole.

           Note that a value of ``True`` is **always** forced onto the
           subclass mappers; that is, it's not possible for a superclass
           to specify passive_deletes without this taking effect for
           all subclass mappers.

           .. versionadded:: 1.1

           .. seealso::

               :ref:`passive_deletes` - description of similar feature as
               used with :func:`_orm.relationship`

               :paramref:`.mapper.passive_updates` - supporting ON UPDATE
               CASCADE for joined-table inheritance mappers

        :param passive_updates: Indicates UPDATE behavior of foreign key
           columns when a primary key column changes on a joined-table
           inheritance mapping.   Defaults to ``True``.

           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 columns
           on joined-table rows.

           When False, it is assumed that the database does not enforce
           referential integrity and will not be issuing its own CASCADE
           operation for an update.  The unit of work process will
           emit an UPDATE statement for the dependent columns during a
           primary key change.

           .. seealso::

               :ref:`passive_updates` - description of a similar feature as
               used with :func:`_orm.relationship`

               :paramref:`.mapper.passive_deletes` - supporting ON DELETE
               CASCADE for joined-table inheritance mappers

        :param polymorphic_load: Specifies "polymorphic loading" behavior
          for a subclass in an inheritance hierarchy (joined and single
          table inheritance only).   Valid values are:

            * "'inline'" - specifies this class should be part of the
              "with_polymorphic" mappers, e.g. its columns will be included
              in a SELECT query against the base.

            * "'selectin'" - specifies that when instances of this class
              are loaded, an additional SELECT will be emitted to retrieve
              the columns specific to this subclass.  The SELECT uses
              IN to fetch multiple subclasses at once.

         .. versionadded:: 1.2

         .. seealso::

            :ref:`with_polymorphic_mapper_config`

            :ref:`polymorphic_selectin`

        :param polymorphic_on: Specifies the column, attribute, or
          SQL expression used to determine the target class for an
          incoming row, when inheriting classes are present.

          This value is commonly a :class:`_schema.Column` object that's
          present in the mapped :class:`_schema.Table`::

            class Employee(Base):
                __tablename__ = 'employee'

                id = Column(Integer, primary_key=True)
                discriminator = Column(String(50))

                __mapper_args__ = {
                    "polymorphic_on":discriminator,
                    "polymorphic_identity":"employee"
                }

          It may also be specified
          as a SQL expression, as in this example where we
          use the :func:`.case` construct to provide a conditional
          approach::

            class Employee(Base):
                __tablename__ = 'employee'

                id = Column(Integer, primary_key=True)
                discriminator = Column(String(50))

                __mapper_args__ = {
                    "polymorphic_on":case([
                        (discriminator == "EN", "engineer"),
                        (discriminator == "MA", "manager"),
                    ], else_="employee"),
                    "polymorphic_identity":"employee"
                }

          It may also refer to any attribute
          configured with :func:`.column_property`, or to the
          string name of one::

                class Employee(Base):
                    __tablename__ = 'employee'

                    id = Column(Integer, primary_key=True)
                    discriminator = Column(String(50))
                    employee_type = column_property(
                        case([
                            (discriminator == "EN", "engineer"),
                            (discriminator == "MA", "manager"),
                        ], else_="employee")
                    )

                    __mapper_args__ = {
                        "polymorphic_on":employee_type,
                        "polymorphic_identity":"employee"
                    }

          When setting ``polymorphic_on`` to reference an
          attribute or expression that's not present in the
          locally mapped :class:`_schema.Table`, yet the value
          of the discriminator should be persisted to the database,
          the value of the
          discriminator is not automatically set on new
          instances; this must be handled by the user,
          either through manual means or via event listeners.
          A typical approach to establishing such a listener
          looks like::

                from sqlalchemy import event
                from sqlalchemy.orm import object_mapper

                @event.listens_for(Employee, "init", propagate=True)
                def set_identity(instance, *arg, **kw):
                    mapper = object_mapper(instance)
                    instance.discriminator = mapper.polymorphic_identity

          Where above, we assign the value of ``polymorphic_identity``
          for the mapped class to the ``discriminator`` attribute,
          thus persisting the value to the ``discriminator`` column
          in the database.

          .. warning::

             Currently, **only one discriminator column may be set**, typically
             on the base-most class in the hierarchy. "Cascading" polymorphic
             columns are not yet supported.

          .. seealso::

            :ref:`inheritance_toplevel`

        :param polymorphic_identity: Specifies the value which
          identifies this particular class as returned by the
          column expression referred to by the ``polymorphic_on``
          setting.  As rows are received, the value corresponding
          to the ``polymorphic_on`` column expression is compared
          to this value, indicating which subclass should
          be used for the newly reconstructed object.

        :param properties: A dictionary mapping the string names of object
           attributes to :class:`.MapperProperty` instances, which define the
           persistence behavior of that attribute.  Note that
           :class:`_schema.Column`
           objects present in
           the mapped :class:`_schema.Table` are automatically placed into
           ``ColumnProperty`` instances upon mapping, unless overridden.
           When using Declarative, this argument is passed automatically,
           based on all those :class:`.MapperProperty` instances declared
           in the declared class body.

        :param primary_key: A list of :class:`_schema.Column`
           objects which define
           the primary key to be used against this mapper's selectable unit.
           This is normally simply the primary key of the ``local_table``, but
           can be overridden here.

        :param version_id_col: A :class:`_schema.Column`
           that will be used to keep a running version id of rows
           in the table.  This is used to detect concurrent updates or
           the presence of stale data in a flush.  The methodology is to
           detect if an UPDATE statement does not match the last known
           version id, a
           :class:`~sqlalchemy.orm.exc.StaleDataError` exception is
           thrown.
           By default, the column must be of :class:`.Integer` type,
           unless ``version_id_generator`` specifies an alternative version
           generator.

           .. seealso::

              :ref:`mapper_version_counter` - discussion of version counting
              and rationale.

        :param version_id_generator: Define how new version ids should
          be generated.  Defaults to ``None``, which indicates that
          a simple integer counting scheme be employed.  To provide a custom
          versioning scheme, provide a callable function of the form::

              def generate_version(version):
                  return next_version

          Alternatively, server-side versioning functions such as triggers,
          or programmatic versioning schemes outside of the version id
          generator may be used, by specifying the value ``False``.
          Please see :ref:`server_side_version_counter` for a discussion
          of important points when using this option.

          .. versionadded:: 0.9.0 ``version_id_generator`` supports
             server-side version number generation.

          .. seealso::

             :ref:`custom_version_counter`

             :ref:`server_side_version_counter`


        :param with_polymorphic: A tuple in the form ``(<classes>,
            <selectable>)`` indicating the default style of "polymorphic"
            loading, that is, which tables are queried at once. <classes> is
            any single or list of mappers and/or classes indicating the
            inherited classes that should be loaded at once. The special value
            ``'*'`` may be used to indicate all descending classes should be
            loaded immediately. The second tuple argument <selectable>
            indicates a selectable that will be used to query for multiple
            classes.

            .. seealso::

              :ref:`with_polymorphic` - discussion of polymorphic querying
              techniques.

        �class_NFc��|pddzS)Nrr�)�xs �L/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/mapper.py�<lambda>z!Mapper.__init__.<locals>.<lambda>s��1�6��Q�,����When mapping against a select() construct, map against an alias() of the construct instead.This because several databases don't allow a SELECT from a subquery that does not have an alias.T�constructed)Hr�assert_arg_type�typer)�
class_manager�to_list�_primary_key_argumentr&r%�always_refresh�
isinstancer�version_id_prop�version_id_col�version_id_generator�concrete�single�inherits�local_table�inherit_condition�inherit_foreign_keys�_init_properties�_delete_orphans�batch�eager_defaults�
column_prefixr�_clause_element_as_expr�polymorphic_on�_dependency_processors�
immutabledict�
validators�passive_updates�passive_deletes�legacy_is_orphan�_clause_adapter�_requires_row_aliasing�_inherits_equated_pairs�_memoized_values�_compiled_cache_size�_reconstructor�_deprecated_extensions�allow_partial_pks�confirm_deleted_rows�
SelectBase�sa_exc�InvalidRequestError�_set_with_polymorphic�polymorphic_load�polymorphic_identity�polymorphic_map�to_set�include_properties�exclude_properties�
configured�_CONFIGURE_MUTEX�acquire�dispatch�_events�_new_mapper_instance�_configure_inheritance�"_configure_legacy_instrument_class� _configure_class_instrumentation�_configure_listeners�_configure_properties�_configure_polymorphic_setter�_configure_pksr"�_new_mappers�_log�_expire_memoizations�release)�selfr)r?r�primary_keyr&r>r@rAr$r%r7r:r;rH�_polymorphic_mapr]r<�with_polymorphicr\rVrDrFr`rarLrMrWrErNrSs                               r-�__init__zMapper.__init__ks���|�*�6�4��B�B���!���%)�\�+�%>�%>��"�&����5� � � �L��2�2�D�M�M�$�D�M�,����n�n�5�5�	1�#1�D� �"&�D���"0�D���5�(�(�(-�D�%�%�
!�
)�(>�(>�D�%�%�(<�D�%� ��
���� ��
�&���!2���$8��!� *� 0�b���!�����
�,���*���(�@��
�
���')��#��,�.�.���.���.��� 0���#���&+��#�'+��$� "���$8��!�"���&*�l�9�?��&C�&C��#�!2����=�	=���	=�(-�D�%�%�(<�D�%��d�&�
�(=�>�>�	��,�F���
�	
�"�"�#3�4�4�4� 0���
%9��!�
�#�#%�D� � �#3�D� ��)�&*�k�2D�&E�&E�D�#�#�&*�D�#��	+�&*�k�2D�&E�&E�D�#�#�&*�D�#����
	� � �"�"�"�
	'��M�!�6�6�v�t�D�D�D��'�'�)�)�)��3�3�5�5�5��1�1�3�3�3��%�%�'�'�'��&�&�(�(�(��.�.�0�0�0����!�!�!�"&�F���I�I�m�$�$�$��%�%�'�'�'��$�$�&�&�&�&�&���$�$�&�&�&�&���s
�C!N�N'c��|S)z<Part of the inspection API.

        Returns self.

        r+�rss r-�mapperz
Mapper.mapper�s	���r/c��|jS)zDPart of the inspection API.

        Returns self.class\_.

        )r)rys r-�entityz
Mapper.entity�s���{�r/r#zUse .persist_selectablec��|jS�N)�persist_selectablerys r-�mapped_tablezMapper.mapped_table�s
���&�&r/c�*�tj|��Sr~)r�
per_mapperrys r-�_path_registryzMapper._path_registry�s���&�t�,�,�,r/c�x	�tj��|_|j�r3t	|jt
��rt
|jd���|_t|j|jj��s4tj
d|jj�d|jjj�d����|j|jjkr4|jrdpd}tj
d|�d	|jj�d
|�d����|j
�*|jj
|_
|jj|_d
|_n�|j
|jj
ur�|jr2|j
|_|���D]}|j�d
|_�n�|j�)t+j|jj
|j
��|_t/j|jj|j
|j��|_tj|j��}t+j|jj|���|_n|j
|_|j�|js|jj|_n|j|_|j �#|jj |_ |jj!|_!nS|jj �G|j |jj ur4tj"d|j j#�d|jj j#�d���|j$dur&|js|jj$dur|jj$|_$|jj%|_%|jj&|_&|jj�'|��|jj(|_(|jj)|_)|jj*p|j*|_*|jj+|_+|j�X|j|j%vr;tj"d|j�d|j%|j�d|�d|j�d�	��||j%|j<|j,r|jrtj
d���|j,dkr|j�-|��nx|j,dkrnl|j,�tj
d|j,z���nHt]��|_+||_(|j
|_|j�||j%|j<|j|_|j�tj
d|z���dS)zXConfigure settings related to inheriting and/or inherited mappers
        being present.F)�	configurezClass 'z' does not inherit from '�'�primaryznon-primaryzInheritance of z mapper for class 'z' is only allowed from a z mapperNT)�consider_as_foreign_keyszInheriting version_id_col 'z+' does not match inherited version_id_col 'z�' and will not automatically populate the inherited versioning column. version_id_col should only be specified on the base-most mapper that includes versioning.z1Reassigning polymorphic association for identity z from z to z: Check for duplicate use of z# as value for polymorphic_identity.zKpolymorphic_load is not currently supported with concrete table inheritance�inline�selectinz)unknown argument for polymorphic_load: %rz9Mapper '%s' does not have a persist_selectable specified.)/r�WeakSequence�_inheriting_mappersr>r8r3r�
issubclassr)rY�
ArgumentError�__name__r&r?rr=r<�iterate_to_rootrHrPr@�sql_util�join_conditionr�joinr_rA�criterion_as_pairs�onclauserQr]�_identity_classr:r;�warn�descriptionr%r^rD�append�base_mapperrLrM�_all_tablesr\�_add_with_polymorphic_subclass�set)rs�nprz�fkss    r-rhzMapper._configure_inheritance�s��
$(�#4�#6�#6�� ��=�~	/��$�-��.�.�
M� ,�T�]�e� L� L� L��
��d�k�4�=�+?�@�@�
��*�*��{�+�+�+�T�]�-A�-J�-J�-J�L������4�=�#<�<�<��)�)�7�i�H�=���*�*��r�r�4�;�/�/�/����5������'�#'�=�#<�� �*.�-�*J��'�"�����!���)B�B�B��=��.2�.>�D�+�"&�"6�"6�"8�"8�A�A��!�0�<�<@�F�9��A��-�5�
2:�1H� �M�5�t�7G�2�2��.�/2�h��
�8��(��.�/�/�D�+��+�d�&?�@�@�C�3;�3N��/�8�14�4�4�4�D�0�0�
+/�*:��'��(�4�T�]�4�'+�}�'D��$�$�'+�{��$��"�*�&*�m�&B��#�,0�M�,N��)�)��
�,�8��'�t�}�/K�K�K��	�	��+�7�7�7��
�4�@�@�@��
�
�
��
��&�&��
�'��M�*�%�7�7� $�
� 6��
�#'�=�#@�D� ���,�D�J��M�-�4�4�T�:�:�:�#�}�8�D��#'�=�#@�D� ��
�-�E��1E�
� � $�}�8�D���(�4��,��0D�D�D��I�I�
!�5�5�5� �0��1J�K�K�K� �D�D� �5�5�5��
�
�
�CG��$�T�%>�?��$�
���
��*�6�����$��0�0��
�<�<�T�B�B�B�B��&�*�4�4���&�2��*�?��+�,����3� #�u�u�D��#�D��&*�&6�D�#��(�4�BF��$�T�%>�?�#'�;�D� ��"�*��&�K�����
�+�*r/c�p�|dkrd|_nzt|ttf��rAt|dtjttfz��r||_n'|df|_n|�t
jd���d|_t|jtj
��rt
jd���|jrVt|jdtj
��r1|jd|jd���f|_|j
r|���dSdS)N�*)r�Nrz$Invalid setting for with_polymorphicr0r)rvr8�tuple�listr�string_typesrYr�r?rrXrZ�aliasrbrq)rsrvs  r-r[zMapper._set_with_polymorphic~sR���s�"�"�$/�D�!�!�
�(�5�$�-�
8�
8�
	)�� ��#�T�%6�%���%F���
A�)9��%�%�)9�4�(@��%�%�
�
)��&�'M�N�N�N�$(�D�!��d�&�
�(=�>�>�	��,�F���
�� �	�Z��!�!�$�j�&;�&
�&
�	��%�a�(��%�a�(�.�.�0�0�%�D�!�
�?�	(��%�%�'�'�'�'�'�	(�	(r/c���|j}|j�|�|f��dS|jddkr3|�|jd|fz|jdf��dSdS)Nrr�r)r)rvr[)rsrz�subcls   r-r�z%Mapper._add_with_polymorphic_subclass�s����
��� �(��&�&��x�0�0�0�0�0�
�
"�1�
%��
,�
,��&�&��&�q�)�U�H�4�d�6K�A�6N�O�
�
�
�
�
�-�
,r/c��|jsJ�|jrJ�t|t��sJ�||_|jj�|j��|jj|_|���D]}|j�d|_�|jj	|_	|j
D]}|jj|_�|jj�
|��|jj|_|jj|_|j���D]>\}}||jvr0|�||dd���s|�||d���?dS)z�Set the given :class:`_orm.Mapper` as the 'inherits' for this
        :class:`_orm.Mapper`, assuming this :class:`_orm.Mapper` is concrete
        and does not already have an inherits.NTF��local�column)r<r>r8r"r^�updater�rHrPrD�self_and_descendantsr�r�r�rLr��_props�items�_should_exclude�_adapt_inherited_property)rsrz�mp�key�props     r-�_set_concrete_basezMapper._set_concrete_base�sl��
�}���}��=� � � ��&�&�)�)�)�)�)���
��
�%�,�,�T�-A�B�B�B�#�}�<����*�*�,�,�	5�	5�F��$�0�04��-���]�(��
��+�	7�	7�B�!�]�6�B�N�N��
�)�0�0��6�6�6�#�}�<����=�4�����,�,�.�.�	A�	A�I�C���$�+�%�%�d�.B�.B��S��d�/C�/�/�%��.�.�s�D�%�@�@�@��		A�	Ar/c�>�||_|�d��dS)NT)rHrm)rsrHs  r-�_set_polymorphic_onzMapper._set_polymorphic_on�s$��,����*�*�4�0�0�0�0�0r/c�0�|jr\|j�|jj��tt	d�|j���D�����}nt��}|jD]}||vr|�||���dS)Nc��g|]	}|j��
Sr+�rU��.0�ms  r-�
<listcomp>z=Mapper._configure_legacy_instrument_class.<locals>.<listcomp>��+�������0���r/)r>re�_updater�rr�rU�_adapt_instrument_class�rs�super_extensions�exts   r-riz)Mapper._configure_legacy_instrument_class�s����=�	%��M�!�!�$�-�"8�9�9�9�"����!%��!>�!>�!@�!@����� � ��� #�u�u���.�	7�	7�C��*�*�*��+�+�D�#�6�6�6��	7�	7r/c���|jr8ttd�|j���D�����}nt��}|jD]}||vr|�||���dS)Nc��g|]	}|j��
Sr+r�r�s  r-r�z/Mapper._configure_listeners.<locals>.<listcomp>�r�r/)r>r�rr�rU�_adapt_listenerr�s   r-rkzMapper._configure_listeners�s����=�
	%�"����!%��!>�!>�!@�!@����� � ��� #�u�u���.�	/�	/�C��*�*�*��#�#�D�#�.�.�.��	/�	/r/c	�.�tj|j��}|jrI|r|jstjd|jz���||_|jj	|_	dt|<dS|�3|j|jusJ�|jrtjd|jz���dt|<|j�
||j��|�tj|j��}||_||_t!jt$j|��|_|j�t.d��rdSt1j|dt4d���t1j|dt6d���t!j|j��D]�\}}|d	kr8t;|d
��r(|j}t?|t@j!��r|j"}t?|t@j#��r�t;|d��r%||_$t1j|dtJd�����t;|d
��rX|j&}|j'D]I}||j(vrtjd|�d|�d����|j(�)|||fi��|_(�J��||jt.<dS)a�If this mapper is to be a primary mapper (i.e. the
        non_primary flag is not set), associate this Mapper with the
        given class and entity name.

        Subsequent calls to ``class_mapper()`` for the ``class_`` / ``entity``
        name combination will return this mapper.  Also decorate the
        `__init__` method on the mapped class to include optional
        auto-session attachment logic.

        ztClass %s has no primary mapper configured.  Configure a primary mapper first before setting up a non primary Mapper.TNz�Class '%s' already has a primary mapper defined. Use non_primary=True to create a non primary Mapper.  clear_mappers() will remove *all* current mappers from all classes.F�
first_init)�raw�initrw�_sa_original_init�__sa_reconstructor__�load�__sa_validators__z+A validation function for mapped attribute z on mapper z already exists.)*r�manager_of_classr)r&�	is_mappedrYrZr4rzr��_mapper_registryr�re�instrument_classr	�register_classr�partialr
�load_scalar_attributes�deferred_scalar_loader�info�getrr�listen�_event_on_first_init�_event_on_init�iterate_attributes�hasattrr�r8�types�
MethodType�im_func�FunctionTyperT�_event_on_load�__sa_validation_opts__r�rK�union)rs�managerr��method�validation_opts�names      r-rjz'Mapper._configure_class_instrumentation�s����-�d�k�:�:����
	��
�'�"3�
��0�� $��,����
")�D��#*�>�#A�D� �%)��T�"��F����>�T�[�0�0�0�0�� �
��*�E��k�	"����"&����	
�
�&�&�t�T�[�9�9�9��?�%�4�T�[�A�A�G�$������)-���*�D�*
�*
��&��<���M�5�1�1�	��F�
��W�l�,@�d�K�K�K�K�
��W�f�n�$�?�?�?�?��2�4�;�?�?�	�	�K�C���j� � �W�V�5H�%I�%I� ��1���f�e�&6�7�7�,�#�^�F��&�%�"4�5�5�
��6�#9�:�:��*0�D�'��L��&�.�d�K�K�K�K�K��V�%8�9�9��&,�&C�O� &� 8�	�	���4�?�2�2�"(�"<�"<�$(�4�4����!/�#�#��
+/�/�*?�*?�!�F�O�#<�=�+�+�����'+���]�#�#�#r/c�"�t��dS)z8Class-level path to the :func:`.configure_mappers` call.N)�configure_mappers)�clss r-�_configure_allzMapper._configure_allEs��	�����r/c���d|_d|_t|d��r|`|js<|j�7|jjr-|jj|ur!tj	|j
��dSdSdSdSdS)NT�_configure_failed)rb�_dispose_calledr�r�r&r4r�rzr	�unregister_classr)rys r-�disposezMapper.disposeJs������#����4�,�-�-�	'��&�� �	:��"�.��"�,�/��"�)�T�1�1��,�T�[�9�9�9�9�9�
	:�	:�.�.�.�.�1�1r/c���tj�j���_i�_i�_t
jtd��j	D�����}t
jd�|D����}t�j�jgz��}�j�|��|D]�}|j
rN|�|j
��r4t
j|j
���|���j|<t
j|j���|���j|<���jr^�jD]U}|j�jvr t
j���j|j<�j|j�|���Vn��j�jvs#t-�j�j��dkr%t/jd��d�jj�d�����j�jvr@t7�jt8j��r!t
jd�jjz���jr �j s�js�jj
�_
n��jr(tj!�fd��jD��d	�
��}n&tj!�j�jd	�
��}t-|��dkr%t/jd��d�jj�d����tE|���_
��#d|��t�fd��j	D�����_$dS)
Nc��g|]	}|j��
Sr+��	proxy_set�r��cols  r-r�z)Mapper._configure_pks.<locals>.<listcomp>as��D�D�D�c�C�M�D�D�Dr/c3�(K�|]
}|j�	|V��dSr~�rt)r��cs  r-�	<genexpr>z(Mapper._configure_pks.<locals>.<genexpr>ds)����!G�!G����!G�!�!G�!G�!G�!G�!G�!Gr/rzMapper z> could not assemble any primary key columns for mapped table 'r�zlCould not assemble any primary keys for locally mapped table '%s' - no rows will be persisted in this Table.c�D��g|]}�j�|����Sr+)r�corresponding_column)r�r�rss  �r-r�z)Mapper._configure_pks.<locals>.<listcomp>�s:��������/�D�D�Q�G�G���r/T)�ignore_nonexistent_tablesz"Identified primary key columns: %sc3��K�|]C}�j|�jvr-t|d��r|j�jv�4�j|V��DdS)�tableN)�_columntoproperty�_identity_key_propsr�r�_cols_by_table�r�r�rss  �r-r�z(Mapper._configure_pks.<locals>.<genexpr>�st�����#
�#
���%�c�*�$�2J�J�J��C��)�)�K��9�D�$7�7�7�
�"�3�'�
8�7�7�7�
#
�#
r/)%r��find_tablesr�tables�
_pks_by_tablerr�
column_setrrr�r�r�rt�
issuperset�ordered_column_set�intersectionr�r6r�
OrderedSet�add�lenrYr�r�r?r8r�Tabler�r>r<�reduce_columnsr�rp�_readonly_props)rs�all_cols�pk_colsr�t�krts`      r-rnzMapper._configure_pksZs�����*�4�+B�C�C������ ����?��D�D�T�-C�D�D�D�E�
�
���/�!G�!G�X�!G�!G�!G�G�G���T�[�D�$;�#<�<�=�=�������'�'�'��		�		�A��}�
(��!3�!3�A�M�!B�!B�
(�)-�(?��M�)�)��,�w�'�'��"�1�%�&*�%<�Q�S�%A�%A�%N�%N��&�&�D���"�"��%�	��/�
3�
3���7�$�"4�4�4�26�/�2C�2C�D�&�q�w�/��"�1�7�+�/�/��2�2�2�2�
3�
�#�4�+=�=�=��4�%�d�&=�>�?�?�1�D�D��&�&��4�4��0�<�<�<�>���
�
�
�T�%7�
7�
7�J���f�l�=
�=
�
7�
�I�;��"�.�/�
�
�
�
�M�!	I��M�!	I��.�!	I� $�}�8�D����)�
�&�5�����!%�!;����/3������'�5��&�t�'>�?�.2�����
�;���1�$�$��*�*��t�t�T�4�@�@�@�B���� %�[�1�1�D���I�I�:�K�H�H�H� #�#
�#
�#
�#
��-�#
�#
�#
� 
� 
����r/c�@�tj��x|_|_tj��|_t
|��|_|jr6|j�	��D]\}}|�
||d���|jr]|jj�	��D]>\}}||jvr0|�||dd���s|�
||d���?|jjD]�}||jvr�|jpd|jz}|�|j||jj�|��|���r�Y|���D]}||jvr|j|j}�|�
||dd�����dS)NFr��T�r��	setparent)r�OrderedProperties�columnsr��OrderedDictr��_ColumnMappingrrBr��_configure_propertyr>r�r�rrFr�r?�contains_columnr�)rsr�r�r��
column_keyrzs      r-rlzMapper._configure_properties�s��� $� 6� 8� 8�8���t�v��&�(�(���
"0��!5�!5���� �	;�!�2�8�8�:�:�
;�
;�	��T��(�(��d�E�:�:�:�:��=�	E�!�]�1�7�7�9�9�
E�
E�	��T��d�k�)�)�$�2F�2F���E�$�3G�3�3�)��2�2�3��e�D�D�D���-�5�	�	�F���/�/�/���,�2��f�j�@�J��#�#��
���&�(�8�8��@�@��	$���
���.�.�0�0�
F�
F���V�5�5�5�!'�!9�&�!A�!E�J���$�$��F��$�
%�
�
�
�
�)	�	r/c�R��d}|j��qd}t|jtj��r`	|j|j|_nG#t
$r:}tjtjd|jz��|���Yd}~nd}~wwxYw|j|j	vr|j	|j}�n�t|jt��r<t|jtj��stjd���|j}�n^tj|j��stjd���|j�|j��}|�jd}d}|j}t|t"j��rD|j�!|jd�|��	�tjd|jz���nd}t-|d	d��}|r?|�|j|jd|��rtjd
|jz���n#|�d��x|_}|j}tj||���}|�|||d�
��|jd|_|j�n�|���D]r}|j�i|j|jur
|j|_n$|j�|j��|_|j�|j|_|j|_nd|_dS�s|r�fd�}	�fd�}
|	|_|
|_dSd|_dS)a�Configure an attribute on the mapper representing the
        'polymorphic_on' column, if applicable, and not
        already generated by _configure_properties (which is typical).

        Also create a setter function which will assign this
        attribute to the value of the 'polymorphic_identity'
        upon instance construction, also if applicable.  This
        routine will run when an instance is created.

        FNTzPCan't determine polymorphic_on value '%s' - no attribute is mapped to this name.��replace_contextzUOnly direct column-mapped property or SQL expression can be passed for polymorphic_onrzkCould not map polymorphic_on column '%s' to the mapped table - polymorphic loads will not function properlyr�z6Cannot exclude or override the discriminator column %r�_sa_polymorphic_on)�_instrumentrrc���|j}|�����|||jjjd��dSr~)�dict�get_implr�r�rzr])�state�dict_�polymorphic_keys  �r-�_set_polymorphic_identityzGMapper._configure_polymorphic_setter.<locals>._set_polymorphic_identity�sL����
������/�/�3�3����M�(�=��	����r/c����|vr;|�|jvr.tjdt|��|�f��dSdSdS)NznFlushing object %s with incompatible polymorphic identity %r; the object may not refresh and/or load correctly)�"_acceptable_polymorphic_identitiesr�warn_limitedr)rzr*r+r,s   �r-�_validate_polymorphic_identityzLMapper._configure_polymorphic_setter.<locals>._validate_polymorphic_identity�sz���#�u�,�,��o�.�!�D�E�E��%�G�#�5�)�)�5��+A�B�	�����	-�,�E�Er/)rHr8rr�r��KeyError�raise_rYr�rrr�ColumnPropertyr�
_is_columnrr�r�ColumnrvrZr��getattrr�r��labelrrr�r-r1)rsr��setter�errr�r��
instrumentr�rzr-r1r,s           @r-rmz$Mapper._configure_polymorphic_setter�s�������*��F��$�-�t�/@�A�A�

�
�*.�+�d�6I�*J�D�'�'�������K��,�3�59�5H�I���
),�
������������������"�d�&<�<�<��-�d�.A�B����D�/��@�@�L
O�"��'��)B����!�.�;����
�*����*�4�+>�?�?�@
O��*�7�����-�B�B��'�����;�#�F�!&�J��-�C�!�#�v�}�5�5�
��-�5��0��3�H�H��M�M�� �%�8�?�"�o�.�����"&�J��c�5�$�/�/���"��+�+�C�G�S�W�e�S�I�I��$�8�6�8;��@�����14�	�	�:N�0O�0O�O�D�'�#��'�C�!�0��*�M�M�M���(�(��d���(�N�N�N�#'�,�q�/�D��"�h�O�O�
�.�.�0�0�
�
���(�4��.�&�2K�K�K�.4�.C��+�+�!�3�.�.�v�/D�E�E��+��*�6�"�<��6�#�A��;�;�:>��6��F�F�'5�*�	2�
�
�
�
�
�
�
�
�
�
�.G�D�*�.�
�/�/�/�.2�D�*�*�*s�A�
B
�0B�B
c�8�|j�|j|jSdSr~)r:rrys r-�_version_id_propzMapper._version_id_prop�s!����*��)�$�*=�>�>��4r/c��t��}t|g��}|rX|���}|j|jur4|�|j��|�|j��|�X|Sr~)r�r�popleftrrr]�extendr�)rs�
identities�stack�items    r-r/z)Mapper._acceptable_polymorphic_identities�sz���U�U�
��t�f�
�
���	7��=�=�?�?�D��&�$�*A�A�A����t�8�9�9�9����T�5�6�6�6�	�	7��r/c�N�t|j�����Sr~)�	frozensetr��valuesrys r-�	_prop_setzMapper._prop_set�s�����+�+�-�-�.�.�.r/c�J�|js|�||dd���dS||jvrs|j�||��}||us(t|tj��r<|j|j	ur0|�|tj��|d���dSdSdSdS)NFrT)r<rr�r4�_get_class_attr_mror8r�InstrumentedAttribute�
_parententity�parentr�ConcreteInheritedProperty)rsr�r�r��implementing_attributes     r-r�z Mapper._adapt_inherited_property�s����}�	��$�$�S�$�U�e�$�L�L�L�L�L�
���
#�
#�&*�%7�%K�%K��T�&�&�"�&��-�-��*�J�,L���.�+�8�D�K�G�G��(�(���8�:�:��"�	)������!$�
#�.�-�H�Gr/c
���|�d||jj��t|t��s|�||��}t|tj���r�|j�	|j
d��}|��|jr�|g}|j���D]�}|j
�	|j
d��}|�E|D]}|j����|j�	|j
d��}n|�|����|�V|j
d}t!|d��r8t!|d��r|j|jvr|j�|��nWt!|d��rG|j|jvr9||j|jvr%|j|j�|��t!|d��s"||jup|j
d|ju|_||j
|<|j
|jzD]}|jD]}||j|<�
�||_|r|�||��||jvrNt;|j|dd��r2|j|j}	t?j d	|	�d
|�d|�d|	�����||jvr�t|tj��s�t|j|tjtj!f��sQtEj#d
|j|�d|�d|�d���|j|}
|j$�%|
d��||j|<|j&s|�'|��|j(D]}|�)|||���|r)|�*��|�+|��|j,r|�-��dSdS)Nz_configure_property(%s, %s)rrrr�_is_polymorphic_discriminator�_mapped_by_synonymFz'Can't call map_column=True for synonym �=z4, a ColumnProperty already exists keyed to the name z for column z	Property z on z" being replaced with new property z$; the old property will be discarded).rp�	__class__r�r8r�_property_from_columnrr4rr�rr>r�r?�_reset_exportedr�r�rrrrrHrP�
_orig_columnsr�rr��
set_parentr�r7rQrYr�rMrr�r��popr&r�r�r�r��post_instrument_classrbrq)rsr�r�r�rr��pathr��m2�syn�oldproprzs            r-rzMapper._configure_property�sd���	�	�/��d�n�6M�N�N�N��$��/�/�	9��-�-�c�4�8�8�D��d�J�5�6�6�6	7��)�>�>�t�|�A��O�O�C�
�{�t�}�{��v����6�6�8�8�	#�	#�A��-�<�<�T�\�!�_�M�M�C���"&�D�D�B��1�A�A�C�C�C�C�"�5�J�J� �L��O�������K�K��N�N�N�N��{��l�1�o���4�!2�3�3�3���W�-�-�3��y��(;�;�;��(�,�,�T�2�2�2���D�"2�3�3�<��	�T�%8�8�8��4�#6�s�y�#A�A�A��'��	�2�6�6�s�;�;�;�
�4�!@�A�A�
��4�.�.�>��|�A��$�*=�=��2�
!$�D�L����|�d�&8�8�
7�
7���=�7�7�C�26�D�*�3�/�/�7�����	(��O�O�D�$�'�'�'��$�+���'��K���2�E�#
�#
���+�c�"�5�C��&�&�'*�c�c�3�3�3����S�S�:���
�
�4�;����t�Z�%>�?�?�
����C� ��-��8����
�
�I�I��;�s�#�#�#�T�T�T�4�4�4�1�
�
�
�
�k�#�&�G���#�#�G�T�2�2�2����C����	(��!�!�$�'�'�'��.�	>�	>�F��,�,�S�$��=�=�=�=��	-��I�I�K�K�K��&�&�t�,�,�,��?�	(��%�%�'�'�'�'�'�	(�	(r/c���tj|��}|d}tj|��st	j|�d|�d����|j�|d��}t|tj
��r�|jr|jd|f|jvr�|jd�
|��sh|jd|jurT||jurK|j|u}d|jd�d|�d|�d	�}|rtj|��nt	j|���|���}|j�d|��|�d
|z��|S|�t|tj��r�g}|D]�}|j�|��}	|	�o|j�|��}	|	�|j���|j�|��}	|	�t	jd|�d|�d
|�d����|�|	����tj
|�St	jd|�d|�d
|j�d|�d�	���)z[generate/update a :class:`.ColumnProprerty` given a
        :class:`_schema.Column` object.rrRz/ is not an instance of MapperProperty or ColumnNzImplicitly combining column ���z
 with column z under attribute 'zT'.  Please configure one or more attributes for these same-named columns explicitly.zAinserting column to existing list in properties.ColumnProperty %szWhen configuring property 'z' on z
, column 'z�' is not represented in the mapper's table. Use the `column_property()` function to force this column to be mapped as a read-only attribute.z$WARNING: when configuring property 'z' conflicts with property 'aG'. To resolve this, map the column to the class under a different name in the 'properties' dictionary.  Or, to remove all awareness of the column entirely (including its availability as a foreign key), use the 'include_properties' or 'exclude_properties' mapper arguments to control specifically which table columns get mapped.)rr5rr5rYr�r�r�r8rr4rQr�shares_lineager:rLr�rZ�copy�insertrprMrr�r?rUr�r�)
rsr�r�rr��	warn_only�msg�
mapped_columnr��mcs
          r-rTzMapper._property_from_columnHs����,�t�$�$�������$�V�,�,�	��&��3�3�������
�
�{���s�D�)�)���d�J�5�6�6�D	��4�
:���Q���0��7�8�8���Q��6�6�v�>�>�8��L��O�4�+>�>�>��$�"5�5�5� �K�t�3�	�	�
&*�\�"�%5�%5�%5�v�v�v�s�s�s�D���:��I�c�N�N�N�N� �4�S�9�9�9��9�9�;�;�D��L����6�*�*�*��I�I�2�58�:�
�
�
��K�
�\�Z��*�6�
�
�\��M��
)�
)���,�A�A�!�D�D���:��)�>�>�q�A�A�B��~�
�/�?�?�A�A�A��0�E�E�a�H�H�B��z�$�2�2�
-0�C�C����q�q�q�	:�����$�$�R�(�(�(�(��,�m�<�<��&�&�*-���d�d�d�F�J�J�J����F�
�
�

r/c�j�|�d��d�|j���D��}|D][\}}|�d|��|j|ur|js|���|jr|�|���\|�d��d|_dS)z�Call the ``init()`` method on all ``MapperProperties``
        attached to this mapper.

        This is a deferred configuration step which is intended
        to execute once all mappers have been constructed.

        z$_post_configure_properties() startedc��g|]	\}}||f��
Sr+r+)r�r�r�s   r-r�z5Mapper._post_configure_properties.<locals>.<listcomp>�s ��>�>�>�Y�S�$�c�4�[�>�>�>r/zinitialize prop %sz%_post_configure_properties() completeTN)	rpr�r�rL�_configure_startedr��_configure_finishedrYrb)rs�lr�r�s    r-�_post_configure_propertiesz!Mapper._post_configure_properties�s���	
�	�	�8�9�9�9�>�>�$�+�*;�*;�*=�*=�>�>�>���	1�	1�I�C���I�I�*�C�0�0�0��{�d�"�"�4�+B�"��	�	�����'�
1��*�*�4�0�0�0���	�	�9�:�:�:�����r/c�f�|���D]\}}|�||���dS)z^Add the given dictionary of properties to this mapper,
        using `add_property`.

        N)r��add_property)rs�dict_of_propertiesr��values    r-�add_propertieszMapper.add_properties�sF��
-�2�2�4�4�	*�	*�J�C�����c�5�)�)�)�)�	*�	*r/c�T�||j|<|�|||j���dS)aAAdd an individual MapperProperty to this mapper.

        If the mapper has not been configured yet, just adds the
        property to the initial properties dictionary sent to the
        constructor.  If this Mapper has already been configured, then
        the given MapperProperty is configured immediately.

        )r�N)rBrrb)rsr�r�s   r-rnzMapper.add_property�s4��&*���c�"�� � ��d��� �A�A�A�A�Ar/c�h�|���D]}t�|���dSr~)r��_memoized_configured_property�expire_instance�rsrzs  r-rqzMapper._expire_memoizations�sB���*�*�,�,�	B�	B�F�)�9�9�&�A�A�A�A�	B�	Br/c��d|jjzdz|jdur|jjpt	|j��z|jrdpdzdzS)N�(�|z|non-primaryr�))r)r�r?r��strr&rys r-�	_log_desczMapper._log_desc�su��
��k�"�
#��
�� ��,�1��$�0�)��t�'�(�(�

���2�N�8�b�
:��	
�	
r/c�D�|jjd|zg|jf|z�R�dS�Nz%s )�loggerr�r|�rsrd�argss   r-rpzMapper._log�s3���������B���(9�D�(@�B�B�B�B�B�Br/c�D�|jjd|zg|jf|z�R�dSr~)r�debugr|r�s   r-�
_log_debugzMapper._log_debug�s3������%�#�+�C�$�.�):�T�)A�C�C�C�C�C�Cr/c�>�dt|��|jjfzS)Nz<Mapper at 0x%x; %s>)�idr)r�rys r-�__repr__zMapper.__repr__�s��%��D���4�;�3G�(H�H�Hr/c�v�d|jj�|jrdpd�d|j�|jjn|jj��S)Nz
mapped class z (non-primary)rz->)r)r�r&r?r�rrys r-�__str__zMapper.__str__�sU����K� � ���1�!1�7�R�7�7���+�
��(�(��(�4�
5�
�	
r/c��d}|���D]Z}|jD]P\}}d}tj|���|||j���}|jr|rdS|js|sdS�Q�[|jr|SdS)NFT)�
optimistic)r�rCrr��
has_parent�has_identityrN)rsr*�orphan_possiblerzr�r�r�s       r-�
_is_orphanzMapper._is_orphan�s������*�*�,�,�	 �	 �F�$�4�

 �

 �
��c�"&��'�8��=�=�H�H��3�5�+=�I���
��(� �Z� � �5�5�5��.� �z� ��4�4�4��

 �� �	�"�"��5r/c��||jvSr~)r�)rsr�s  r-�has_propertyzMapper.has_propertys���d�k�!�!r/c
���|rtjrt��	|j|S#t$r:}tjtjd|�d|�d���|���Yd}~dSd}~wwxYw)z6return a MapperProperty associated with the given key.zMapper 'z' has no property 'r�r#N)	r"ror�r�r2rr3rYrZ)rsr��_configure_mappersr:s    r-�get_propertyzMapper.get_propertys����	 �&�"5�	 �����	��;�s�#�#���	�	�	��K��*�*�:>�$�$����D���!$�	
�
�
�
�
�
�
�
�
�
�����	���s�+�
A/�/A*�*A/c��|j|S)zkGiven a :class:`_schema.Column` object, return the
        :class:`.MapperProperty` which maps this column.�r)rsr�s  r-�get_property_by_columnzMapper.get_property_by_columns���%�f�-�-r/c��tjrt��t|j�����S)z1return an iterator of all MapperProperty objects.)r"ror��iterr�rFrys r-�iterate_propertieszMapper.iterate_propertiess7����	 ������D�K�&�&�(�(�)�)�)r/c����|dkrt|j���n�|r�t���tj|��D]~}t|��}|�|��stj|�d|�����|�(��	|�
�����i��|����fd�|jD���ng�|�1ttj
|d�������fd��D����S)z�given a with_polymorphic() argument, return the set of mappers it
        represents.

        Trims the list of mappers to just those represented within the given
        selectable, if present. This helps some more legacy-ish mappings.

        r�z does not inherit from Nc���g|]}|�v�|��	Sr+r+)r�r��mapperss  �r-r�z-Mapper._mappers_from_spec.<locals>.<listcomp>9s���L�L�L�Q�q�G�|�|�q�|�|�|r/T)�include_aliasesc�&��g|]
}|j�v�|��Sr+)r?)r�r�rs  �r-r�z-Mapper._mappers_from_spec.<locals>.<listcomp>As%���E�E�E�Q�Q�]�f�-D�-D�q�-D�-D�-Dr/)r�r�r�rr5r
�isarYrZr�r�rr�r)rs�spec�
selectabler�r�rs    @@r-�_mappers_from_speczMapper._mappers_from_spec"s3�����3�;�;��4�4�5�5�G�G�
�	��e�e�G��\�$�'�'�

#�

#��$�Q�'�'���u�u�T�{�{�� �4�9:���D�D�A�����%��N�N�1�#4�#4�#6�#6�7�7�7�7��K�K��N�N�N�N�L�L�L�L�$�";�L�L�L�G�G��G��!���$�Z��F�F�F���F�F�E�E�E�'�E�E�E�G��r/c���|j}|D]l}||ur�|jrtjd���|jsC|r!|�|j|j��}�L|�|j|j��}�m|S)z�given a list of mappers (assumed to be within this mapper's
        inheritance hierarchy), construct an outerjoin amongst those mapper's
        mapped tables.

        z^'with_polymorphic()' requires 'selectable' argument when concrete-inheriting mappers are used.)	rr<rYrZr=r�r?r@�	outerjoin)rsr��	innerjoin�from_objr�s     r-�_selectable_from_mapperszMapper._selectable_from_mappersDs����*���	�	�A��D�y�y���z�

��0�A�����X�
���'�}�}��
�q�':� � �H�H� (�1�1��
�q�':� � �H���r/c��|jrL|jrE|j�>|j�d|i���d�|jD����SdS)N�parentmapperc3�$K�|]}|jV��dSr~)r]r�s  r-r�z1Mapper._single_table_criterion.<locals>.<genexpr>bs>����M�M�+,��&�M�M�M�M�M�Mr/)r=r>rH�	_annotate�in_r�rys r-�_single_table_criterionzMapper._single_table_criterion_sv���;�	�4�=�	�T�-@�-L��&�0�0�.�$�1G�H�H�L�L�M�M�04�0I�M�M�M���
��4r/c�f�tjrt��|jsgS|j|j�Sr~)r"ror�rvr�rys r-�_with_polymorphic_mappersz Mapper._with_polymorphic_mappershs<����	 ������$�	��I�&�t�&��(=�>�>r/c��|js|jS|j\}}|�|S|�|�||��d��S�NF)rvrr�r�)rsr�r�s   r-�_with_polymorphic_selectablez#Mapper._with_polymorphic_selectableps\���$�	+��*�*��0���j��!����0�0��'�'��j�9�9�5���
r/c�b�td�|j���D����S)Nc3�RK�|]"\}}|td�|D����fV��#dS)c3�2K�|]}|jj�|V��dSr~)r3�should_evaluate_noner�s  r-r�z@Mapper._insert_cols_evaluating_none.<locals>.<genexpr>.<genexpr>�s@�������c�h�.K��������r/N�rE�r�rrs   r-r�z6Mapper._insert_cols_evaluating_none.<locals>.<genexpr>�sj����
�
���w�����#*������
�
�
�
�
�
�
r/�r(rr�rys r-�_insert_cols_evaluating_nonez#Mapper._insert_cols_evaluating_none�sA���
�
�#'�"5�";�";�"=�"=�
�
�
�
�
�	
r/c�b�td�|j���D����S)Nc3�RK�|]"\}}|td�|D����fV��#dS)c3�fK�|],}|j�	|j�|j�|jj�#|jV��-dSr~)rt�server_default�defaultr3r�r�r�s  r-r�z8Mapper._insert_cols_as_none.<locals>.<genexpr>.<genexpr>�sh��������?�� �.�	�
 �K�� �H�9�
��G������r/Nr�r�s   r-r�z.Mapper._insert_cols_as_none.<locals>.<genexpr>�sj����

�

���w�����&������

�

�

�

�

�

�

r/r�rys r-�_insert_cols_as_nonezMapper._insert_cols_as_none�sA���

�

�#'�"5�";�";�"=�"=�

�

�

�

�

�
	
r/c�h��t�fd��j���D����S)Nc3�X�K�|]$\}}|t�fd�|D����fV��%dS)c3�@�K�|]}�j|j|fV��dSr~�rr�rs  �r-r�z3Mapper._propkey_to_col.<locals>.<genexpr>.<genexpr>�sD�������?B�T�+�C�0�4�c�:������r/N)r()r�rrrss   �r-r�z)Mapper._propkey_to_col.<locals>.<genexpr>�su�����
�
���w�������FM������
�
�
�
�
�
�
r/r�rys`r-�_propkey_to_colzMapper._propkey_to_col�sL����
�
�
�
�#'�"5�";�";�"=�"=�
�
�
�
�
�	
r/c�b�td�|j���D����S)Nc3�RK�|]"\}}|td�|D����fV��#dS)c��g|]	}|j��
Sr+�r�r�s  r-r�z6Mapper._pk_keys_by_table.<locals>.<genexpr>.<listcomp>�s��6�6�6�3�s�w�6�6�6r/Nr�)r�r�pkss   r-r�z+Mapper._pk_keys_by_table.<locals>.<genexpr>�sV����
�
���s��I�6�6�#�6�6�6�7�7�8�
�
�
�
�
�
r/�r(rr�rys r-�_pk_keys_by_tablezMapper._pk_keys_by_table�s?���
�
�"�0�6�6�8�8�
�
�
�
�
�	
r/c�h��t�fd��j���D����S)Nc3�X�K�|]$\}}|t�fd�|D����fV��%dS)c�4��g|]}�j|j��Sr+r�rs  �r-r�z;Mapper._pk_attr_keys_by_table.<locals>.<genexpr>.<listcomp>�s$���J�J�J�s�4�1�#�6�:�J�J�Jr/Nr�)r�rr�rss   �r-r�z0Mapper._pk_attr_keys_by_table.<locals>.<genexpr>�sb�����
�
�
��s���J�J�J�J�c�J�J�J�K�K�
�
�
�
�
�
�
r/r�rys`r-�_pk_attr_keys_by_tablezMapper._pk_attr_keys_by_table�sL����
�
�
�
�
#�0�6�6�8�8�
�
�
�
�
�	
r/c�b�td�|j���D����S)Nc3�RK�|]"\}}|td�|D����fV��#dS)c�*�g|]}|j�	|j��Sr~)r�r�r�s  r-r�z9Mapper._server_default_cols.<locals>.<genexpr>.<listcomp>�s-�������-�9���9�9�9r/Nr�r�s   r-r�z.Mapper._server_default_cols.<locals>.<genexpr>��j����
�
���w�����#*������	
�
�
�
�
�
�
r/r�rys r-�_server_default_colszMapper._server_default_cols��A���
�
�#'�"5�";�";�"=�"=�
�
�
�
�
�	
r/c���t��}|j���D]F\}}|D]>}|j�|j�.||jvr%|�|j|j���?�G|Sr~)r�rr�r��server_onupdaterrr�)rs�resultrrr�s     r-�&_server_default_plus_onupdate_propkeysz-Mapper._server_default_plus_onupdate_propkeys�s�������"�1�7�7�9�9�	@�	@�N�E�7��
@�
@���&�2��*�6��T�3�3�3��J�J�t�5�c�:�>�?�?�?��
@��
r/c�b�td�|j���D����S)Nc3�RK�|]"\}}|td�|D����fV��#dS)c�*�g|]}|j�	|j��Sr~)r�r�r�s  r-r�zBMapper._server_onupdate_default_cols.<locals>.<genexpr>.<listcomp>�s-�������.�:���:�:�:r/Nr�r�s   r-r�z7Mapper._server_onupdate_default_cols.<locals>.<genexpr>�r�r/r�rys r-�_server_onupdate_default_colsz$Mapper._server_onupdate_default_cols�r�r/c��|jS)a;The :func:`_expression.select` construct this :class:`_orm.Mapper`
        selects from
        by default.

        Normally, this is equivalent to :attr:`.persist_selectable`, unless
        the ``with_polymorphic`` feature is in use, in which case the
        full "polymorphic" selectable is returned.

        )r�rys r-r�zMapper.selectable�s
���0�0r/c���|jr!|s
|jd}|dur
|jd}n|durd}|�||��}|�||fS||�||��fS)NrFr)rvr�r�)rsr�r�r�r�s     r-�_with_polymorphic_argszMapper._with_polymorphic_args�s���� �	��
0��,�Q�/���U�"�"�!�2�1�5�
��
�5�
 �
 ��J��)�)�$�
�;�;���!��J�&�&��D�9�9�'�9�M�M�M�Mr/c�P�t|�|j����Sr~)r��_iterate_polymorphic_propertiesr�rys r-�_polymorphic_propertieszMapper._polymorphic_properties	s-����0�0��.�
�
�
�
�	
r/c#�K�|�|j}|s|jD]}|V��dStjt	d�|g|zD�����D]3}t|dd��r|j�|jd|jur�/|V��4dS)zUReturn an iterator of MapperProperty objects which will render into
        a SELECT.Nc�6�g|]}t|j����Sr+)r�r�)r�rzs  r-r�z:Mapper._iterate_polymorphic_properties.<locals>.<listcomp>	s3�����"��V�6�7�7���r/rPFr)r�r�r�unique_listrr7rHr)rsr�r�s   r-r�z&Mapper._iterate_polymorphic_properties	s������?��4�G��	��,�
�
�������
�
��%����'+�f�w�&6�������

�

���1�=�u�E�E���'�/��y��|�4�+>�>�>�������

�

r/c�h�tjrt��tj|j��S)aiA namespace of all :class:`.MapperProperty` objects
        associated this mapper.

        This is an object that provides each property based on
        its key name.  For instance, the mapper for a
        ``User`` class which has ``User.name`` attribute would
        provide ``mapper.attrs.name``, which would be the
        :class:`.ColumnProperty` representing the ``name``
        column.   The namespace object can also be iterated,
        which would yield each :class:`.MapperProperty`.

        :class:`_orm.Mapper` has several pre-filtered views
        of this attribute which limit the types of properties
        returned, including :attr:`.synonyms`, :attr:`.column_attrs`,
        :attr:`.relationships`, and :attr:`.composites`.

        .. warning::

            The :attr:`_orm.Mapper.attrs` accessor namespace is an
            instance of :class:`.OrderedProperties`.  This is
            a dictionary-like object which includes a small number of
            named methods such as :meth:`.OrderedProperties.items`
            and :meth:`.OrderedProperties.values`.  When
            accessing attributes dynamically, favor using the dict-access
            scheme, e.g. ``mapper.attrs[somename]`` over
            ``getattr(mapper.attrs, somename)`` to avoid name collisions.

        .. seealso::

            :attr:`_orm.Mapper.all_orm_descriptors`

        )r"ror�r�ImmutablePropertiesr�rys r-�attrszMapper.attrs,	s/��D��	 ������'���4�4�4r/c�r�tjt|j�������S)ayA namespace of all :class:`.InspectionAttr` attributes associated
        with the mapped class.

        These attributes are in all cases Python :term:`descriptors`
        associated with the mapped class or its superclasses.

        This namespace includes attributes that are mapped to the class
        as well as attributes declared by extension modules.
        It includes any Python descriptor type that inherits from
        :class:`.InspectionAttr`.  This includes
        :class:`.QueryableAttribute`, as well as extension types such as
        :class:`.hybrid_property`, :class:`.hybrid_method` and
        :class:`.AssociationProxy`.

        To distinguish between mapped attributes and extension attributes,
        the attribute :attr:`.InspectionAttr.extension_type` will refer
        to a constant that distinguishes between different extension types.

        The sorting of the attributes is based on the following rules:

        1. Iterate through the class and its superclasses in order from
           subclass to superclass (i.e. iterate through ``cls.__mro__``)

        2. For each class, yield the attributes in the order in which they
           appear in ``__dict__``, with the exception of those in step
           3 below.  In Python 3.6 and above this ordering will be the
           same as that of the class' construction, with the exception
           of attributes that were added after the fact by the application
           or the mapper.

        3. If a certain attribute key is also in the superclass ``__dict__``,
           then it's included in the iteration for that class, and not the
           class in which it first appeared.

        The above process produces an ordering that is deterministic in terms
        of the order in which attributes were assigned to the class.

        .. versionchanged:: 1.3.19 ensured deterministic ordering for
           :meth:`_orm.Mapper.all_orm_descriptors`.

        When dealing with a :class:`.QueryableAttribute`, the
        :attr:`.QueryableAttribute.property` attribute refers to the
        :class:`.MapperProperty` property, which is what you get when
        referring to the collection of mapped properties via
        :attr:`_orm.Mapper.attrs`.

        .. warning::

            The :attr:`_orm.Mapper.all_orm_descriptors`
            accessor namespace is an
            instance of :class:`.OrderedProperties`.  This is
            a dictionary-like object which includes a small number of
            named methods such as :meth:`.OrderedProperties.items`
            and :meth:`.OrderedProperties.values`.  When
            accessing attributes dynamically, favor using the dict-access
            scheme, e.g. ``mapper.all_orm_descriptors[somename]`` over
            ``getattr(mapper.all_orm_descriptors, somename)`` to avoid name
            collisions.

        .. seealso::

            :attr:`_orm.Mapper.attrs`

        )rr�r(r4�_all_sqla_attributesrys r-�all_orm_descriptorszMapper.all_orm_descriptorsR	s4��D�'���#�8�8�:�:�;�;�
�
�	
r/c�@�|�tj��S)aReturn a namespace of all :class:`.SynonymProperty`
        properties maintained by this :class:`_orm.Mapper`.

        .. seealso::

            :attr:`_orm.Mapper.attrs` - namespace of all
            :class:`.MapperProperty`
            objects.

        )�_filter_propertiesr�SynonymPropertyrys r-�synonymszMapper.synonyms�	s���&�&�z�'A�B�B�Br/c�@�|�tj��S)aReturn a namespace of all :class:`.ColumnProperty`
        properties maintained by this :class:`_orm.Mapper`.

        .. seealso::

            :attr:`_orm.Mapper.attrs` - namespace of all
            :class:`.MapperProperty`
            objects.

        )r�rr4rys r-�column_attrszMapper.column_attrs�	s���&�&�z�'@�A�A�Ar/c�@�|�tj��S)aLA namespace of all :class:`.RelationshipProperty` properties
        maintained by this :class:`_orm.Mapper`.

        .. warning::

            the :attr:`_orm.Mapper.relationships` accessor namespace is an
            instance of :class:`.OrderedProperties`.  This is
            a dictionary-like object which includes a small number of
            named methods such as :meth:`.OrderedProperties.items`
            and :meth:`.OrderedProperties.values`.  When
            accessing attributes dynamically, favor using the dict-access
            scheme, e.g. ``mapper.relationships[somename]`` over
            ``getattr(mapper.relationships, somename)`` to avoid name
            collisions.

        .. seealso::

            :attr:`_orm.Mapper.attrs` - namespace of all
            :class:`.MapperProperty`
            objects.

        )r�r�RelationshipPropertyrys r-�
relationshipszMapper.relationships�	s��0�&�&�z�'F�G�G�Gr/c�@�|�tj��S)aReturn a namespace of all :class:`.CompositeProperty`
        properties maintained by this :class:`_orm.Mapper`.

        .. seealso::

            :attr:`_orm.Mapper.attrs` - namespace of all
            :class:`.MapperProperty`
            objects.

        )r�r�CompositePropertyrys r-�
compositeszMapper.composites�	s���&�&�z�'C�D�D�Dr/c����tjrt��tjtj�fd�|j���D������S)Nc3�F�K�|]\}}t|����||fV��dSr~)r8)r�r�v�type_s   �r-r�z,Mapper._filter_properties.<locals>.<genexpr>�	sN��������1�a�*�Q��:N�:N���A�������r/)r"ror�rr�rr�r�)rsr�s `r-r�zMapper._filter_properties�	ss�����	 ������'�������#'�;�#4�#4�#6�#6����
�
�
�
�	
r/c�|�d�|jD��}tjd�|D���tj|��fS)z�create a "get clause" based on the primary key.  this is used
        by query.get() and many-to-one lazyloads to load this item
        by primary key.

        c�H�g|]}|tjd|j���f�� S)N�r�)r�	bindparamr3)r�rts  r-r�z&Mapper._get_clause.<locals>.<listcomp>�	s?��
�
�
���#�-��K�4D�E�E�E�F�
�
�
r/c� �g|]\}}||k��Sr+r+)r�rr�s   r-r�z&Mapper._get_clause.<locals>.<listcomp>�	s ��3�3�3�&�1�a�q�A�v�3�3�3r/)rtr�and_r�column_dict)rs�paramss  r-�_get_clausezMapper._get_clause�	sV��
�
�#�/�
�
�
��

�H�3�3�F�3�3�3�4���V�$�$�
�	
r/c���tj����fd�}|jjD]&}|j�tj|jid|i���'�S)a�Create a map of all equivalent columns, based on
        the determination of column pairs that are equated to
        one another based on inherit condition.  This is designed
        to work with the queries that util.polymorphic_union
        comes up with, which often don't include the columns from
        the base table directly (including the subclass table columns
        only).

        The resulting structure is a dictionary of columns mapped
        to lists of equivalent columns, e.g.::

            {
                tablea.col1:
                    {tableb.col1, tablec.col1},
                tablea.col2:
                    {tabled.col2}
            }

        c�|��|jtjkr�|j�vr&�|j�|j��n"t
j|jf���|j<|j�vr'�|j�|j��dSt
j|jf���|j<dSdSr~)�operatorr�eq�leftr�rightrr	)�binaryr�s �r-�visit_binaryz0Mapper._equivalent_columns.<locals>.visit_binary
s������)�,�.�.��;�&�(�(��6�;�'�+�+�F�L�9�9�9�9�*.�/�6�<�/�*J�*J�F�6�;�'��<�6�)�)��6�<�(�,�,�V�[�9�9�9�9�9�+/�?�F�K�>�+J�+J�F�6�<�(�(�(�/�.r/Nr)rrr�r�r@r�traverse)rsrrzr�s   @r-�_equivalent_columnszMapper._equivalent_columns�	s}���*�!�#�#��		K�		K�		K�		K�		K��&�;�	�	�F��'�3��!��,�b�8�\�2J������
r/c�b�t|ttjtjf��rdSdS)NFT)r8rr	�ClassManagerr�
ColumnElement)rs�objs  r-�_is_userland_descriptorzMapper._is_userland_descriptor
s7���� ��,��(�
�
�
�
	��5��4r/c���|rI|jj�|d��	�'|�|jj|��rdSn4|j�|d��}|�|�|��rdS|j�.||jvr%|�	||jvr|�d|z��dS|j�.||jvs|�#||jvr|�d|z��dSdS)z�determine whether a particular property should be implicitly
        present on the class.

        This occurs when properties are propagated from an inherited class, or
        are applied from the columns present in the mapped table.

        NTznot including property %szexcluding property %sF)	r)�__dict__r�rr4rIr`rpra)rsr��
assigned_namer�r��attrs      r-r�zMapper._should_exclude,
s(���
	��{�#�'�'��t�����"�:�:���$�]�3����
�t���%�9�9�-��N�N�D���D�$@�$@��$F�$F���t�
�#�/��D�3�3�3���6��1H�#H�#H��I�I�1�T�:�;�;�;��4��"�.��D�+�+�+��"�v��1H�'H�'H��I�I�-��6�7�7�7��4��ur/c��|j|juS)zXReturn true if the given mapper shares a
        common inherited parent as this mapper.)r�)rs�others  r-�
common_parentzMapper.common_parentT
s����5�#4�4�4r/c��|���}|j�|r"t|���|��St|��|uSr~)�primary_mapperrHrr�)rsr*�allow_subtypes�ss    r-�_canloadzMapper._canloadZ
sP�����!�!����*�n�*� ��'�'�+�+�A�.�.�.� ��'�'�1�,�,r/c�J�|}|r||ur
|j}|r||u�
t|��S)z>Return True if the this mapper inherits from the given mapper.)r>�bool)rsrr�s   r-r�z
Mapper.isaa
s=��
���	�A�U�N�N��
�A��	�A�U�N�N��A�w�w�r/c#�0K�|}|r|V�|j}|�
dSdSr~)r>)rsr�s  r-r�zMapper.iterate_to_rooti
sA�������	��G�G�G��
�A��	�	�	�	�	r/c���g}t|g��}|rE|���}|�|��|�|j��|�Etj|��S)z�The collection including this mapper and all descendant mappers.

        This includes not just the immediately inheriting mappers but
        all their inheriting mappers as well.

        )rr?r�r@r�rr�)rs�descendantsrBrCs    r-r�zMapper.self_and_descendantso
sq�����t�f�
�
���	3��=�=�?�?�D����t�$�$�$��L�L��1�2�2�2��	3�� ��-�-�-r/c�*�t|j��S)aCIterate through the collection including this mapper and
        all descendant mappers.

        This includes not just the immediately inheriting mappers but
        all their inheriting mappers as well.

        To iterate through an entire hierarchy, use
        ``mapper.base_mapper.polymorphic_iterator()``.

        )r�r�rys r-�polymorphic_iteratorzMapper.polymorphic_iterator
s���D�-�.�.�.r/c��|jjS)zSReturn the primary mapper corresponding to this mapper's class key
        (class).)r4rzrys r-rzMapper.primary_mapper�
s���!�(�(r/c�$�|jjjSr~)r4rzr�rys r-�primary_base_mapperzMapper.primary_base_mapper�
s���!�(�4�4r/c�p��|j}�r�fd�|D��}|D]}|�|��sdS�dS)Nc�*��g|]}�j|��Sr+�r�r�r��adapters  �r-r�z3Mapper._result_has_identity_key.<locals>.<listcomp>�
� ���;�;�;�a�w��q�)�;�;�;r/FT)rt�_has_key)rsr�r1rr�s  `  r-�_result_has_identity_keyzMapper._result_has_identity_key�
sb����"���	<�;�;�;�;�7�;�;�;�G��	�	�C��?�?�3�'�'�
��u�u�
��4r/c�z���|j}�r�fd�|D��}|jt�fd�|D����|fS)a�Return an identity-map key for use in storing/retrieving an
        item from the identity map.

        :param row: A :class:`.RowProxy` instance.  The columns which are
         mapped by this :class:`_orm.Mapper` should be locatable in the row,
         preferably via the :class:`_schema.Column`
         object directly (as is the case
         when a :func:`_expression.select` construct is executed),
         or via string names of
         the form ``<tablename>_<colname>``.

        c�*��g|]}�j|��Sr+r/r0s  �r-r�z0Mapper.identity_key_from_row.<locals>.<listcomp>�
r2r/c3�(�K�|]}�|V��
dSr~r+)r�r��rows  �r-r�z/Mapper.identity_key_from_row.<locals>.<genexpr>�
s'�����4�4�&�#�f�+�4�4�4�4�4�4r/)rtr�r�)rsr8�identity_tokenr1rs ` ` r-�identity_key_from_rowzMapper.identity_key_from_row�
sd�����"���	<�;�;�;�;�7�;�;�;�G�
� ��4�4�4�4�G�4�4�4�4�4��
�	
r/c�0�|jt|��|fS)z�Return an identity-map key for use in storing/retrieving an
        item from an identity map.

        :param primary_key: A list of values indicating the identifier.

        )r�r�)rsrtr9s   r-�identity_key_from_primary_keyz$Mapper.identity_key_from_primary_key�
s���#�U�;�%7�%7��G�Gr/c�j�tj|��}|�|tj��S)a�Return the identity key for the given instance, based on
        its primary key attributes.

        If the instance's state is expired, calling this method
        will result in a database check to see if the object has been deleted.
        If the row no longer exists,
        :class:`~sqlalchemy.orm.exc.ObjectDeletedError` is raised.

        This value is typically also found on the instance state under the
        attribute name `key`.

        �r�instance_state�_identity_key_from_state�PASSIVE_OFF)rs�instancer*s   r-�identity_key_from_instancez!Mapper.identity_key_from_instance�
s-���)�(�3�3���,�,�U�J�4J�K�K�Kr/c�������j��j�|jt����fd�|jD�����jfS)Nc�^��g|])}�|jj��������*Sr+)r��implr�)r�r�r+r��passiver*s  ����r-r�z3Mapper._identity_key_from_state.<locals>.<listcomp>�
sE��������D�H�%�*�.�.�u�e�W�E�E���r/)r(r�r�r�rr9)rsr*rGr+r�s ``@@r-r@zMapper._identity_key_from_state�
ss�������
���-��� ��������� $� 8����
�
�
� �	
�		
r/c�z�tj|��}|�|tj��}|dS)aGReturn the list of primary key values for the given
        instance.

        If the instance's state is expired, calling this method
        will result in a database check to see if the object has been deleted.
        If the row no longer exists,
        :class:`~sqlalchemy.orm.exc.ObjectDeletedError` is raised.

        rr>)rsrBr*�identity_keys    r-�primary_key_from_instancez Mapper.primary_key_from_instance�
s=���)�(�3�3���4�4��:�)�
�
���A��r/c���d�|jD���t����dg��r�fd�}nd�}|S)Nc�&�g|]}|jj��Sr+)r3�sort_key_functionr�s  r-r�z1Mapper._persistent_sortkey_fn.<locals>.<listcomp>�
s��J�J�J�#�3�8�-�J�J�Jr/c�h��td�t�|jd��D����S)Nc3�:K�|]\}}|�||��n|V��dSr~r+)r��key_fn�vals   r-r�z=Mapper._persistent_sortkey_fn.<locals>.key.<locals>.<genexpr>�
sK������#���$*�#5�F�F�3�K�K�K�3������r/r)r��zipr�)r*�key_fnss �r-r�z*Mapper._persistent_sortkey_fn.<locals>.key�
sA������'*�7�E�I�a�L�'A�'A������r/c��|jdS)Nrr�)r*s r-r�z*Mapper._persistent_sortkey_fn.<locals>.key�
s���y��|�#r/)rtr��
difference)rsr�rSs  @r-�_persistent_sortkey_fnzMapper._persistent_sortkey_fn�
sk���J�J��9I�J�J�J���w�<�<�"�"�D�6�*�*�	$�
�
�
�
�
�
�
$�
$�
$��
r/c�*���fd��jD��S)Nc�*��g|]}�j|��Sr+r�rs  �r-r�z.Mapper._identity_key_props.<locals>.<listcomp>s!���H�H�H���&�s�+�H�H�Hr/r�rys`r-rzMapper._identity_key_propss ���H�H�H�H�t�7G�H�H�H�Hr/c�v�t��}|jD]"}|�|j|���#|Sr~)r�rr�r)rs�
collectionrs   r-�
_all_pk_propszMapper._all_pk_propssA���U�U�
��[�	9�	9�E����d�0��7�8�8�8�8��r/c�p�t|j��}|j�|�|j��|Sr~)r�rtrHr)rs�colss  r-�_should_undefer_in_wildcardz"Mapper._should_undefer_in_wildcards5���4�#�$�$����*��H�H�T�(�)�)�)��r/c�$�d�|jD��S)Nc��h|]	}|j��
Sr+r�)r�r�s  r-�	<setcomp>z/Mapper._primary_key_propkeys.<locals>.<setcomp>s��8�8�8�T���8�8�8r/)r[rys r-�_primary_key_propkeyszMapper._primary_key_propkeyss��8�8�T�%7�8�8�8�8r/c�v�|j|}|j|jj�|||���S�N�rG)rr�r�rFr��rsr*r+r�rGr�s      r-�_get_state_attr_by_columnz Mapper._get_state_attr_by_columns8���%�f�-���}�T�X�&�+�/�/��u�g�/�N�N�Nr/c�x�|j|}|j|jj�|||��dSr~)rr�r�rF�set_committed_value�rsr*r+r�rpr�s      r-�#_set_committed_state_attr_by_columnz*Mapper._set_committed_state_attr_by_columns9���%�f�-��
�
�d�h��$�8�8���u�M�M�M�M�Mr/c�z�|j|}|j|jj�|||d��dSr~)rr�r�rFr�rjs      r-�_set_state_attr_by_columnz Mapper._set_state_attr_by_column#s;���%�f�-��
�
�d�h��$�(�(���u�d�C�C�C�C�Cr/c��tj|��}tj|��}|�|||tj���Srd)rr?�
instance_dict�#_get_committed_state_attr_by_columnrA)rsrr�r*r+s     r-�_get_committed_attr_by_columnz$Mapper._get_committed_attr_by_column'sK���)�#�.�.���(��-�-���7�7��5�&�*�*@�8�
�
�	
r/c�v�|j|}|j|jj�|||���Srd)rr�r�rF�get_committed_valuerfs      r-rpz*Mapper._get_committed_state_attr_by_column.sB���%�f�-���}�T�X�&�+�?�?��5�'�@�
�
�	
r/c	����
���j�
tt�
fd�|D�������jj�vrdS���fd�}g}	d}tt
��������D]i}|j�vrd}n"t|jtj
��sdS|r7|js0|�tj|jid|i�����jn#t $rYdSwxYwt#j|�}g}|D]"}	|��
|	j���#t#j||d���S)alassemble a WHERE clause which retrieves a given state by primary
        key, using a minimized set of tables.

        Applies to a joined-table inheritance mapper where the
        requested attribute names are only present on joined tables,
        not the base table.  The WHERE clause attempts to include
        only those tables to minimize joins.

        c�\��g|](}�|jD]}tj|d������)S)T)�
check_columns)rr�r)r�r�r��propss   �r-r�z3Mapper._optimized_get_statement.<locals>.<listcomp>EsW�������"�3�Z�/�����(��$�?�?�?����r/Nc���|j}|j}|�|�dS|j�vrl����j|t
j���}|tjvrt���tjd||jj���|_dS|j�vrl����j|t
j���}|tjvrt���tjd||jj���|_dSdS)Nrer)
rr
rrpr(r�PASSIVE_NO_INITIALIZE�orm_util�	_none_set�_OptGetColumnsNotAvailablerrr3)r�leftcol�rightcol�leftval�rightvalrsr*rs     ���r-rz5Mapper._optimized_get_statement.<locals>.visit_binaryPs$����k�G��|�H���(�"2����}�F�*�*��B�B���J��&�<�	C�����h�0�0�0�4�6�6�6�!�m��'���):����������v�-�-��C�C���J��&�<�	D�����x�1�1�1�4�6�6�6�"�}��(�&�,�*;� � � �����.�-r/FTr)�
use_labels)r�r�rr�r?�reversedr�r�r8r�TableClauser=r�r�cloned_traverser@r|rrr@r�select)rsr*�attribute_namesr�allconds�startrz�condr]r�rwrs``        @@r-�_optimized_get_statementzMapper._optimized_get_statement7s����������������.����
�
�
����'�6�1�1��4�	�	�	�	�	�	�	�>��	��E�"�4��(<�(<�(>�(>�#?�#?�@�@�
�
���%��/�/� �E�E�#��&�
�(>��� � �4�4�������O�O� �0�"�4��%�|�4�������
��*�	�	�	��4�4�	�����x��"����"�	,�	,�C��K�K��c�
�*�+�+�+�+��z�$���6�6�6�6s�AC#�(:C#�#
C1�0C1c#�K�|�|��r6|}|���D]!}|V�||ur||jvrdS|}||urdS� dSdSr~)r�r�r�)rsrz�prevr�s    r-�_iterate_to_target_viawpolyz"Mapper._iterate_to_target_viawpoly�s������8�8�F���
	��D��)�)�+�+�
�
�������D�=�=�T��1L�%L�%L��E�E�����;�;��E�E��
	�
	�
�
r/c�V�|s*|}|�|��D]}|jdkr|cS�n|t|��}d�|D��}|�|g��D]J}|j}|�|��D]+}|jdks||vr|�||��ccS�,�KdS)Nr�c��i|]
}|j|��Sr+�rz)r��es  r-�
<dictcomp>z0Mapper._should_selectin_load.<locals>.<dictcomp>�s��&L�&L�&L�q�q�x��&L�&L�&Lr/)r�r\r�r�rzr�)rs�enabled_via_opt�polymorphic_fromrzr��enabled_via_opt_mappersr|s       r-�_should_selectin_loadzMapper._should_selectin_load�s���	A�%�F��5�5�f�=�=�
�
���%��3�3��H�H�H�4�
�
"�/�2�2�O�&L�&L�O�&L�&L�&L�#�)�/�/�1A�0B�C�C�
A�
A������9�9�&�A�A�A�A�A��*�j�8�8�� 7�7�7�6�:�:�1�a�@�@�@�@�@�@�@�8�A��tr/zsqlalchemy.ext.bakedzsqlalchemy.orm.strategy_optionsc�����
��jsJ��j�j}t|g�jz��}|����}|����}�jD]\}|j�us||vr/|�|j	ft|j�����>|�|j	fddi���]t�j
��dkrtj�j
��
n
�j
d�
�jr@�j�usJ�|��j�fd��f��}	|	���n |��j�fd��f��}	|	�
�fd�z
}	|	||fS)zmAssemble a BakedQuery that can load the columns local to
        this subclass as a SELECT with IN.

        �
do_nothingTrrc���|������j�����Sr~)�query�select_entity_fromr��_adapt_all_clauses)�sessionr|s �r-r.z.Mapper._subclass_load_via_in.<locals>.<lambda>�s3����
�
�f� 5� 5�#�#�F�$5�6�6�#�#�%�%�r/c�.��|����Sr~)r�)r�rss �r-r.z.Mapper._subclass_load_via_in.<locals>.<lambda>�s����
�
�d� 3� 3�r/c	���|���tjdd�������j�j�S)N�primary_keysT)�	expanding)�filterr�rrr%rt)�q�in_exprrss ��r-r.z.Mapper._subclass_load_via_in.<locals>.<lambda>�sE����q�x�x��K�K��
�n��E�E�E�F�F�
�
�
�D�$�&�r/)r>rrHr�r�Loadr�rL�set_generic_strategyr�r(�strategy_keyrrtr�tuple_�is_aliased_classrz�
BakedQuery�_compiled_cache�spoil)rs�baked�strategy_optionsr|�polymorphic_prop�
keep_props�disable_opt�
enable_optr�r�r�s`  `      @r-�_subclass_load_via_inzMapper._subclass_load_via_in�s�������}���}��1�$�2E�F���*�+�d�.F�F�G�G�
�&�+�+�F�3�3��%�*�*�6�2�2�
��J�
	�
	�D��{�d�"�"�d�j�&8�&8��/�/��X�K��d�&7�!8�!8������0�0��X�K�,��!5������t�� � �1�$�$��j�$�"2�3�G�G��&�q�)�G��"�	��=�D�(�(�(�(�� � ��$�&�&�&�&�����A�
�G�G�I�I�I�I�� � ��$�3�3�3�3�����A�	
�&�&�&�&�&�	&���*�k�)�)r/c�,�|�|��Sr~)r�rys r-�_subclass_load_via_in_mapperz#Mapper._subclass_load_via_in_mapper�s���)�)�$�/�/�/r/c	#�K�t��}t��t��}}|j�|��sJ�t	t	|jj�����|||jfg��}|r�|d\}}	}
}|s|����&|	|ur`|�	��}||j
vr�Ht	|�||
|||����}
|
r|�|
|ddf��nb|	|ur^|�	��\}}}}||||fV�|�t	|j�����|||f��|��dSdS)a.Iterate each element and its mapper in an object graph,
        for all relationships that meet the given cascade rule.

        :param type\_:
          The name of the cascade rule (i.e. ``"save-update"``, ``"delete"``,
          etc.).

          .. note::  the ``"all"`` cascade is not accepted here.  For a generic
             object traversal function, see :ref:`faq_walk_objects`.

        :param state:
          The lead InstanceState.  child items will be processed per
          the relationships defined for this object's mapper.

        :return: the method yields individual object instances.

        .. seealso::

            :ref:`unitofwork_cascades`

            :ref:`faq_walk_objects` - illustrates a generic function to
            traverse all objects without relying on cascades.

        r_N)
r��objectrzr�rr�rFr(rXr?�cascade�cascade_iteratorr�)rsr�r*�halt_on�visited_states�prp�mpp�
visitables�iterator�	item_type�parent_state�parent_dictr��queuerB�instance_mapper�corresponding_state�corresponding_dicts                  r-r�zMapper.cascade_iterator�s�����2�����8�8�V�X�X�S���|����%�%�%�%�%���E�L�'�.�.�0�0�1�1�3��u�z�
J�K�
�
�
��)	�=G��^�:�H�i��{��
���� � � ���C����'�'�)�)�����,�,����)�)��$�#�&��������@��%�%�u�c�4��&>�?�?�?���c�!�!��$�$�&�&���#�'�&��#�'�&�	�����!�!��o�4�;�;�=�=�>�>��+�*�	����E�)	�)	�)	�)	�)	r/c�4�tj|j��Sr~)r�LRUCacherSrys r-r�zMapper._compiled_cache;s���}�T�6�7�7�7r/c���	�i�	|jjD]"}|jD]}�	�||����#g}�	���D]4\�}|j}|r&|��fd�|jD�����5�	fd�}tj�	||���}tj
��}|D]
}�	|||<�|S)Nc���g|]}|�f��Sr+r+)r��super_tablers  �r-r�z)Mapper._sorted_tables.<locals>.<listcomp>Ls���K�K�K�k�k�5�)�K�K�Kr/c�����|jj��}��|jj��}|��|�||ur{|j�ttt
j|j����}|j�>|�t
j|j����}|j|vo|j|vS|j|vSdSr�)	r�rLrr�r@r�r��
_find_columnsr�)�fkrL�depr]�table_to_mappers    �r-�skipz#Mapper._sorted_tables.<locals>.skipOs����%�(�(����9�9�F�!�%�%�b�i�o�6�6�C��"��O��v�%�%��)�5��8�1�#�2G�H�H�I�I���+�7��:�:� �.�v�/G�H�H���D��9�D�0�J�R�Y�d�5J�J��9�D�0�0��5r/)�skip_fn�extra_dependencies)r�r�r�
setdefaultr�r>r@r��sort_tablesrr)
rsrzrr��super_r��sorted_�retrr�s
        @@r-�_sorted_tableszMapper._sorted_tables?s$�������&�;�	6�	6�F��]�
6�
6���*�*�1�f�5�5�5�5�
6� ��,�2�2�4�4�	�	�M�E�6��_�F��
�"�)�)�K�K�K�K�V�]�K�K�K�����	�	�	�	�	�0�&���1�
�
�
���� � ���	(�	(�A�$�Q�'�C��F�F��
r/c�Z�||jvr
|j|S|��x|j|<}|Sr~)rR)rsr��	callable_rps    r-�_memozMapper._memors;���$�'�'�'��(��-�-�1:����<�D�!�#�&���Lr/c	�v�tjt��}|jD]�}t	|j��}|���D]l}|jrc|�tj	tj
d�|jD������r"||�||jf���m��|S)zgmemoized map of tables to collections of columns to be
        synchronized upwards to the base mapper.c�"�g|]\}}|j��
Sr+r�)r�rk�rs   r-r�z,Mapper._table_to_equated.<locals>.<listcomp>�s��K�K�K���A���K�K�Kr/)r�defaultdictr�r�r�r�r�rQr�reducer�r�)rsr�rr]r�s     r-�_table_to_equatedzMapper._table_to_equatedys���
�!�$�'�'���(�		I�		I�E��u�w�<�<�D��)�)�+�+�
I�
I���,�I��1B�1B��K��	�K�K��1J�K�K�K���2�2�I��5�M�(�(�!�Q�-F�)G�H�H�H��
I��
r/)NNNFNNNNFFNNNNNFNNTTNNNTFTFFr')F)TT)T)NFFr~)NN)�r��
__module__�__qualname__�__doc__ror�r�deprecated_paramsrw�	is_mapper�represents_outer_join�propertyrzr|r?rr>rbr<rrtr)r4r=r&rHr^r]r�rrKr��
deprecatedr��memoized_propertyr�rhr[r�r�r�rirkrj�classmethodr�r�rnrlrmr1rtr=r/rGr�rrTrlrqrnrqr|rpr�r�r�r�r�r�r�r�r�r�r�r�r��with_polymorphic_mappersr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�rr"r�r�r�r)rr,r4r:r<rCr�PASSIVE_RETURN_NEVER_SETr@rJrVrr[r^rbrgrkrmrqrpr�r�r��dependenciesr�r�r�r�r�r�r�r+r/r-r"r"Es�
��������@�L��O��T��
�
�
�!���8������!�����!���!�����������!��� �?T	'�T	'�T	'�3��2T	'�r�I�%�!��
����X������X���K��,���8�H���J�	��H���F���K��.�F���M���F���K���N���O�
� ��
��K�
��G�� �J��	
�A�4�
��T�_�U�5�6�6�'�'�7�6��X�'�
��-�-���-�K�K�K�Z (� (� (�D���A�A�A�61�1�1�7�7�7�&/�/�/�"W+�W+�W+�r����[��:�:�:� c
�c
�c
�J1�1�1�fq2�q2�q2�q2�f&*�"�"���#�"��#�
�
�#�"�
�#�/�/�#�"�/����4m(�m(�m(�m(�^T�T�T�l���.*�*�*�
B�
B�
B�B�B�B��
�
��X�
�C�C�C�D�D�D�I�I�I�
�
�
����("�"�"����� .�.�.��*�*��X�*� � � �D���6#���#�"��#�?�?�#�"�?�#�
�
�#�"�
� 9���
#�	
�	
�#�"�	
�#�
�
�#�"�
� #�	
�	
�#�"�	
�#�
�
�#�"�
�#�
�
�#�"�
�#�

�

�#�"�

�#���#�"��#�

�

�#�"�

��
1�
1��X�
1�6;�N�N�N�N� #�
�
�#�"�
�����8#�#5�#5�#�"�#5�J#�C
�C
�#�"�C
�J#�C�C�#�"�C�#�B�B�#�"�B�#�H�H�#�"�H�2#�E�E�#�"�E�
�
�
�#�

�

�#�"�

�#�'�'�#�"�'�R���&�&�&�P5�5�5�-�-�-�������#�
.�
.�#�"�
.�/�/�/�)�)�)��5�5��X�5�����
�
�
�
�.H�H�H�H�L�L�L�"(�@�
�
�
�
� ��� #���#�"��$#�I�I�#�"�I�#���#�"��#���#�"��#�9�9�#�"�9�-7�,O�O�O�O�O�N�N�N�D�D�D�
�
�
�-7�,O�
�
�
�
�S7�S7�S7�j������,�T��� A���6*�6*���6*�p#�0�0�#�"�0�K�K�K�K�Z#�8�8�#�"�8�#�0�0�#�"�0�d���
��������r/r"c��eZdZdS)r|N)r�r�r�r+r/r-r|r|�s�������Dr/r|c��tjsdSt���	tr	t���dSda	tjs	dat���dSd}tj�t�����tt��D�]
}d}|jjD] }|||j��}|turd}n�!|tur�<t|dd��r-tjd|�d|j����}|j|_|�|js�	|���|���|j�||j����#t,$r2t/j��d}t3|d��s||_�wxYw��|sdt_dan#dawxYw	t���n#t���wxYwtj�t�����dS)aInitialize the inter-mapper relationships of all mappers that
    have been constructed thus far.

    This function can be called any number of times, but in
    most cases is invoked automatically, the first time mappings are used,
    as well as whenever mappings are used and additional not-yet-configured
    mappers have been constructed.

    Points at which this occur include when a mapped class is instantiated
    into an instance, as well as when the :meth:`.Session.query` method
    is used.

    The :func:`.configure_mappers` function provides several event hooks
    that can be used to augment its functionality.  These methods include:

    * :meth:`.MapperEvents.before_configured` - called once before
      :func:`.configure_mappers` does any work; this can be used to establish
      additional options, properties, or related mappings before the operation
      proceeds.

    * :meth:`.MapperEvents.mapper_configured` - called as each individual
      :class:`_orm.Mapper` is configured within the process; will include all
      mapper state except for backrefs set up by other mappers that are still
      to be configured.

    * :meth:`.MapperEvents.after_configured` - called once after
      :func:`.configure_mappers` is complete; at this stage, all
      :class:`_orm.Mapper` objects that are known  to SQLAlchemy will be fully
      configured.  Note that the calling application may still have other
      mappings that haven't been produced yet, such as if they are in modules
      as yet unimported.

    NTFr�zsOne or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'z'. Original exception was: r)r"rorcrd�_already_compilingrrre�
_for_class�before_configuredr�r��before_mapper_configuredr)rr7rYrZr�rbrlrq�mapper_configured�	Exception�sys�exc_infor��after_configured)�has_skiprz�
run_configure�fnr�rs      r-r�r��s���F�����������:#��	��n	� � �"�"�"�"�"�m"��3	'��&�
��^"'��� � �"�"�"�"�"�_�H��O�&�&�v�.�.�@�@�B�B�B��/�0�0� 
� 
�� $�
� �/�B���B�$&�B�v�v�}�$=�$=�M�$��0�0�#'����1�!�H�,�,���6�#6��>�>�	��2�2�
"�6�6�6�#;�#;�	=���A�+1�*B�A�'��G��(��
��9�9�;�;�;��3�3�5�5�5���9�9�"�F�M������%����!�l�n�n�Q�/��&�s�,?�@�@�;�7:�F�4��	������
,�&+��#�!&������&�&�&�&��� � �"�"�"�"��� � �"�"�"�"����
�O���v�&�&�7�7�9�9�9�9�9sO�H�H�G"�H�9C
G"�AF�G"�<G�G"�H�"G&�&H�Hc��d|_|S)a-Decorate a method as the 'reconstructor' hook.

    Designates a method as the "reconstructor", an ``__init__``-like
    method that will be called by the ORM after the instance has been
    loaded from the database or otherwise reconstituted.

    The reconstructor will be invoked with no arguments.  Scalar
    (non-collection) database-mapped attributes of the instance will
    be available for use within the function.  Eagerly-loaded
    collections are generally not yet available and will usually only
    contain the first element.  ORM state changes made to objects at
    this stage will not be recorded for the next flush() operation, so
    the activity within a reconstructor should be conservative.

    .. seealso::

        :ref:`mapping_constructors`

        :meth:`.InstanceEvents.load`

    T)r�)r�s r-�
reconstructorr��s��,#�B��
�Ir/c�r����|�dd���|�dd������fd�}|S)a�Decorate a method as a 'validator' for one or more named properties.

    Designates a method as a validator, a method which receives the
    name of the attribute as well as a value to be assigned, or in the
    case of a collection, the value to be added to the collection.
    The function can then raise validation exceptions to halt the
    process from continuing (where Python's built-in ``ValueError``
    and ``AssertionError`` exceptions are reasonable choices), or can
    modify or replace the value before proceeding. The function should
    otherwise return the given value.

    Note that a validator for a collection **cannot** issue a load of that
    collection within the validation routine - this usage raises
    an assertion to avoid recursion overflows.  This is a reentrant
    condition which is not supported.

    :param \*names: list of attribute names to be validated.
    :param include_removes: if True, "remove" events will be
     sent as well - the validation function must accept an additional
     argument "is_remove" which will be a boolean.

    :param include_backrefs: defaults to ``True``; if ``False``, the
     validation function will not emit if the originator is an attribute
     event related via a backref.  This can be used for bi-directional
     :func:`.validates` usage where only one validator should emit per
     attribute operation.

     .. versionadded:: 0.9.0

    .. seealso::

      :ref:`simple_validators` - usage examples for :func:`.validates`

    �include_removesF�include_backrefsTc�*���|_��d�|_|S)N)rr)r�r�)r�rr�namess ���r-�wrapzvalidates.<locals>.wrap7
s'���$���.� 0�%
�%
��!��	r/)rX)r�kwrrrs`  @@r-�	validatesr
s[�����F�f�f�.��6�6�O��v�v�0�$�7�7����������Kr/c��|jjt}|jr)|�|�����dSdSr~)r�r�rrTr)r*�ctx�instrumenting_mappers   r-r�r�B
sI�� �=�-�m�<���*�9��+�+�E�I�I�K�K�8�8�8�8�8�9�9r/c��|j�t��}|rtjrt��dSdSdS)z�Initial mapper compilation trigger.

    instrumentation calls this one when InstanceState
    is first generated, and is needed for legacy mutable
    attributes to work.
    N)r�r�rr"ror�)r�r�r
s   r-r�r�H
sS��#�<�+�+�M�:�:��� ���	 ������� � �	 �	 r/c���|jj�t��}|r8tjrt
��|jr|�|��dSdSdS)z�Run init_instance hooks.

    This also includes mapper compilation, normally not needed
    here but helps with some piecemeal configuration
    scenarios (such as in the ORM tutorial).

    N)r�r�r�rr"ror�r-)r*r��kwargsr
s    r-r�r�V
s{��!�=�-�1�1�-�@�@���B���	 ������9�	B� �:�:�5�A�A�A�A�A�	B�B�	B�	Br/c�"�eZdZdZdZd�Zd�ZdS)rz4Error reporting helper for mapper._columntoproperty.r�c��||_dSr~r�rvs  r-rwz_ColumnMapping.__init__l
s
������r/c
���|jj�|��}|r4tjd|jj�d|j�d|j�d|�����tjd|�d|j�d����)NzColumn '�.z1' is not available, due to conflicting property 'z':z
No column z is configured on mapper z...)rzr�r��orm_exc�UnmappedColumnErrorrr�r�)rsr�r�s   r-�__missing__z_ColumnMapping.__missing__o
s����{�!�%�%�f�-�-���	��-�-��<�$�$�$�f�k�k�k�6�:�:�:�t�t�E���
�
�)�)��v�v�t�{�{�{�
$�
�
�	
r/N)r�r�r�r��	__slots__rwrr+r/r-rrg
s=������>�>��I����
�
�
�
�
r/r)Ar��
__future__r�collectionsr�	itertoolsrr�r��weakrefrrrrr	r
rrrz�baser
rrrr�
interfacesrrrr�
path_registryrrrYrrrrrrr�r�WeakKeyDictionaryr�r��!group_expirable_memoized_propertyrt�symbolr �	threading�RLockrc�_self_inspects�class_loggerr"r�r|r�r�rr�r�r�r(rr+r/r-�<module>r$s�����'�&�&�&�&�&�������������
�
�
�
���������������������������������������������"�"�"�"�"�"�������������������������(�(�(�(�(�(� � � � � � �&�&�&�&�&�&�&�&�&�&�&�&�'�'�'�'�'�'�������������������������������������������������������"�"�"�"�"�"�������-�7�,�.�.���� F�� F� H� H���t�{�>�*�*���>�'�'�)�)������D1�D1�D1�D1�D1�^�D1�D1�����D1�Nb	�	�	�	�	��	�	�	�b:�b:�b:�J���4.�.�.�b9�9�9� � � �B�B�B�"
�
�
�
�
�T�
�
�
�
�
r/

Hacked By AnonymousFox1.0, Coded By AnonymousFox