Mv%dZddlZddlmZddlmZddlmZddlmZddlmZdd lmZdd l m Z dd l m Z d Z ejd Z GddejZGddeZGddeZGddeZGdde eZGddeZGddeZGddeZejdZGdd eZGd!d"eZdS)#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 t||fi|S)aReturn 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_collectionattrkws /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/sqlalchemy/ext/associationproxy.pyassociation_proxyrsh -t : :r : ::ASSOCIATION_PROXYc`eZdZdZdZeZ ddZdZdZ dZ dd Z d Z d Z d Zd ZdS)r zDA descriptor that presents a read/write view of an object attribute.TNFc ||_||_||_||_||_||_||_dt|jd|dt||_ |r ||_ dSdS)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_attrcreatorgetset_factory proxy_factoryproxy_bulk_setcascade_scalar_deletestype__name__idkeyinfo) selfrrrrrrr"rs r__init__zAssociationProxy.__init__csR"3 ,*,&<## JJ       tHHH   DIII  rch||S|||}|r||S|SN) _as_instanceget)r#objclass_insts r__get__zAssociationProxy.__get__s@ >K  --  !88C==  rctt|}|||||Sr&)rr'set)r#r)valuesr*s r__set__zAssociationProxy.__set__s3c  --11#v>>>rcrt|}||||Sr&)rr'delete)r#r)r*s r __delete__zAssociationProxy.__delete__s1c  --44S999rc.|||S)aReturn 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_classzAssociationProxy.for_classsB  ---rc6 |j|jdz}n#t$rd}YnwxYw|O||}|6t|||}t ||jdz|nd}||js||S|S)N_inst) __dict__r!KeyError _calc_ownerAssociationProxyInstance for_proxysetattr _is_canonical_non_canonical_get_for_object)r#r*r)r+owners rr'zAssociationProxy._as_instances ?48g#56DD   DDD  <$$V,,E /99$sKK7 2D9999  D$6  55c:: :Ks  ''cp t|}|jjjS#tj$rYdSwxYwr&)rmapper class_managerr*rNoInspectionAvailable)r# target_clsinsps rr:zAssociationProxy._calc_owner sM 4:&&D;,3 3(    44  s "55cv|jtjfd}|turfd}nfd}||fS)Nc"| |ndSr&target_getters rgetterz0AssociationProxy._default_getset..getter&,&8776???d Brc*t||dSr&r=okvrs rsetterz0AssociationProxy._default_getset..setter$4#####rc*t||dSr&rPrRrTrs rrUz0AssociationProxy._default_getset..setter)rVrroperator attrgetterdictr#collection_classrMrUrLrs @@r_default_getsetz AssociationProxy._default_getsets%d++ C C C C C t # # $ $ $ $ $ $  $ $ $ $ $v~rc(d|jd|jdS)NzAssociationProxy(z, ))rrr#s r__repr__zAssociationProxy.__repr__.s#  " " " OOO  r)NNNNNFr&)r __module__ __qualname____doc__ is_attributerextension_typer$r,r0r3r5r'r:r_rcrIrrr r ]sNNL&N  $WWWWr   ???:::!.!.!.!.F2 4 4 4&     rr ceZdZdZdZdZ edZedZdZ e dZ dZ ed Z ejd Ze d Ze d Ze d ZejdZejdZe dZdZdZe dZdZdZdZdZdZdZddZ ddZ!ddZ"dZ#dS)r;aA 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|||_|j|_||_|j|_d|_||_||_dSr&)parentr! owning_classrr^ target_classr)r#rkrlrmrs rr$z!AssociationProxyInstance.__init__Ss@ :(!'!9 $($rNc|j}|j}tj||}t |tjs#tjtdd|j j } | ||}| |||||S#t$rt||||cYSwxYw)NzEassociation proxy to a non-relationship intermediary is not supportedreplace_context)rrr class_mapper get_property isinstanceRelationshipPropertyrraise_NotImplementedErrorrBr*_cls_unwrap_target_assoc_proxy_construct_for_assocAttributeError!AmbiguousAssociationProxyInstance) clsrkrlparent_instancerrproprm target_assocs rr<z"AssociationProxyInstance.for_proxyes "4&  --::;LMM$ 899  K#4!%     {)  ==jL++flL*    5 lJ     sB//C Cc|t||||St||}t|dst||||S|j}|rt||||St ||||S)N_is_internal_proxy)ObjectAssociationProxyInstancegetattrhasattrrz_impl_uses_objectsColumnAssociationProxyInstance)r{r~rkrlrmrr is_objects rrxz-AssociationProxyInstance._construct_for_assocs  #1 lJ |Z00t122 4 lJ +  1 lJ 2 lJ rcdtj|j|jSr&)rrqrlrrrrbs r _get_propertyz&AssociationProxyInstance._get_propertys. 122??  "   rc4|jSr&)r comparatorrbs r _comparatorz$AssociationProxyInstance._comparators!!##..rc td)NzqThe association proxy can't be used as a plain column expression; it only works inside of a comparison expressionrvrbs r__clause_element__z+AssociationProxyInstance.__clause_element__s! J   rcbt||}t|ttfr|SdSr&)rrsr r;)r{rmrrs rrwz7AssociationProxyInstance._cls_unwrap_target_assoc_proxys4|Z00 d-/GH I I KtrcB||j|jSr&)rwrmrrbs r_unwrap_target_assoc_proxyz3AssociationProxyInstance._unwrap_target_assoc_proxys$22  t   rc6t|j|jS)zThe 'remote' class attribute referenced by this :class:`.AssociationProxyInstance`. .. seealso:: :attr:`.AssociationProxyInstance.attr` :attr:`.AssociationProxyInstance.local_attr` )rrmrrbs r remote_attrz$AssociationProxyInstance.remote_attrst($/:::rc6t|j|jS)zThe 'local' class attribute referenced by this :class:`.AssociationProxyInstance`. .. seealso:: :attr:`.AssociationProxyInstance.attr` :attr:`.AssociationProxyInstance.remote_attr` )rrlrrbs r local_attrz#AssociationProxyInstance.local_attrst($*@AAArc|j|jfS)aReturn a tuple of ``(local_attr, remote_attr)``. This attribute is convenient when specifying a join using :meth:`_query.Query.join` across two relationships:: sess.query(Parent).join(*Parent.proxied.attr) .. seealso:: :attr:`.AssociationProxyInstance.local_attr` :attr:`.AssociationProxyInstance.remote_attr` )rrrbs rrzAssociationProxyInstance.attrs !122rcf|j }|r||S)zsReturn ``True`` if this :class:`.AssociationProxyInstance` proxies a scalar relationship on the local side.)ruselist_initialize_scalar_accessors)r#scalars rrzAssociationProxyInstance.scalars: ''))11  0  - - / / / rcp|j|jj Sr&)rrBrrrrrbs r_value_is_scalarz)AssociationProxyInstance._value_is_scalars1""$$ LL11   rctr&rrbs r_target_is_objectz*AssociationProxyInstance._target_is_objects!###rc|jjr|jd|\}}n|jd\}}||c|_|_dSr&)rkrr_ _scalar_get _scalar_set)r#r(set_s rrz5AssociationProxyInstance._initialize_scalar_accessorss] ; % : 224>>IC 33D99IC-0$*$***rcv|jtjfd}|turfd}nfd}||fS)Nc"| |ndSr&rIrJs rrMz8AssociationProxyInstance._default_getset..getter rNrc&t||Sr&rPrQs rrUz8AssociationProxyInstance._default_getset..setterq$***rc&t||Sr&rPrXs rrUz8AssociationProxyInstance._default_getset..setterrrrYr]s @@rr_z(AssociationProxyInstance._default_getsets%d++ C C C C C t # # + + + + + +  + + + + +v~rc|jjSr&)rkr"rbs rr"zAssociationProxyInstance.infos {rc||S|jr*t||j}||S t||j\}}}t ||krt ||kr |jJ|Sn#t$rYnwxYw|t||j\|_}t||jt |t ||f|Sr&) rrrrr!r r^ry_new_lazy_collectionr=)r#r)rK creator_idself_idproxys rr(zAssociationProxyInstance.gets ;K ; S$"899F##F++ + !.5S$(-C-C* GUc77j((RXX-@-@0<<< L "    ,099 d&<==,, (D !5 CBsGGRXXu#= > > >LsB BBc|jr|jjr |jjn|j}t ||j}|%|dSt ||j||dS||||$|jjrt ||jddSdSdS| |}|j J||ur| ||dSdSr&) rrkrrmrrr=rrr(r^ _bulk_replace)r#r)r/rrKrs rr.zAssociationProxyInstance.set6s ; 2;&' ##&  S$"899F~>FT3WWV__EEEEE  000>dk&H>C!7>>>>>">>>HHSMME(444F""##D&11111#"rc|j||d|jr,t||j}|t ||jt ||jdSr&)rlr:rrrdelattrrr#r)rKs rr2zAssociationProxyInstance.deleteLsn   $   S$ ' ' ' ; 1S$"899F!000T+,,,,,rcp|jjr |jjn|j}tj|}|jjr$||j|||j|fS|jjr|j||\}}n|j|\}}|tur|t|||||fS|tur|t|||||fS|tur|t|||||fStjd|jjd|jd)Nz=could not guess which interface to use for collection_class "z " backing "z6"; specify a proxy_factory and proxy_bulk_set manually)rkrrmrduck_type_collectionrrrr_list_AssociationListr\_AssociationDictr._AssociationSetr ArgumentErrorr^rr)r#lazy_collectionrr^rMrUs rrzAssociationProxyInstance._newVs#';#6 MDK  D>D// DDVDDJJ '0 I1'@ #J11*===rc |j)|jr"|jr|jrt jd|jd|dd|S)a!Produce 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. Nz9'any()' not implemented for scalar attributes. Use has().FrrrIrrrrrInvalidRequestErrorrr#rrs ranyzAssociationProxyInstance.anysw  * 2 K 3+ 3/3/D 3)N &t%   17   rc |j)|jr|jr|jst jd|jd|dd|S)a!Produce 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. Nz4'has()' not implemented for collections. Use any().TrrIrrs rhaszAssociationProxyInstance.hassw  * 2  3& 3/3/D 3)I &t%   06   rc0|jjd|jdS)N(ra) __class__rrkrbs rrcz!AssociationProxyInstance.__repr__s>222DKKK@@rr&)$rrdrerfr$rm classmethodr<rxrpropertyrrrwrmemoized_propertyrrrrrrrrr_r"r(r.r2rrrrrrrcrIrrr;r;5st:%%%L[B[.   //X/   [      ; ;X ; B BX B33X3"     $$X$777&  X 2222,---...`    >>>>:    (    (AAAAArr;cteZdZdZdZdZfdZdZdZd dZ d d Z e j d Z d Zd ZxZS)rzzcan :class:`.AssociationProxyInstance` where we cannot determine the type of target object. Fc ltd|jjd|jd|jd|jd )NzAssociation proxy .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)ryrlrrrrmrbs r _ambiguousz,AmbiguousAssociationProxyInstance._ambiguoussMn !***&&&!!!    rc\||Stt||Sr&)superrzr()r#r)rs rr(z%AmbiguousAssociationProxyInstance.gets, ;K:DAAEEcJJ Jrc.|dSr&rr#r)s r__eq__z(AmbiguousAssociationProxyInstance.__eq__  rc.|dSr&rrs r__ne__z(AmbiguousAssociationProxyInstance.__ne__ rrNc .|dSr&rrs rrz%AmbiguousAssociationProxyInstance.anyrrc .|dSr&rrs rrz%AmbiguousAssociationProxyInstance.hasrrciSr&rIrbs r _lookup_cachez/AmbiguousAssociationProxyInstance._lookup_caches  rc|t||j}|p t|}|j}|j}||jvr||| |j|S#t$rYnwxYw#tj $rYnwxYw|Sr&) rrrrBr*r_populate_cacher9rrD)r#r| actual_objrFrBinstance_classs rr?z?AmbiguousAssociationProxyInstance._non_canonical_get_for_objects  & $2HIIJ% ":..D"[F%+]N%T-???,,^VDDD#1.AA#0D s#A5 A%% A21A25BBc^tj|j|j}||jra|} |||j}| ||j |j||j|j |<dS#t$rYdSwxYwdSr&) rrqrlrrrisarBrwrrxrkrry)r#rrBr}rmr~s rrz1AmbiguousAssociationProxyInstance._populate_cache3s 122??  "   ::dk " " )L #BB $/   6:5N5N K% O 66">222"       sB B*)B*r&)rrdrerfr>rr(rrrrrrrr?r __classcell__)rs@rrzrzsM    KKKKK   .rrzc,eZdZdZdZdZdZdZdZdS)rzEan :class:`.AssociationProxyInstance` that has an object as a target.Tc|j}|:|j|js||n||kS|jrS|jrL|jsE|jt|j |j |S|jr"|jr|jrtj d|jjdi|j |iS)aaProduce 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. Nz>'=>> D(  (4#'AA4?C*@AA Arcn|jt|j|j|kSr&)rrrrmrrs rrz%ObjectAssociationProxyInstance.__ne__|s6## D%t 7 73 >   rN) rrdrerfrr>rrrrIrrrrJsYOOMPPPB B B B     rrc&eZdZdZdZdZdZdZdS)rzVan :class:`.AssociationProxyInstance` that has a database column as a target. FTc||jtj|}|t ||jdkS|Sr&)rroperaterZeqr r)r#otherexprs rrz%ColumnAssociationProxyInstance.__eq__sS%%   $ $X[% 8 8   =tT-566 6KrcT||jj|g|Ri|Sr&)rrr)r#oprrs rrz&ColumnAssociationProxyInstance.operates=%% $D  $R :% : : :6 : :   rN)rrdrerfrr>rrrIrrrrsIM     rrc&eZdZdZdZdZdZdS)rc"||_||_dSr&rkrKrs rr$z_lazy_collection.__init__s  rc6t|j|jSr&)rrkrKrbs r__call__z_lazy_collection.__call__st{DK000rc |j|jdS)N)r)rKrrbs r __getstate__z_lazy_collection.__getstate__s{dk:::rc:|d|_|d|_dS)Nr)rKrr#states r __setstate__z_lazy_collection.__setstate__sEl Ho rN)rrdrer$rrrrIrrrrsP111;;;&&&&&rrcNeZdZdZedZdZdZeZdZ dZ dZ dS) _AssociationCollectioncL||_||_||_||_||_dS)aConstructs 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)rrrMrUrk)r#rrrMrUrks rr$z_AssociationCollection.__init__s,2 /    rc*|Sr&)rrbs rz_AssociationCollection.s 4 4 6 6rc*t|jSr&lencolrbs r__len__z_AssociationCollection.__len__48}}rc*t|jSr&)boolrrbs r__bool__z_AssociationCollection.__bool__sDH~~rc |j|jdS)Nrkrrrbs rrz#_AssociationCollection.__getstate__s+$:NOOOrcn|d|_|d|_|j|dS)Nrkr)rkrrrs rrz#_AssociationCollection.__setstate__s7Ho $%67 T"""""rcZ||||dSr&)clearr)r# assoc_proxyr/s rrz$_AssociationCollection._bulk_replaces+ v&&&&&rN) rrdrer$rrrr __nonzero__rrrrIrrr r s> (66 7 7CKPPP### '''''rr ceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZd(dZdZdZdZdZdZdZdZdZdZdZdZdZdZ d Z!e!Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(e)e*+D]I\Z,Z-e.j/e-r4e-je,kr)e-js"e0e)e,re1e)e,je-_J[,[-d'S))rz(Generic, converting, list-to-list proxy.c,||Sr&rr#values r_createz_AssociationList._create||E"""rc,||Sr&rMr#object_s r_getz_AssociationList._get{{7###rc.|||Sr&rU)r#r(r"s rrz_AssociationList._sets{{7E***rct|ts j|Sfdj|DS)Nc:g|]}|SrIr).0memberr#s r z0_AssociationList.__getitem__..s%DDD&DIIf%%DDDr)rsslicer)rr#indexs` r __getitem__z_AssociationList.__getitem__sN%'' E99TXe_-- -DDDDDHUODDD Drct|ts#||j||dS|jt |}n*|jdkrt ||jz}n|j}|jpd}|jpd}tt|jpd||}|dkr,|D]}||=|}|D]}| |||dz }dSt |t |kr/tdt |dt |t||D]&\}}||j||'dS)Nrz#attempt to assign sequence of size z to extended slice of size ) rsr4rrstoprstepstartrrangeinsert ValueErrorzip) r#r6r"r:r;r<rngiitems r __setitem__z_AssociationList.__setitem__s%'' 1 IIdhuou - - - - -z!4yya4yy5:-z:?DK$1EuU[-AtT::;;Cqyy$$AU !DKK4(((FAAu::S))$*7:5zzzz3s888M #311GAtIIdhqk4000011rc|j|=dSr&rr5s r __delitem__z_AssociationList.__delitem__s HUOOOrcR|jD]}|||krdSdSNTFrr)r#r"r2s r __contains__z_AssociationList.__contains__;h  Fyy  E))tt*urc:fdj||DS)Nc:g|]}|SrIr/r0s rr3z1_AssociationList.__getslice__.. s%DDDf &!!DDDrrFr#r<ends` r __getslice__z_AssociationList.__getslice__s(DDDDs0CDDDDrc<fd|D}|j||<dS)Nc:g|]}|SrI)r#)r1rTr#s rr3z1_AssociationList.__setslice__..#s#333q4<<??333rrF)r#r<rQr/memberss` r __setslice__z_AssociationList.__setslice__"s23333F333%src|j||=dSr&rFrPs r __delslice__z_AssociationList.__delslice__&s HU3Y   rc#LK|jD]}||VdS)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. NrJr#r2s r__iter__z_AssociationList.__iter__)s9h $ $F))F## # # # #rch|j}||}||dSr&)rr#append)r#r"rrCs rr]z_AssociationList.append5s2h||E"" 4rc |tdtjfdt|DS)Ncg|]}dS)r9rI)r1rs rr3z*_AssociationList.count..<s(      rc|kSr&rI)rTr"s rr z(_AssociationList.count..?s a5jr)sumritertools_filteriterr!s `rcountz_AssociationList.count:sR  .(((($t**      rc:|D]}||dSr&)r])r#r/rTs rrz_AssociationList.extendDs,  A KKNNNN  rcF||g|j||<dSr&)r#r)r#r6r"s rr>z_AssociationList.insertHs'!%e!4!4 5urc\||j|Sr&)rMrrr5s rrz_AssociationList.popKs"{{48<<..///rclt|D]\}}||kr |j|=dStd)Nzvalue not in list) enumeraterr?)r#r"rBvals rremovez_AssociationList.removeNsJoo  FAse||HQK,---rct)z#Not supported, use reversed(mylist)rrbs rreversez_AssociationList.reverseU "!rct)z!Not supported, use sorted(mylist)rrbs rsortz_AssociationList.sortZrorc>|jdt|j=dS)Nr)rrrbs rrz_AssociationList.clear_s HQTX& ' ' 'rc(t||kSr&rr#rs rrz_AssociationList.__eq__bDzzU""rc(t||kSr&rtrus rrz_AssociationList.__ne__ervrc(t||kSr&rtrus r__lt__z_AssociationList.__lt__hDzzE!!rc(t||kSr&rtrus r__le__z_AssociationList.__le__krvrc(t||kSr&rtrus r__gt__z_AssociationList.__gt__nrzrc(t||kSr&rtrus r__ge__z_AssociationList.__ge__qrvrcFtjt||Sr&)rcmprrus r__cmp__z_AssociationList.__cmp__txT E***rcv t|}n#t$r tcYSwxYwt||zSr&r TypeErrorNotImplementedr#iterablers r__add__z_AssociationList.__add__wsL "NNEE " " "! ! ! ! "DzzE!! &&cv t|}n#t$r tcYSwxYw|t|zSr&rrs r__radd__z_AssociationList.__radd__~sL "NNEE " " "! ! ! ! "tDzz!!rc^t|tstSt||zSr&)rsintrrr#ns r__mul__z_AssociationList.__mul__s*!S!! "! !DzzA~rc0|||Sr&)r)r#rs r__iadd__z_AssociationList.__iadd__s H rct|tstS|dkr|n.|dkr(|t ||dz z|SNrr9)rsrrrrrrs r__imul__z_AssociationList.__imul__sc !S!! "! ! 66 JJLLLL UU KKT a!e, - - - rc8t|j|g|RSr&)rr6)r#rCargss rr6z_AssociationList.indexs#tDzz,t,,,,rc t|Sr&rtrbs rcopyz_AssociationList.copysDzzrc:tt|Sr&)reprrrbs rrcz_AssociationList.__repr__sDJJrcJtdt|jzNz%s objects are unhashablerrrrbs r__hash__z_AssociationList.__hash__3d4jj6IIJJJrN)rg)2rrdrerfr#r)rr7rDrGrLrRrVrXr[r]rdrr>rrlrnrqrrrryr|r~rrrrr__rmul__rrr6rrcrrlocalsitems func_namefuncrcallablerrrIrrrrs22###$$$+++EEE 111<EEE&&&          6660000...""" """ (((######"""###"""###+++"""""" H   ---   KKK 4 0 011<< 4 DM$   < **L+i((+#7433;DL444rr _NotProvidedceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZd%dZd%dZdZejrdZdZdZdZdZndZdZe fdZ!d Z"d!Z#d"Z$d#Z%d$Z&e'e(D]I\Z)Z*ej+e*r4e*je)kr)e*js"e,e-e)re.e-e)je*_J[)[*dS)&rz(Generic, converting, dict-to-dict proxy.c.|||Sr&r r#r!r"s rr#z_AssociationDict._creates||C'''rc,||Sr&r&r's rr)z_AssociationDict._getr*rc0||||Sr&r,)r#r(r!r"s rrz_AssociationDict._sets{{7C///rcB||j|Sr&r)rr#r!s rr7z_AssociationDict.__getitem__syy#'''rc||jvr$||j|||dS||||j|<dSr&)rrr#rs rrDz_AssociationDict.__setitem__sL $(?? IIdhsmS% 0 0 0 0 0 LLe44DHSMMMrc|j|=dSr&rFrs rrGz_AssociationDict.__delitem__s HSMMMrc||jvSr&rFrs rrLz_AssociationDict.__contains__dhrc||jvSr&rFrs rhas_keyz_AssociationDict.has_keyrrcNt|jSr&)rcrkeysrbs rr[z_AssociationDict.__iter__sDHMMOO$$$rc8|jdSr&rrrbs rrz_AssociationDict.clear rc(t||kSr&r\rus rrz_AssociationDict.__eq__rvrc(t||kSr&rrus rrz_AssociationDict.__ne__rvrc(t||kSr&rrus rryz_AssociationDict.__lt__rzrc(t||kSr&rrus rr|z_AssociationDict.__le__rvrc(t||kSr&rrus rr~z_AssociationDict.__gt__rzrc(t||kSr&rrus rrz_AssociationDict.__ge__rvrcFtjt||Sr&)rrr\rus rrz_AssociationDict.__cmp__rrc^tt|Sr&)rr\rrbs rrcz_AssociationDict.__repr__s D&&'''rNc8 ||S#t$r|cYSwxYwr&)r9r#r!defaults rr(z_AssociationDict.gets5 9    NNN s  cd||jvr ||||j|<|S||Sr&)rr#rs r setdefaultz_AssociationDict.setdefaults7 dh   LLg66DHSMN9 rc4|jSr&)rrrbs rrz_AssociationDict.keyssx}}rc*fdjDS)Nc3\K|]&}|j|fV'dSr&rr1r!r#s r z-_AssociationDict.iteritems..:HHS$))DHSM223HHHHHHrrFrbs`r iteritemsz_AssociationDict.iteritemsHHHHtxHHH Hrc*fdjDS)Nc3XK|]$}j|V%dSr&rrs rrz._AssociationDict.itervalues.. 5AADIIdhsm,,AAAAAArrFrbs`r itervaluesz_AssociationDict.itervalues AAAAAAA Arc4|jSr&)riterkeysrbs rrz_AssociationDict.iterkeys s8$$&& &rcNfdjDS)Nc:g|]}|SrIr/r0s rr3z+_AssociationDict.values..s%FFF&DIIf%%FFFr)rr/rbs`rr/z_AssociationDict.valuess)FFFFDHOO4E4EFFF Frc fdDS)NcTg|]$}|j|f%SrIr)r1rSr#s rr3z*_AssociationDict.items..s0>>>AQ $(1+../>>>rrIrbs`rrz_AssociationDict.itemss>>>>>>> >rc*fdjDS)Nc3\K|]&}|j|fV'dSr&rrs rrz)_AssociationDict.items..rrrFrbs`rrz_AssociationDict.itemsrrc*fdjDS)Nc3XK|]$}j|V%dSr&rrs rrz*_AssociationDict.values..rrrFrbs`rr/z_AssociationDict.valuesrrc|tur|j|}n|j||}||Sr&)rrrr))r#r!rr2s rrz_AssociationDict.popsI l " "X\\#&&FFX\\#w//Fyy   rcz|j}|d||dfSr)rpopitemr))r#rCs rrz_AssociationDict.popitem%s4x!!Q47++,,rct|dkrtdt|zt|dkrr|d}t|dr|D] }||||<nI |D] \}}|||< n:#t$r-}t jtd|Yd}~nd}~wwxYw|D] \}} | ||< dS)Nr9z+update expected at most 1 arguments, got %irrz4dictionary update sequence requires 2-element tuplesro)rrrr?rru) r#ar seq_or_maprCrSrTerrr!r"s rrz_AssociationDict.update)s= q66A::=AF VVq[[1Jz6** &22D!+D!1DJJ2  *$$1"#Q$!K"8),   JCDII  s0 A>> B5#B00B5c2t|}||pd}t|pd|}||}|pdD]\}}||vr|||<||vr|||<|D]}||=dSr)r. intersection differencer) r#rr/existing constants additionsremovalsr!r2s rrz_AssociationDict._bulk_replaceFst99))&,B77  "%%00;; &&y11!<<>>/R # #KCi"S  !!"S   CS   rcDt|Sr&)r\rrbs rrz_AssociationDict.copyUsDJJLL!!!rcJtdt|jzrrrbs rrz_AssociationDict.__hash__Xrrr&)/rrdrerfr#r)rr7rDrGrLrr[rrrryr|r~rrrcr(rrrpy2krrrr/rrrrrrrrrrrrrrr\rrIrrrrs22((($$$000(((555 %%%######"""###"""###+++(((  yB I I I B B B ' ' ' G G G ? ? ? ?  I I I B B B ,!!!!---:   """KKK 4 0 011<< 4 DM$   < **L+i((+#7433;DL444rrceZdZdZdZdZdZdZeZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZeZdZeZdZdZdZeZdZdZdZeZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&d Z'd!Z(d"Z)d#Z*d$Z+d%Z,e-e./D]I\Z0Z1e2j3e1r4e1je0kr)e1js"e4e5e0re6e5e0je1_J[0[1d&S)'rz&Generic, converting, set-to-set proxy.c,||Sr&r r!s rr#z_AssociationSet._createir$rc,||Sr&r&r's rr)z_AssociationSet._getlr*rc*t|jSr&rrbs rrz_AssociationSet.__len__orrc|jrdSdSrIrFrbs rrz_AssociationSet.__bool__rs 8 45rcR|jD]}|||krdSdSrIrJrKs rrLz_AssociationSet.__contains__zrMrc#LK|jD]}||VdS)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. NrJrZs rr[z_AssociationSet.__iter__s9h $ $F))F## # # # #rcl||vr/|j||dSdSr&)raddr#r!s rrz_AssociationSet.adds;    HLLe,, - - - - -  rc|jD]8}|||kr|j|dS9dSr&)rr)discardrKs rrz_AssociationSet.discardsVh  Fyy  E))  (((*  rc|jD]8}|||kr|j|dS9t|r&)rr)rr9rKs rrlz_AssociationSet.removesZh  Fyy  E))  (((*uoorc|jstd|j}||S)Nzpop from an empty set)rr9rr)rZs rrz_AssociationSet.pops<x 4233 3yy   rc:|D]}||dSr&)rr#rr"s rrz_AssociationSet.updates,  E HHUOOOO  rcLt|}||pd}t|pd|}||}|j}|j}|pdD]!} | |vr || | |vr || "|D] } || dSr)r.rrrrl) r#rr/rrrrappenderremoverr2s rrz_AssociationSet._bulk_replacest99))&,B77  "%%00;; &&y118+l ! !F""    9$$     F GFOOOO  rcrtj||stS|D]}|||Sr&)r_set_binops_check_strictrrrs r__ior__z_AssociationSet.__ior__sB3D%@@ "! !  E HHUOOOO rc:tt|Sr&)r.rcrbs rrz_AssociationSet._sets4::rcFt||Sr&)r.unionrus rr z_AssociationSet.unions4yyu%%%rcFt||Sr&)r.rrus rrz_AssociationSet.difference4yy##E***rc:|D]}||dSr&)rrs rdifference_updatez!_AssociationSet.difference_updates0  E LL      rcrtj||stS|D]}|||Sr&)rrrrrs r__isub__z_AssociationSet.__isub__sF3D%@@ "! !  E LL     rcFt||Sr&)r.rrus rrz_AssociationSet.intersections4yy%%e,,,rc||t|}}||z ||z }}|D]}|||D]}||dSr&)rr.rlrr#rwanthaverlrr"s rintersection_updatez#_AssociationSet.intersection_updates~&&u--s4yydTk4$;  E KK      E HHUOOOO  rctj||stS||t |}}||z ||z }}|D]}|||D]}|||Sr&)rrrrr.rlrrs r__iand__z_AssociationSet.__iand__s3D%@@ "! !&&u--s4yydTk4$;  E KK      E HHUOOOO rcFt||Sr&)r.symmetric_differencerus rrz$_AssociationSet.symmetric_differences4yy--e444rc||t|}}||z ||z }}|D]}|||D]}||dSr&)rr.rlrrs rsymmetric_difference_updatez+_AssociationSet.symmetric_difference_updates~..u55s4yydTk4$;  E KK      E HHUOOOO  rctj||stS||t |}}||z ||z }}|D]}|||D]}|||Sr&)rrrrr.rlrrs r__ixor__z_AssociationSet.__ixor__s3D%@@ "! !..u55s4yydTk4$;  E KK      E HHUOOOO rcFt||Sr&)r.issubsetrus rr!z_AssociationSet.issubsets4yy!!%(((rcFt||Sr&)r. issupersetrus rr#z_AssociationSet.issupersetr rc8|jdSr&rrbs rrz_AssociationSet.clearrrc t|Sr&r.rbs rrz_AssociationSet.copys4yyrc(t||kSr&r&rus rrz_AssociationSet.__eq__4yyE!!rc(t||kSr&r&rus rrz_AssociationSet.__ne__!r(rc(t||kSr&r&rus rryz_AssociationSet.__lt__$4yy5  rc(t||kSr&r&rus rr|z_AssociationSet.__le__'r(rc(t||kSr&r&rus rr~z_AssociationSet.__gt__*r+rc(t||kSr&r&rus rrz_AssociationSet.__ge__-r(rc:tt|Sr&)rr.rbs rrcz_AssociationSet.__repr__0sCIIrcJtdt|jzrrrbs rrz_AssociationSet.__hash__3rrN)7rrdrerfr#r)rrrrLr[rrrlrrrrrr __or__r__sub__rrr__and__rrr__xor__rrr!r#rrrrryr|r~rrcrrrrrrrrrr.rrIrrrrfs00###$$$ K   ...  !!! $&&&F+++G   ---G   555#G   )))+++""""""!!!"""!!!"""KKK 4 0 011;; 4 DM$   ; **L+Y''+#73 22:DL444rr)rfrZrrrrrr sqlr sql.operatorsr rsymbolrInspectionAttrInfor objectr;rzrrrr rrrrrIrrr;s++++++4;4;4;n DK 344U U U U U z4U U U pvAvAvAvAvAvvAvAvAr YYYYY(@YYYx7 7 7 7 7 %=7 7 7 t     -   4 & & & & &v & & & 4'4'4'4'4'V4'4'4'nLLLLL-LLL^t{>** lllll-lll^XXXXX,XXXXXr