
    -h                        S r SSKrSSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
K	J
r
  SSKJr  S r\R                  " S5      r  " S S\R                   5      r " S S\5      r " S S\5      r " S S\5      r " S S\\5      r " S S\5      r " S S\5      r " S S\5      r\R                  " S5      r " S S \5      r " S! S"\5      rg)#zContain the ``AssociationProxy`` class.

The ``AssociationProxy`` is a Python property object which provides
transparent proxied access to the endpoint of an association object.

See the example ``examples/association/proxied_association.py``.

    N   )exc)inspect)orm)util)collections)
interfaces)or_)ColumnOperatorsc                     [        X40 UD6$ )a%  Return a Python property implementing a view of a target
attribute which references an attribute on members of the
target.

The returned value is an instance of :class:`.AssociationProxy`.

Implements a Python property representing a relationship as a collection
of simpler values, or a scalar value.  The proxied property will mimic
the collection type of the target (list, dict or set), or, in the case of
a one to one relationship, a simple scalar value.

:param target_collection: Name of the attribute we'll proxy to.
  This attribute is typically mapped by
  :func:`~sqlalchemy.orm.relationship` to link to a target collection, but
  can also be a many-to-one or non-scalar relationship.

:param attr: Attribute on the associated instance or instances we'll
  proxy for.

  For example, given a target collection of [obj1, obj2], a list created
  by this proxy property would look like [getattr(obj1, *attr*),
  getattr(obj2, *attr*)]

  If the relationship is one-to-one or otherwise uselist=False, then
  simply: getattr(obj, *attr*)

:param creator: optional.

  When new items are added to this proxied collection, new instances of
  the class collected by the target collection will be created.  For list
  and set collections, the target class constructor will be called with
  the 'value' for the new instance.  For dict types, two arguments are
  passed: key and value.

  If you want to construct instances differently, supply a *creator*
  function that takes arguments as above and returns instances.

  For scalar relationships, creator() will be called if the target is None.
  If the target is present, set operations are proxied to setattr() on the
  associated object.

  If you have an associated object with multiple attributes, you may set
  up multiple association proxies mapping to different attributes.  See
  the unit tests for examples, and for examples of how creator() functions
  can be used to construct the scalar relationship on-demand in this
  situation.

:param \*\*kw: Passes along any other keyword arguments to
  :class:`.AssociationProxy`.

)AssociationProxy)target_collectionattrkws      tC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\sqlalchemy/ext/associationproxy.pyassociation_proxyr      s    h -:r::    ASSOCIATION_PROXYc                   j    \ rS rSrSrSr\r      SS jrS r	S r
S rSS	 jrS
 rS rS rS rSrg)r   ]   zDA descriptor that presents a read/write view of an object attribute.TNc	                     Xl         X l        X0l        X@l        XPl        X`l        Xl        S[        U 5      R                  < SU< S[        U 5      < 3U l
        U(       a  Xpl        gg)a	  Construct a new :class:`.AssociationProxy`.

The :func:`.association_proxy` function is provided as the usual
entrypoint here, though :class:`.AssociationProxy` can be instantiated
and/or subclassed directly.

:param target_collection: Name of the collection we'll proxy to,
  usually created with :func:`_orm.relationship`.

:param attr: Attribute on the collected instances we'll proxy
  for.  For example, given a target collection of [obj1, obj2], a
  list created by this proxy property would look like
  [getattr(obj1, attr), getattr(obj2, attr)]

:param creator: Optional. When new items are added to this proxied
  collection, new instances of the class collected by the target
  collection will be created.  For list and set collections, the
  target class constructor will be called with the 'value' for the
  new instance.  For dict types, two arguments are passed:
  key and value.

  If you want to construct instances differently, supply a 'creator'
  function that takes arguments as above and returns instances.

:param cascade_scalar_deletes: when True, indicates that setting
 the proxied value to ``None``, or deleting it via ``del``, should
 also remove the source object.  Only applies to scalar attributes.
 Normally, removing the proxied target will not remove the proxy
 source, as this object may have other state that is still to be
 kept.

 .. versionadded:: 1.3

 .. seealso::

    :ref:`cascade_scalar_deletes` - complete usage example

:param getset_factory: Optional.  Proxied attribute access is
  automatically handled by routines that get and set values based on
  the `attr` argument for this proxy.

  If you would like to customize this behavior, you may supply a
  `getset_factory` callable that produces a tuple of `getter` and
  `setter` functions.  The factory is called with two arguments, the
  abstract type of the underlying collection and this proxy instance.

:param proxy_factory: Optional.  The type of collection to emulate is
  determined by sniffing the target collection.  If your collection
  type can't be determined by duck typing or you'd like to use a
  different collection implementation, you may supply a factory
  function to produce those collections.  Only applicable to
  non-scalar relationships.

:param proxy_bulk_set: Optional, use with proxy_factory.  See
  the _set() method for details.

:param info: optional, will be assigned to
 :attr:`.AssociationProxy.info` if present.

 .. versionadded:: 1.0.9

_N)r   
value_attrcreatorgetset_factoryproxy_factoryproxy_bulk_setcascade_scalar_deletestype__name__idkeyinfo)	selfr   r   r   r   r   r   r#   r   s	            r   __init__AssociationProxy.__init__c   s^    R "3,*,&<# JtH

 I r   c                 b    Uc  U $ U R                  X!5      nU(       a  UR                  U5      $ U $ N)_as_instanceget)r$   objclass_insts       r   __get__AssociationProxy.__get__   s4    >K  -88C= 
 r   c                 X    [        U5      nU R                  X15      R                  X5      $ r(   )r   r)   set)r$   r+   valuesr,   s       r   __set__AssociationProxy.__set__   s'    c  -11#>>r   c                 X    [        U5      nU R                  X!5      R                  U5      $ r(   )r   r)   delete)r$   r+   r,   s      r   
__delete__AssociationProxy.__delete__   s'    c  -44S99r   c                 $    U R                  X5      $ )aI  Return the internal state local to a specific mapped class.

E.g., given a class ``User``::

    class User(Base):
        # ...

        keywords = association_proxy('kws', 'keyword')

If we access this :class:`.AssociationProxy` from
:attr:`_orm.Mapper.all_orm_descriptors`, and we want to view the
target class for this proxy as mapped by ``User``::

    inspect(User).all_orm_descriptors["keywords"].for_class(User).target_class

This returns an instance of :class:`.AssociationProxyInstance` that
is specific to the ``User`` class.   The :class:`.AssociationProxy`
object remains agnostic of its parent class.

:param class\_: the class that we are returning state for.

:param obj: optional, an instance of the class that is required
 if the attribute refers to a polymorphic target, e.g. where we have
 to look at the type of the actual destination object to get the
 complete path.

.. versionadded:: 1.3 - :class:`.AssociationProxy` no longer stores
   any state specific to a particular parent class; the state is now
   stored in per-class :class:`.AssociationProxyInstance` objects.


)r)   )r$   r,   r+   s      r   	for_classAssociationProxy.for_class   s    B   --r   c                 @    UR                   U R                  S-      nUcF  U R                  U5      nUb0  [        R                  XU5      n[        XR                  S-   U5        OS nUb"  UR                  (       d  UR                  U5      $ U$ ! [         a    S n N~f = f)N_inst)	__dict__r"   KeyError_calc_ownerAssociationProxyInstance	for_proxysetattr_is_canonical_non_canonical_get_for_object)r$   r,   r+   r-   owners        r   r)   AssociationProxy._as_instance   s    	??488g#56D
 <$$V,E /99$sK7 2D9D$6$6 55c::K)  	D	s   B BBc                      [        U5      nUR                  R                  R                  $ ! [        R
                   a     g f = fr(   )r   mapperclass_managerr,   r   NoInspectionAvailable)r$   
target_clsinsps      r   r@   AssociationProxy._calc_owner  sE    		4:&D ;;,,333 (( 	
 	s   - AAc                    ^^ U R                   m[        R                  " T5      mU4S jnU[        L a	  U4S jnX#4$ U4S jnX#4$ )Nc                    > U b  T" U 5      $ S $ r(    target_getters    r   getter0AssociationProxy._default_getset.<locals>.getter      &,&876?BdBr   c                     > [        U TU5        g r(   rC   okvr   s      r   setter0AssociationProxy._default_getset.<locals>.setter$      4#r   c                     > [        U TU5        g r(   rY   r[   r]   r   s     r   r^   r_   )  r`   r   r   operator
attrgetterdictr$   collection_classrU   r^   rT   r   s       @@r   _default_getset AssociationProxy._default_getset  sJ    %%d+	C t#$ ~$ ~r   c                 @    SU R                   < SU R                  < S3$ )NzAssociationProxy(z, ))r   r   r$   s    r   __repr__AssociationProxy.__repr__.  s    ""OO
 	
r   )	r   r   r   r#   r"   r   r   r   r   )NNNNNFr(   )r    
__module____qualname____firstlineno____doc__is_attributer   extension_typer%   r.   r3   r7   r:   r)   r@   ri   rn   __static_attributes__rQ   r   r   r   r   ]   sS    NL&N $Wr
?:!.F24&
r   r   c                      \ rS rSrSrS rSr \S 5       r\S 5       r	S r
\S 5       rS	 r\S
 5       r\R                   S 5       r\S 5       r\S 5       r\S 5       r\R                   S 5       r\R                   S 5       r\S 5       rS rS r\S 5       rS rS rS rS rS rS r S S jr!S S jr"S S jr#S r$Sr%g)!rA   i5  a  A per-class object that serves class- and object-specific results.

This is used by :class:`.AssociationProxy` when it is invoked
in terms of a specific class or instance of a class, i.e. when it is
used as a regular Python descriptor.

When referring to the :class:`.AssociationProxy` as a normal Python
descriptor, the :class:`.AssociationProxyInstance` is the object that
actually serves the information.   Under normal circumstances, its presence
is transparent::

    >>> User.keywords.scalar
    False

In the special case that the :class:`.AssociationProxy` object is being
accessed directly, in order to get an explicit handle to the
:class:`.AssociationProxyInstance`, use the
:meth:`.AssociationProxy.for_class` method::

    proxy_state = inspect(User).all_orm_descriptors["keywords"].for_class(User)

    # view if proxy object is scalar or not
    >>> proxy_state.scalar
    False

.. versionadded:: 1.3

c                     Xl         UR                  U l        X l        UR                  U l        S U l        X0l        X@l        g r(   )parentr"   owning_classr   rh   target_classr   )r$   ry   rz   r{   r   s        r   r%   !AssociationProxyInstance.__init__S  s9    ::(!'!9!9 $($r   Nc                 v   UR                   nUR                  n[        R                  " U5      R	                  U5      n[        U[        R                  5      (       d  [        R                  " [        S5      S S9  UR                  R                  n U R                  Xu5      nU R                  XX'U5      $ ! [         a    [        XXu5      s $ [          aa  n	[        R                  " ["        R$                  " SUR&                  < SUR                  < SUR&                  < SU	< 35      U	S9   S n	A	g S n	A	ff = f)NzEassociation proxy to a non-relationship intermediary is not supportedreplace_contextzRAssociation proxy received an unexpected error when trying to retreive attribute ".z" from class "z": )from_)r   r   r   class_mapperget_property
isinstanceRelationshipPropertyr   raise_NotImplementedErrorrI   r,   _cls_unwrap_target_assoc_proxy_construct_for_assocAttributeError!AmbiguousAssociationProxyInstance	Exceptionr   InvalidRequestErrorr    )
clsry   rz   parent_instancer   r   propr{   target_assocerrs
             r   rB   "AssociationProxyInstance.for_proxye  s!   "44&&
-::;LM $ 8 899KK#4 !% {{))	==L6 ++l* 1  	 5l   	KK'' %--))$--	 	s   B6 6D8	D8AD33D8c                     Ub  [        X#XE5      $ [        XE5      n[        US5      (       d  [        X#XE5      $ UR                  nU(       a  [        X#XE5      $ [        X#XE5      $ )N_is_internal_proxy)ObjectAssociationProxyInstancegetattrhasattrr   _impl_uses_objectsColumnAssociationProxyInstance)r   r   ry   rz   r{   r   r   	is_objects           r   r   -AssociationProxyInstance._construct_for_assoc  s~     #1l  |0t1224l  ++	1l  2l r   c                 t    [         R                  " U R                  5      R                  U R                  5      $ r(   )r   r   rz   r   r   rm   s    r   _get_property&AssociationProxyInstance._get_property  s/     1 12??""
 	
r   c                 6    U R                  5       R                  $ r(   )r   
comparatorrm   s    r   _comparator$AssociationProxyInstance._comparator  s    !!#...r   c                     [        S5      e)NzqThe association proxy can't be used as a plain column expression; it only works inside of a comparison expressionr   rm   s    r   __clause_element__+AssociationProxyInstance.__clause_element__  s    !J
 	
r   c                 T    [        X5      n[        U[        [        45      (       a  U$ g r(   )r   r   r   rA   )r   r{   r   r   s       r   r   7AssociationProxyInstance._cls_unwrap_target_assoc_proxy  s(    |0d-/GHIIKr   c                 N    U R                  U R                  U R                  5      $ r(   )r   r{   r   rm   s    r   _unwrap_target_assoc_proxy3AssociationProxyInstance._unwrap_target_assoc_proxy  s$    22t
 	
r   c                 B    [        U R                  U R                  5      $ )zThe 'remote' class attribute referenced by this
:class:`.AssociationProxyInstance`.

.. seealso::

    :attr:`.AssociationProxyInstance.attr`

    :attr:`.AssociationProxyInstance.local_attr`

)r   r{   r   rm   s    r   remote_attr$AssociationProxyInstance.remote_attr  s     t(($//::r   c                 B    [        U R                  U R                  5      $ )zThe 'local' class attribute referenced by this
:class:`.AssociationProxyInstance`.

.. seealso::

    :attr:`.AssociationProxyInstance.attr`

    :attr:`.AssociationProxyInstance.remote_attr`

)r   rz   r   rm   s    r   
local_attr#AssociationProxyInstance.local_attr  s     t(($*@*@AAr   c                 2    U R                   U R                  4$ )aD  Return a tuple of ``(local_attr, remote_attr)``.

This attribute was originally intended to facilitate using the
:meth:`_query.Query.join` method to join across the two relationships
at once, however this makes use of a deprecated calling style.

To use :meth:`_sql.select.join` or :meth:`_orm.Query.join` with
an association proxy, the current method is to make use of the
:attr:`.AssociationProxyInstance.local_attr` and
:attr:`.AssociationProxyInstance.remote_attr` attributes separately::

    stmt = (
        select(Parent).
        join(Parent.proxied.local_attr).
        join(Parent.proxied.remote_attr)
    )

A future release may seek to provide a more succinct join pattern
for association proxy attributes.

.. seealso::

    :attr:`.AssociationProxyInstance.local_attr`

    :attr:`.AssociationProxyInstance.remote_attr`

)r   r   rm   s    r   r   AssociationProxyInstance.attr  s    : !1!122r   c                 r    U R                  5       R                  (       + nU(       a  U R                  5         U$ )zkReturn ``True`` if this :class:`.AssociationProxyInstance`
proxies a scalar relationship on the local side.)r   uselist_initialize_scalar_accessors)r$   scalars     r   r   AssociationProxyInstance.scalar  s/    
 '')111--/r   c                     U R                  5       R                  R                  U R                  5      R                  (       + $ r(   )r   rI   r   r   r   rm   s    r   _value_is_scalar)AssociationProxyInstance._value_is_scalar  s1     ""$VLL1W	
r   c                     [        5       er(   r   rm   s    r   _target_is_object*AssociationProxyInstance._target_is_object  s    !##r   c                     U R                   R                  (       a  U R                   R                  S U 5      u  pOU R                   R                  S 5      u  pXsU l        U l        g r(   )ry   r   ri   _scalar_get_scalar_set)r$   r*   set_s      r   r   5AssociationProxyInstance._initialize_scalar_accessors  sO    ;;%%224>IC33D9IC-0*$*r   c                    ^^ U R                   m[        R                  " T5      mU4S jnU[        L a	  U4S jnX#4$ U4S jnX#4$ )Nc                    > U b  T" U 5      $ S $ r(   rQ   rR   s    r   rU   8AssociationProxyInstance._default_getset.<locals>.getter'  rW   r   c                    > [        U TU5      $ r(   rY   rZ   s      r   r^   8AssociationProxyInstance._default_getset.<locals>.setter,      q$**r   c                    > [        U TU5      $ r(   rY   rb   s     r   r^   r   1  r   r   rc   rg   s       @@r   ri   (AssociationProxyInstance._default_getset#  sJ    %%d+	C t#+ ~+ ~r   c                 .    U R                   R                  $ r(   )ry   r#   rm   s    r   r#   AssociationProxyInstance.info6  s    {{r   c                    Uc  U $ U R                   (       a&  [        XR                  5      nU R                  U5      $  [        XR                  5      u  p4n[        U5      U:X  a   [        U 5      U:X  a  U R                  c   eU$ U R                  [        XR                  5      5      u  U l        n[        XR                  [        U5      [        U 5      U45        U$ ! [         a     Nef = fr(   )r   r   r   r   r"   r!   rh   r   _new_lazy_collectionrC   )r$   r+   rS   
creator_idself_idproxys         r   r*   AssociationProxyInstance.get:  s    ;K;;S"8"89F##F++	! .5S((-C*
U c7j(RX-@00<<< L+/99 &<&<=,(D!5 CBsGRXu#=>L " s   C 
C+*C+c                    U R                   (       a  U R                  R                  (       a  U R                  R                  OU R                  n[	        XR
                  5      nUc!  Uc  g [        XR
                  U" U5      5        g U R                  XB5        Uc3  U R                  R                  (       a  [        XR
                  S 5        g g g U R                  U5      nU R                  c   eXRLa  UR                  X5        g g r(   )r   ry   r   r{   r   r   rC   r   r   r*   rh   _bulk_replace)r$   r+   r2   r   rS   r   s         r   r1   AssociationProxyInstance.setS  s    ;; ;;&& ##&& 
 S"8"89F~>33WV_E  0>dkk&H&HC!7!7> 'I> HHSME((444"##D1 #r   c                     U R                   c  U R                  US 5        U R                  (       a-  [        XR                  5      nUb  [        X R                  5        [        XR                  5        g r(   )rz   r@   r   r   r   delattrr   r$   r+   rS   s      r   r6   AssociationProxyInstance.deletei  sU    $S$';;S"8"89F!0++,r   c                    U R                   R                  (       a  U R                   R                  OU R                  n[        R                  " U" 5       5      nU R                   R
                  (       a)  UU R                   R                  XU R                  U 5      4$ U R                   R                  (       a  U R                   R                  X05      u  pEOU R                   R                  U5      u  pEU[        L a  U[        XXEU 5      4$ U[        L a  U[        XXEU 5      4$ U[        L a  U[        XXEU 5      4$ [        R                   " SU R"                  R$                  < SU R&                  < S35      e)Nz=could not guess which interface to use for collection_class "z" backing "z6"; specify a proxy_factory and proxy_bulk_set manually)ry   r   r{   r   duck_type_collectionr   r   r   ri   list_AssociationListrf   _AssociationDictr1   _AssociationSetr   ArgumentErrorrh   r    r   )r$   lazy_collectionr   rh   rU   r^   s         r   r   AssociationProxyInstance._news  sX   #';;#6#6DKKD<M<M 	  44_5FG;;$$ ))#doot  ;;%%![[778HONFF![[889IJNFt#  #fd  %  #fd  $ #fd  ## ((1143I3IK r   c                 z   U R                   R                  (       a  U R                   R                  X5        g U R                  [        L a  UR	                  U5        g U R                  [
        L a  UR                  U5        g U R                  [        L a  UR                  U5        g [        R                  " S5      e)NzEno proxy_bulk_set supplied for custom collection_class implementation)
ry   r   rh   r   extendrf   updater1   r   r   )r$   r   r2   s      r   _setAssociationProxyInstance._set  s    ;;%%KK&&u5""d*LL ""d*LL ""c)LL ##2 r   c                    U R                   R                  =(       a    U R                   R                  =(       d    U R                  nU R                   R                  (       a)  U R                   R                  U R                  U 5      u  p4O'U R                   R                  U R                  5      u  p4X!l        X1l        XAl        g r(   )ry   r   r{   r   rh   ri   rU   r^   )r$   r   r   rU   r^   s        r   _inflate!AssociationProxyInstance._inflate  s    KK7DKK$7$7L4;L;L 	 ;;%%![[77%%tNFF "[[889N9NONFr   c                    UR                  SS 5      nU R                  nUb/  UR                  " SSU0UD6nU R                  R                  U5      $ U R                  (       a4  [        U R                  U R                  5      nUR                  " U40 UD6nO?U(       a  [        R                  " S5      eU(       a  Ub  [        R                  " S5      eUnU R                  R                  U5      $ )Nis_has	criterionzJCan't apply keyword arguments to column-targeted association proxy; use ==zINon-empty has() not allowed for column-targeted association proxy; use ==rQ   )
popr   _criterion_existsr   r   r   r{   r   r   r   )r$   r   kwargsr   r   innerr   
value_exprs           r   r   *AssociationProxyInstance._criterion_exists  s    Hd+66# 22 #'-E ##55e<<!!4,,doo>D//	DVDJ''0  I1''@ 
 #J11*==r   c                     U R                   cI  U R                  (       a8  U R                  (       a  U R                  (       a  [        R
                  " S5      eU R                  " SUSS.UD6$ )zProduce a proxied 'any' expression using EXISTS.

This expression will be a composed product
using the :meth:`.RelationshipProperty.Comparator.any`
and/or :meth:`.RelationshipProperty.Comparator.has`
operators of the underlying proxied attributes.

z9'any()' not implemented for scalar attributes. Use has().Fr   r   rQ   r   r   r   r   r   r   r   r$   r   r   s      r   anyAssociationProxyInstance.any  se     **2KK++t/D/D))N  %% 

17
 	
r   c                     U R                   cI  U R                  (       a"  U R                  (       a'  U R                  (       d  [        R
                  " S5      eU R                  " SUSS.UD6$ )zProduce a proxied 'has' expression using EXISTS.

This expression will be a composed product
using the :meth:`.RelationshipProperty.Comparator.any`
and/or :meth:`.RelationshipProperty.Comparator.has`
operators of the underlying proxied attributes.

z4'has()' not implemented for collections.  Use any().Tr   rQ   r   r   s      r   hasAssociationProxyInstance.has  se     **2&&t/D/D))I  %% 

06
 	
r   c                 R    U R                   R                  < SU R                  < S3$ )N(rl   )	__class__r    ry   rm   s    r   rn   !AssociationProxyInstance.__repr__  s    >>22DKK@@r   )	r   r   rh   r"   rz   ry   r{   r   r   r(   )&r    rp   rq   rr   rs   r%   r{   classmethodrB   r   r   propertyr   r   r   r   memoized_propertyr   r   r   r   r   r   r   r   ri   r#   r*   r1   r6   r   r   r   r   r   r   rn   rv   rQ   r   r   rA   rA   5  se   :% L / /b  .

 / /
   

 

 ; ; B B 3 3< 
  

 
 $ $7&    22,-.` >:
(
(Ar   rA   c                      ^  \ rS rSrSrSrS rU 4S jrS rS r	SS jr
SS	 jr\R                  S
 5       rS rS rSrU =r$ )r   i  z[an :class:`.AssociationProxyInstance` where we cannot determine
the type of target object.
Fc                     [        SU R                  R                  < SU R                  < SU R                  < SU R
                  < S3	5      e)NzAssociation proxy r   z refers to an attribute 'z'' that is not directly mapped on class ze; therefore this operation cannot proceed since we don't know what type of object is referred towards)r   rz   r    r   r   r{   rm   s    r   
_ambiguous,AmbiguousAssociationProxyInstance._ambiguous  s>     !!**&&!!	
 	
r   c                 4   > Uc  U $ [         [        U ]  U5      $ r(   )superr   r*   )r$   r+   r  s     r   r*   %AmbiguousAssociationProxyInstance.get   s     ;K:DEcJJr   c                 $    U R                  5         g r(   r	  r$   r+   s     r   __eq__(AmbiguousAssociationProxyInstance.__eq__&      r   c                 $    U R                  5         g r(   r  r  s     r   __ne__(AmbiguousAssociationProxyInstance.__ne__)  r  r   c                 $    U R                  5         g r(   r  r   s      r   r   %AmbiguousAssociationProxyInstance.any,  r  r   c                 $    U R                  5         g r(   r  r   s      r   r   %AmbiguousAssociationProxyInstance.has/  r  r   c                     0 $ r(   rQ   rm   s    r   _lookup_cache/AmbiguousAssociationProxyInstance._lookup_cache2  s	    
 	r   c                 <   Ubl  [        XR                  5      nUbT   [        U5      nUR                  nUR                  nXPR
                  ;  a  U R                  XT5         U R
                  U   $ U $ ! [         a     U $ f = f! [        R                   a     U $ f = fr(   )
r   r   r   rI   r,   r  _populate_cacher?   r   rK   )r$   r   
actual_objrM   rI   instance_classs         r   rE   ?AmbiguousAssociationProxyInstance._non_canonical_get_for_object9  s    & 2H2HIJ%":.D "[[F%+]]N%-?-??,,^D#11.AA  $   00  s#   B !A2 2
B ?B BBc                    [         R                  " U R                  5      R                  U R                  5      nUR                  UR                  5      (       a_  Un U R                  X@R                  5      nU R                  UU R                  U R                  UU R                  5      U R                  U'   g g ! [         a     g f = fr(   )r   r   rz   r   r   isarI   r   r   r   ry   r  r   )r$   r!  rI   r   r{   r   s         r   r  1AmbiguousAssociationProxyInstance._populate_cacheP  s     1 12??""
 ::dkk"")L#BB //  6:5N5N KK%% OO6"">2 # " s   B: :
CCrQ   r(   )r    rp   rq   rr   rs   rD   r	  r*   r  r  r   r   r   r  r  rE   r  rv   __classcell__)r  s   @r   r   r     sW     M
K 
 . r   r   c                   2    \ rS rSrSrSrSrS rS rS r	Sr
g)	r   ig  zEan :class:`.AssociationProxyInstance` that has an object as a target.Tc                 ~   U R                   nUbC  U R                  R                  UR                  (       d  UR	                  U5      5      $ X!:H  5      $ U R
                  (       aj  U R                  (       aY  U R                  (       dH  U R                  R                  [        U R                  U R                  5      R	                  U5      5      $ U R
                  (       a8  U R                  (       a'  U R                  (       a  [        R                  " S5      eU R                  R                  " S0 U R                  U0D6$ )a1  Produce a proxied 'contains' expression using EXISTS.

This expression will be a composed product
using the :meth:`.RelationshipProperty.Comparator.any`,
:meth:`.RelationshipProperty.Comparator.has`,
and/or :meth:`.RelationshipProperty.Comparator.contains`
operators of the underlying proxied attributes.
z<contains() doesn't apply to a scalar object endpoint; use ==rQ   )r   r   r   r   containsr   r   r   r   r{   r   r   r   )r$   r+   r   s      r   r)  'ObjectAssociationProxyInstance.containsm  s     66###55#** %%c*  "(  ""))##''))4??;DDSI  ##8M8M))N 
 ##55O#8NOOr   c                     Uc?  [        U R                  R                  " S0 U R                  U0D6U R                  S :H  5      $ U R                  R                  " S0 U R                  U0D6$ NrQ   )r
   r   r   r   r  s     r   r  %ObjectAssociationProxyInstance.__eq__  si     ;  $$>'=>  D( 
 ##''A4??C*@AAr   c                 z    U R                   R                  [        U R                  U R                  5      U:g  5      $ r(   )r   r   r   r{   r   r  s     r   r  %ObjectAssociationProxyInstance.__ne__  s6     ##D%%t73>
 	
r   rQ   N)r    rp   rq   rr   rs   r   rD   r)  r  r  rv   rQ   r   r   r   r   g  s"    OMPB	B
r   r   c                   ,    \ rS rSrSrSrSrS rS rSr	g)	r   i  zNan :class:`.AssociationProxyInstance` that has a database column as a
target.
FTc                     U R                  U R                  R                  [        R                  U5      5      nUc  [        X R                  S :H  5      $ U$ r(   )r   r   operaterd   eqr
   r   )r$   otherexprs      r   r  %ColumnAssociationProxyInstance.__eq__  sN    %%$$X[[%8
 =t--566Kr   c                 `    U R                  U R                  R                  " U/UQ70 UD65      $ r(   )r   r   r2  )r$   opr4  r   s       r   r2  &ColumnAssociationProxyInstance.operate  s3    %%$$R:%:6:
 	
r   rQ   N)
r    rp   rq   rr   rs   r   rD   r  r2  rv   rQ   r   r   r   r     s     M
r   r   c                   ,    \ rS rSrS rS rS rS rSrg)r   i  c                     Xl         X l        g r(   ry   rS   r   s      r   r%   _lazy_collection.__init__  s    r   c                 B    [        U R                  U R                  5      $ r(   )r   ry   rS   rm   s    r   __call___lazy_collection.__call__  s    t{{DKK00r   c                 4    U R                   U R                  S.$ )N)r+   rS   r<  rm   s    r   __getstate___lazy_collection.__getstate__  s    {{dkk::r   c                 ,    US   U l         US   U l        g )Nr+   rS   r<  r$   states     r   __setstate___lazy_collection.__setstate__  s    ElHor   r<  N)	r    rp   rq   rr   r%   r?  rB  rG  rv   rQ   r   r   r   r     s    1;&r   r   c                   N    \ rS rSrS r\" S 5      rS rS r\r	S r
S rS rS	rg
)_AssociationCollectioni  c                 @    Xl         X l        X0l        X@l        XPl        g)az  Constructs an _AssociationCollection.

This will always be a subclass of either _AssociationList,
_AssociationSet, or _AssociationDict.

lazy_collection
  A callable returning a list-based collection of entities (usually an
  object attribute managed by a SQLAlchemy relationship())

creator
  A function that creates new target entities.  Given one parameter:
  value.  This assertion is assumed::

    obj = creator(somevalue)
    assert getter(obj) == somevalue

getter
  A function.  Given an associated object, return the 'value'.

setter
  A function.  Given an associated object and a value, store that
  value on the object.

N)r   r   rU   r^   ry   )r$   r   r   rU   r^   ry   s         r   r%   _AssociationCollection.__init__  s    2  /r   c                 "    U R                  5       $ r(   )r   rm   s    r   <lambda>_AssociationCollection.<lambda>  s     4 4 6r   c                 ,    [        U R                  5      $ r(   lencolrm   s    r   __len___AssociationCollection.__len__      488}r   c                 ,    [        U R                  5      $ r(   )boolrS  rm   s    r   __bool___AssociationCollection.__bool__  s    DHH~r   c                 4    U R                   U R                  S.$ )Nry   r   r\  rm   s    r   rB  #_AssociationCollection.__getstate__  s    ++$:N:NOOr   c                 b    US   U l         US   U l        U R                   R                  U 5        g )Nry   r   )ry   r   r   rE  s     r   rG  #_AssociationCollection.__setstate__  s-    Ho$%67T"r   c                 F    U R                  5         UR                  X5        g r(   )clearr   )r$   assoc_proxyr2   s      r   r   $_AssociationCollection._bulk_replace  s    

&r   )r   rU   r   ry   r^   N)r    rp   rq   rr   r%   r  rS  rT  rY  __nonzero__rB  rG  r   rv   rQ   r   r   rJ  rJ    s5    > 6
7C KP#
'r   rJ  c                      \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS)S jrS rS rS rS rS rS rS rS rS rS rS rS r S r!S  r"\"r#S! r$S" r%S# r&S$ r'S% r(S& r)\*" \+" 5       RY                  5       5       Hb  u  r-r.\/" \.5      (       d  M  \.R                   \-:X  d  M'  \.R                  (       a  M:  \0" \*\-5      (       d  MJ  \1" \*\-5      R                  \.l        Md     C-C.S'r2g()*r   i  z(Generic, converting, list-to-list proxy.c                 $    U R                  U5      $ r(   r   r$   values     r   _create_AssociationList._create      ||E""r   c                 $    U R                  U5      $ r(   rU   r$   object_s     r   _get_AssociationList._get      {{7##r   c                 $    U R                  X5      $ r(   r^   )r$   rp  ri  s      r   r   _AssociationList._set  s    {{7**r   c                     [        U[        5      (       d  U R                  U R                  U   5      $ U R                  U    Vs/ s H  o R                  U5      PM     sn$ s  snf r(   )r   slicerq  rS  )r$   indexmembers      r   __getitem___AssociationList.__getitem__  sM    %''99TXXe_--48HHUODO&IIf%ODDDs   A"c                    [        U[        5      (       d   U R                  U R                  U   U5        g UR                  c  [        U 5      nO5UR                  S:  a  [        U 5      UR                  -   nOUR                  nUR                  =(       d    SnUR                  =(       d    Sn[        [        UR                  =(       d    SX45      5      nUS:X  a-  U H  nX	 M     UnU H  nU R                  Xx5        US-  nM     g [        U5      [        U5      :w  a%  [        S[        U5      < S[        U5      < 35      e[        Xb5       H$  u  pxU R                  U R                  U   U5        M&     g )Nr      z#attempt to assign sequence of size z to extended slice of size )r   rx  r   rS  stoprR  stepstartr   rangeinsert
ValueErrorzip)	r$   ry  ri  r  r  r  rngiitems	            r   __setitem___AssociationList.__setitem__  s'   %''IIdhhuou-zz!4ya4y5::-zz::?DKK$1EuU[[-At:;CqyA !DKK(FA " u:S)$7:5z3s8M   #3GAIIdhhqk40  /r   c                     U R                   U	 g r(   rS  r$   ry  s     r   __delitem___AssociationList.__delitem__2  s    HHUOr   c                 X    U R                    H  nU R                  U5      U:X  d  M    g   gNTFrS  rq  r$   ri  rz  s      r   __contains___AssociationList.__contains__5  )    hhFyy E)  r   c                 f    U R                   X  Vs/ s H  o0R                  U5      PM     sn$ s  snf r(   r  )r$   r  endrz  s       r   __getslice___AssociationList.__getslice__<  s,    040CD0Cf		&!0CDDDs   .c                 h    U Vs/ s H  o@R                  U5      PM     nnXPR                  X& g s  snf r(   rj  rS  )r$   r  r  r2   r]   memberss         r   __setslice___AssociationList.__setslice__?  s-    ,23Fq<<?F3% 4s   /c                      U R                   X2	 g r(   r  )r$   r  r  s      r   __delslice___AssociationList.__delslice__C  s    HHUYr   c              #   X   #    U R                    H  nU R                  U5      v   M     g7f)zIterate over proxied values.

For the actual domain objects, iterate over .col instead or
just use the underlying collection directly from its property
on the parent.
Nr  r$   rz  s     r   __iter___AssociationList.__iter__F  s'      hhF))F##    (*c                 `    U R                   nU R                  U5      nUR                  U5        g r(   )rS  rj  append)r$   ri  rS  r  s       r   r  _AssociationList.appendR  s%    hh||E"

4r   c                    ^ [        [        R                  " U4S j[        U 5      5       Vs/ s H  nSPM     sn5      $ s  snf )Nc                    > U T:H  $ r(   rQ   )r]   ri  s    r   rN  (_AssociationList.count.<locals>.<lambda>\  s	    a5jr   r~  )sumr   itertools_filteriter)r$   ri  r   s    ` r   count_AssociationList.countW  sJ     ..($t*A 
 	
s   A c                 8    U H  nU R                  U5        M     g r(   )r  )r$   r2   r]   s      r   r   _AssociationList.extenda  s    AKKN r   c                 @    U R                  U5      /U R                  X& g r(   r  )r$   ry  ri  s      r   r  _AssociationList.inserte  s    !%e!4 5r   c                 V    U R                  U R                  R                  U5      5      $ r(   )rU   rS  r   r  s     r   r   _AssociationList.poph  s    {{488<<.//r   c                 h    [        U 5       H  u  p#X1:X  d  M  U R                  U	   g    [        S5      e)Nzvalue not in list)	enumeraterS  r  )r$   ri  r  vals       r   remove_AssociationList.removek  s3    oFA|HHQK & ,--r   c                     [         e)z#Not supported, use reversed(mylist)r   rm   s    r   reverse_AssociationList.reverser  
     "!r   c                     [         e)z!Not supported, use sorted(mylist)r   rm   s    r   sort_AssociationList.sortw  r  r   c                 H    U R                   S[        U R                   5      2	 g )Nr   )rS  rR  rm   s    r   ra  _AssociationList.clear|  s    HHQTXX&'r   c                     [        U 5      U:H  $ r(   r   r$   r4  s     r   r  _AssociationList.__eq__      DzU""r   c                     [        U 5      U:g  $ r(   r  r  s     r   r  _AssociationList.__ne__  r  r   c                     [        U 5      U:  $ r(   r  r  s     r   __lt___AssociationList.__lt__      DzE!!r   c                     [        U 5      U:*  $ r(   r  r  s     r   __le___AssociationList.__le__  r  r   c                     [        U 5      U:  $ r(   r  r  s     r   __gt___AssociationList.__gt__  r  r   c                     [        U 5      U:  $ r(   r  r  s     r   __ge___AssociationList.__ge__  r  r   c                 B    [         R                  " [        U 5      U5      $ r(   )r   cmpr   r  s     r   __cmp___AssociationList.__cmp__      xxT
E**r   c                 b     [        U5      n[        U 5      U-   $ ! [         a	    [        s $ f = fr(   r   	TypeErrorNotImplementedr$   iterabler4  s      r   __add___AssociationList.__add__  s8    	"NE DzE!!  	"!!	"    ..c                 b     [        U5      nU[        U 5      -   $ ! [         a	    [        s $ f = fr(   r  r  s      r   __radd___AssociationList.__radd__  s8    	"NE tDz!!  	"!!	"r  c                 T    [        U[        5      (       d  [        $ [        U 5      U-  $ r(   )r   intr  r   r$   ns     r   __mul___AssociationList.__mul__  s#    !S!!!!DzA~r   c                 (    U R                  U5        U $ r(   )r   )r$   r  s     r   __iadd___AssociationList.__iadd__  s    Hr   c                     [        U[        5      (       d  [        $ US:X  a  U R                  5         U $ US:  a   U R	                  [        U 5      US-
  -  5        U $ Nr   r~  )r   r  r  ra  r   r   r  s     r   __imul___AssociationList.__imul__  sU    
 !S!!!!6JJL  UKKT
a!e,-r   c                 :    [        U 5      R                  " U/UQ76 $ r(   )r   ry  )r$   r  argss      r   ry  _AssociationList.index  s    Dz,t,,r   c                     [        U 5      $ r(   r  rm   s    r   copy_AssociationList.copy  s    Dzr   c                 *    [        [        U 5      5      $ r(   )reprr   rm   s    r   rn   _AssociationList.__repr__  s    DJr   c                 D    [        S[        U 5      R                  -  5      eNz%s objects are unhashabler  r   r    rm   s    r   __hash___AssociationList.__hash__      3d4j6I6IIJJr   rQ   N))3r    rp   rq   rr   rs   rj  rq  r   r{  r  r  r  r  r  r  r  r  r  r   r  r   r  r  r  ra  r  r  r  r  r  r  r  r  r  r  __rmul__r  r  ry  r  rn   r  r   localsitems	func_namefunccallabler   r   rv   rQ   r   r   r   r     s'   2#$+E1<E& 


60."
"
(##"#"#+""
 H- K   01	4TNN*LLLi(("43;;DL 2 	4r   r   _NotProvidedc                      \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS'S jrS'S jrS r\R6                  (       a  S rS rS rS rS r OS r S r\!4S  jr"S! r#S" r$S# r%S$ r&S% r'\(" \)" 5       RA                  5       5       Hb  u  r*r+\," \+5      (       d  M  \+R                   \*:X  d  M'  \+R                  (       a  M:  \-" \.\*5      (       d  MJ  \/" \.\*5      R                  \+l        Md     C*C+S&r0g)(r   i  z(Generic, converting, dict-to-dict proxy.c                 $    U R                  X5      $ r(   rg  r$   r"   ri  s      r   rj  _AssociationDict._create  s    ||C''r   c                 $    U R                  U5      $ r(   rn  ro  s     r   rq  _AssociationDict._get  rs  r   c                 &    U R                  XU5      $ r(   ru  )r$   rp  r"   ri  s       r   r   _AssociationDict._set  s    {{7//r   c                 >    U R                  U R                  U   5      $ r(   rq  rS  r$   r"   s     r   r{  _AssociationDict.__getitem__  s    yy#''r   c                     XR                   ;   a   U R                  U R                   U   X5        g U R                  X5      U R                   U'   g r(   )rS  r   rj  r  s      r   r  _AssociationDict.__setitem__  s7    ((?IIdhhsmS0 LL4DHHSMr   c                     U R                   U	 g r(   r  r  s     r   r  _AssociationDict.__delitem__  s    HHSMr   c                     XR                   ;   $ r(   r  r  s     r   r  _AssociationDict.__contains__      hhr   c                     XR                   ;   $ r(   r  r  s     r   has_key_AssociationDict.has_key  r"  r   c                 H    [        U R                  R                  5       5      $ r(   )r  rS  keysrm   s    r   r  _AssociationDict.__iter__  s    DHHMMO$$r   c                 8    U R                   R                  5         g r(   rS  ra  rm   s    r   ra  _AssociationDict.clear      r   c                     [        U 5      U:H  $ r(   rf   r  s     r   r  _AssociationDict.__eq__  r  r   c                     [        U 5      U:g  $ r(   r.  r  s     r   r  _AssociationDict.__ne__  r  r   c                     [        U 5      U:  $ r(   r.  r  s     r   r  _AssociationDict.__lt__   r  r   c                     [        U 5      U:*  $ r(   r.  r  s     r   r  _AssociationDict.__le__  r  r   c                     [        U 5      U:  $ r(   r.  r  s     r   r  _AssociationDict.__gt__  r  r   c                     [        U 5      U:  $ r(   r.  r  s     r   r  _AssociationDict.__ge__	  r  r   c                 B    [         R                  " [        U 5      U5      $ r(   )r   r  rf   r  s     r   r  _AssociationDict.__cmp__  r  r   c                 F    [        [        U R                  5       5      5      $ r(   )r   rf   r  rm   s    r   rn   _AssociationDict.__repr__  s    D&''r   Nc                 0     X   $ ! [          a    Us $ f = fr(   )r?   r$   r"   defaults      r   r*   _AssociationDict.get  s#    	9 	N	s    c                 h    XR                   ;  a   U R                  X5      U R                   U'   U$ X   $ r(   )rS  rj  r?  s      r   
setdefault_AssociationDict.setdefault  s/    hh LL6DHHSMN9r   c                 6    U R                   R                  5       $ r(   )rS  r'  rm   s    r   r'  _AssociationDict.keys  s    xx}}r   c                 0   ^  U 4S jT R                    5       $ )Nc              3   b   >#    U  H$  oTR                  TR                  U   5      4v   M&     g 7fr(   r  .0r"   r$   s     r   	<genexpr>-_AssociationDict.iteritems.<locals>.<genexpr>%  %     Hx$))DHHSM23x   ,/r  rm   s   `r   	iteritems_AssociationDict.iteritems$      HtxxHHr   c                 0   ^  U 4S jT R                    5       $ )Nc              3   `   >#    U  H#  nTR                  TR                  U   5      v   M%     g 7fr(   r  rI  s     r   rK  ._AssociationDict.itervalues.<locals>.<genexpr>(  %     ADIIdhhsm,,   +.r  rm   s   `r   
itervalues_AssociationDict.itervalues'      AAAr   c                 6    U R                   R                  5       $ r(   )rS  iterkeysrm   s    r   r[  _AssociationDict.iterkeys*  s    88$$&&r   c                 ~    U R                   R                  5        Vs/ s H  oR                  U5      PM     sn$ s  snf r(   )rS  r2   rq  r  s     r   r2   _AssociationDict.values-  s.    48HHOO4EF4E&IIf%4EFFFs   :c                 l    U  Vs/ s H"  oU R                  U R                  U   5      4PM$     sn$ s  snf r(   r  )r$   r\   s     r   r  _AssociationDict.items0  s.    9=>A		$((1+./>>>s   )1c                 0   ^  U 4S jT R                    5       $ )Nc              3   b   >#    U  H$  oTR                  TR                  U   5      4v   M&     g 7fr(   r  rI  s     r   rK  )_AssociationDict.items.<locals>.<genexpr>6  rM  rN  r  rm   s   `r   r  r`  5  rQ  r   c                 0   ^  U 4S jT R                    5       $ )Nc              3   `   >#    U  H#  nTR                  TR                  U   5      v   M%     g 7fr(   r  rI  s     r   rK  *_AssociationDict.values.<locals>.<genexpr>9  rU  rV  r  rm   s   `r   r2   r^  8  rY  r   c                     U[         L a  U R                  R                  U5      nOU R                  R                  X5      nU R                  U5      $ r(   )r  rS  r   rq  )r$   r"   r@  rz  s       r   r   _AssociationDict.pop;  s=    l"XX\\#&FXX\\#/Fyy  r   c                 h    U R                   R                  5       nUS   U R                  US   5      4$ r  )rS  popitemrq  )r$   r  s     r   rj  _AssociationDict.popitemB  s0    xx!Q47+,,r   c                 b   [        U5      S:  a  [        S[        U5      -  5      e[        U5      S:X  a6  US   n[        US5      (       a  U H	  nX4   X'   M     O U H	  u  pVX`U'   M     U H	  u  pXU'   M     g ! [         a(  n[        R
                  " [        S5      US9   S nAN=S nAff = f)Nr~  z+update expected at most 1 arguments, got %ir   r'  z4dictionary update sequence requires 2-element tuplesr~   )rR  r  r   r  r   r   )
r$   ar   
seq_or_mapr  r\   r]   r   r"   ri  s
             r   r   _AssociationDict.updateF  s    q6A:=AF  Vq[1J z6**&D!+!1DJ '
 *"#Q !+ JCI  " KK"8 ),s   A< <
B.B))B.c                 <   [        U 5      nUR                  U=(       d    S5      n[        U=(       d    S5      R                  U5      nUR                  U5      nUR                  5       =(       d    S H  u  pxXu;   a  XU'   M  Xt;   d  M  XU'   M     U H  nX	 M     g r,  )r1   intersection
differencer  )	r$   rb  r2   existing	constants	additionsremovalsr"   rz  s	            r   r   _AssociationDict._bulk_replacec  s    t9))&,B7	"%00;	&&y1!<<>/R/KC"S	!"S		 0 C	 r   c                 4    [        U R                  5       5      $ r(   )rf   r  rm   s    r   r  _AssociationDict.copyr  s    DJJL!!r   c                 D    [        S[        U 5      R                  -  5      er  r  rm   s    r   r  _AssociationDict.__hash__u  r  r   rQ   r(   )1r    rp   rq   rr   rs   rj  rq  r   r{  r  r  r  r$  r  ra  r  r  r  r  r  r  r  rn   r*   rC  r'  r   py2krO  rW  r[  r2   r  r  r   rj  r   r   r  r  r   r
  r  r  r  r   rf   r   rv   rQ   r   r   r   r     s'   2($0(5%##"#"#+( yy	I	B	'	G	?
	I	B  , !-:"K   01	4TNN*LLLi(("43;;DL 2 	4r   r   c                   
   \ rS rSrSrS rS rS rS r\r	S r
S rS	 rS
 rS rS rS rS rS rS rS r\rS r\rS rS rS r\rS rS rS r\rS r S r!S r"S r#S r$S r%S r&S  r'S! r(S" r)S# r*S$ r+S% r,S& r-\." \/" 5       Ra                  5       5       Hb  u  r1r2\3" \25      (       d  M  \2R                   \1:X  d  M'  \2R                  (       a  M:  \4" \5\15      (       d  MJ  \6" \5\15      R                  \2l        Md     C1C2S'r7g())r   i  z&Generic, converting, set-to-set proxy.c                 $    U R                  U5      $ r(   rg  rh  s     r   rj  _AssociationSet._create  rl  r   c                 $    U R                  U5      $ r(   rn  ro  s     r   rq  _AssociationSet._get  rs  r   c                 ,    [        U R                  5      $ r(   rQ  rm   s    r   rT  _AssociationSet.__len__  rV  r   c                 (    U R                   (       a  ggr  r  rm   s    r   rY  _AssociationSet.__bool__  s    88r   c                 X    U R                    H  nU R                  U5      U:X  d  M    g   gr  r  r  s      r   r  _AssociationSet.__contains__  r  r   c              #   X   #    U R                    H  nU R                  U5      v   M     g7f)zIterate over proxied values.

For the actual domain objects, iterate over .col instead or just use
the underlying collection directly from its property on the parent.

Nr  r  s     r   r  _AssociationSet.__iter__  s'      hhF))F## r  c                 d    X;  a+  U R                   R                  U R                  U5      5        g g r(   )rS  addrj  rh  s     r   r  _AssociationSet.add  s&    HHLLe,- r   c                     U R                    H5  nU R                  U5      U:X  d  M  U R                   R                  U5          g    g r(   )rS  rq  discardr  s      r   r  _AssociationSet.discard  s6    hhFyy E)  ( r   c                     U R                    H5  nU R                  U5      U:X  d  M  U R                   R                  U5          g    [        U5      er(   )rS  rq  r  r?   r  s      r   r  _AssociationSet.remove  sB    hhFyy E)  (  uor   c                     U R                   (       d  [        S5      eU R                   R                  5       nU R                  U5      $ )Nzpop from an empty set)rS  r?   r   rq  r  s     r   r   _AssociationSet.pop  s3    xx233yy  r   c                 8    U H  nU R                  U5        M     g r(   )r  r$   r4  ri  s      r   r   _AssociationSet.update  s    EHHUO r   c                 h   [        U 5      nUR                  U=(       d    S5      n[        U=(       d    S5      R                  U5      nUR                  U5      nU R                  nU R                  nU=(       d    S H!  n	X;   a
  U" U	5        M  X;   d  M  U" U	5        M#     U H  n	U" U	5        M     g r,  )r1   rq  rr  r  r  )
r$   rb  r2   rs  rt  ru  rv  appenderremoverrz  s
             r   r   _AssociationSet._bulk_replace  s    t9))&,B7	"%00;	&&y188++llF" $ 	 # FFO r   c                 |    [         R                  " X5      (       d  [        $ U H  nU R                  U5        M     U $ r(   )r   _set_binops_check_strictr  r  r  s      r   __ior___AssociationSet.__ior__  s3    33D@@!!EHHUO r   c                 *    [        [        U 5      5      $ r(   )r1   r  rm   s    r   r   _AssociationSet._set  s    4:r   c                 6    [        U 5      R                  U5      $ r(   )r1   unionr  s     r   r  _AssociationSet.union  s    4yu%%r   c                 6    [        U 5      R                  U5      $ r(   )r1   rr  r  s     r   rr  _AssociationSet.difference      4y##E**r   c                 8    U H  nU R                  U5        M     g r(   )r  r  s      r   difference_update!_AssociationSet.difference_update  s    ELL r   c                 |    [         R                  " X5      (       d  [        $ U H  nU R                  U5        M     U $ r(   )r   r  r  r  r  s      r   __isub___AssociationSet.__isub__  s4    33D@@!!ELL r   c                 6    [        U 5      R                  U5      $ r(   )r1   rq  r  s     r   rq  _AssociationSet.intersection  s    4y%%e,,r   c                     U R                  U5      [        U 5      p2X2-
  X#-
  pTU H  nU R                  U5        M     U H  nU R                  U5        M     g r(   )rq  r1   r  r  r$   r4  wanthaver  r  ri  s          r   intersection_update#_AssociationSet.intersection_update  sN    &&u-s4ydk4;EKK EHHUO r   c                     [         R                  " X5      (       d  [        $ U R                  U5      [	        U 5      p2X2-
  X#-
  pTU H  nU R                  U5        M     U H  nU R                  U5        M     U $ r(   )r   r  r  rq  r1   r  r  r  s          r   __iand___AssociationSet.__iand__  sj    33D@@!!&&u-s4ydk4;EKK EHHUO r   c                 6    [        U 5      R                  U5      $ r(   )r1   symmetric_differencer  s     r   r  $_AssociationSet.symmetric_difference  s    4y--e44r   c                     U R                  U5      [        U 5      p2X2-
  X#-
  pTU H  nU R                  U5        M     U H  nU R                  U5        M     g r(   )r  r1   r  r  r  s          r   symmetric_difference_update+_AssociationSet.symmetric_difference_update  sN    ..u5s4ydk4;EKK EHHUO r   c                     [         R                  " X5      (       d  [        $ U R                  U5      [	        U 5      p2X2-
  X#-
  pTU H  nU R                  U5        M     U H  nU R                  U5        M     U $ r(   )r   r  r  r  r1   r  r  r  s          r   __ixor___AssociationSet.__ixor__"  sj    33D@@!!..u5s4ydk4;EKK EHHUO r   c                 6    [        U 5      R                  U5      $ r(   )r1   issubsetr  s     r   r  _AssociationSet.issubset/  s    4y!!%((r   c                 6    [        U 5      R                  U5      $ r(   )r1   
issupersetr  s     r   r  _AssociationSet.issuperset2  r  r   c                 8    U R                   R                  5         g r(   r*  rm   s    r   ra  _AssociationSet.clear5  r,  r   c                     [        U 5      $ r(   r1   rm   s    r   r  _AssociationSet.copy8  s    4yr   c                     [        U 5      U:H  $ r(   r  r  s     r   r  _AssociationSet.__eq__;      4yE!!r   c                     [        U 5      U:g  $ r(   r  r  s     r   r  _AssociationSet.__ne__>  r  r   c                     [        U 5      U:  $ r(   r  r  s     r   r  _AssociationSet.__lt__A      4y5  r   c                     [        U 5      U:*  $ r(   r  r  s     r   r  _AssociationSet.__le__D  r  r   c                     [        U 5      U:  $ r(   r  r  s     r   r  _AssociationSet.__gt__G  r  r   c                     [        U 5      U:  $ r(   r  r  s     r   r  _AssociationSet.__ge__J  r  r   c                 *    [        [        U 5      5      $ r(   )r   r1   rm   s    r   rn   _AssociationSet.__repr__M  s    CIr   c                 D    [        S[        U 5      R                  -  5      er  r  rm   s    r   r  _AssociationSet.__hash__P  r  r   rQ   N)8r    rp   rq   rr   rs   rj  rq  rT  rY  rd  r  r  r  r  r  r   r   r   r  r   r  __or__rr  __sub__r  r  rq  __and__r  r  r  __xor__r  r  r  r  ra  r  r  r  r  r  r  r  rn   r  r   r
  r  r  r  r  r   r1   r   rv   rQ   r   r   r   r     sA   0#$ K	.!$& F+ G - G5 #G)+""!"!"K   01	4TNN*LLLY''"3	2::DL 2 	4r   r   )rs   rd    r   r   r   r   r   r	   sqlr
   sql.operatorsr   r   symbolr   InspectionAttrInfor   objectrA   r   r   r   r   rJ  r   r  r   r   rQ   r   r   <module>r     s            +4;n KK 34 U
z44 U
pSAv SAlY(@ Yx7
%= 7
t
-
4&v & 4'V 4'nL- L^ {{>*l- l^X, Xr   