o znhTt@s6dZddlmZddlZddlZddlZddlmZddlmZddlm Z ddlm Z dd lm Z dd lm Z e ZGd d d eZGd ddeZGdddeZGdddeZGdddeeZGdddeZGdddeZGdddeeZGdddeZGdddeZGdd d eZGd!d"d"eZGd#d$d$eZGd%d&d&eZ Gd'd(d(eZ!eZ"eZ#eZ$e ej%Z&e d)d*Z'dJd+d,Z(Gd-d.d.eZ)d/d0Z*dJd1d2Z+d3d4Z,d5d6Z-d7d8Z.dJd9d:Z/d;d<Z0Gd=d>d>eZ1e1d?Z2d@dAZ3GdBdCdCeZ4GdDdEdEe4Z5dFdGZ6dHdIZ7dS)KzCollection classes and helpers.)absolute_importN) binary_types)collections_abc)itertools_filterfalse)py2k) string_types) threadingc@seZdZdZddZdS)AbstractKeyedTuplecC t|jS)zReturn a list of string key names for this :class:`.KeyedTuple`. .. seealso:: :attr:`.KeyedTuple._fields` )list_fieldsselfr r G/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/_collections.pykeyss zAbstractKeyedTuple.keysN)__name__ __module__ __qualname__ __slots__rr r r rr s r c@s6eZdZdZd ddZeddZddZd d ZdS) KeyedTuplea``tuple`` subclass that adds labeled names. E.g.:: >>> k = KeyedTuple([1, 2, 3], labels=["one", "two", "three"]) >>> k.one 1 >>> k.two 2 Result rows returned by :class:`.Query` that contain multiple ORM entities and/or column expressions make use of this class to return rows. The :class:`.KeyedTuple` exhibits similar behavior to the ``collections.namedtuple()`` construct provided in the Python standard library, however is architected very differently. Unlike ``collections.namedtuple()``, :class:`.KeyedTuple` is does not rely on creation of custom subtypes in order to represent a new series of keys, instead each :class:`.KeyedTuple` instance receives its list of keys in place. The subtype approach of ``collections.namedtuple()`` introduces significant complexity and performance overhead, which is not necessary for the :class:`.Query` object's use case. .. seealso:: :ref:`ormtutorial_querying` NcCs6t||}|r|jt||ng}||jd<|S)N_labels)tuple__new____dict__updatezip)clsvalslabelstr r rrJs  zKeyedTuple.__new__cCstdd|jDS)zReturn a tuple of string key names for this :class:`.KeyedTuple`. This method provides compatibility with ``collections.namedtuple()``. .. seealso:: :meth:`.KeyedTuple.keys` cSg|]}|dur|qSNr ).0lr r r ^z&KeyedTuple._fields..)rrrr r rrSs zKeyedTuple._fieldscCs td|)NzCan't set attribute: %s)AttributeErrorrkeyvaluer r r __setattr__` zKeyedTuple.__setattr__csfddDS)zReturn the contents of this :class:`.KeyedTuple` as a dictionary. This method provides compatibility with ``collections.namedtuple()``, with the exception that the dictionary returned is **not** ordered. csi|]}|j|qSr )rr$r*rr r jr'z&KeyedTuple._asdict..)rrr rr_asdictcszKeyedTuple._asdictr#) rrr__doc__rpropertyrr,r0r r r rr*s   rc@s(eZdZdZddZddZddZdS) _LWr cCs t||Sr#)rr)rrr r rrpr-z _LW.__new__cCstt||jffSr#)rr _real_fieldsrr r r __reduce__ssz_LW.__reduce__cCs tt|j|}|dd|S)zAReturn the contents of this :class:`.KeyedTuple` as a dictionary.N)dictrr4poprdr r rr0ys z _LW._asdictN)rrrrrr5r0r r r rr3ms  r3c@s eZdZddZeZZZdS)ImmutableContainercOstd|jj)Nz%s object is immutable) TypeError __class__rrargkwr r r _immutablezImmutableContainer._immutableN)rrrr@ __delitem__ __setitem__r,r r r rr:sr:c@sJeZdZejZZZZZ ddZ ddZ ddZ ddZ d d Zd S) immutabledictcGs t|}tj|g|R|Sr#)r6r__init__)rargsnewr r rrs zimmutabledict.__new__cGsdSr#r )rrFr r rrEszimmutabledict.__init__cCstt|ffSr#)rDr6rr r rr5zimmutabledict.__reduce__cCs:|s|S|st|tr |St|St|}t|||Sr#) isinstancerDr6r)rr9d2r r runions  zimmutabledict.unioncCsdt|S)Nzimmutabledict(%s))r6__repr__rr r rrLrHzimmutabledict.__repr__N)rrrr:r@clearr7popitem setdefaultrrrEr5rKrLr r r rrDs rDcseZdZdZdZddZddZddZfd d Zd d Z d dZ ddZ ddZ ddZ ddZddZddZddZddZdd Zd.d"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-ZZS)/ Propertiesz8Provide a __getattr__/__setattr__ interface over a dict._datacCst|d|dSNrRobjectr,)rdatar r rrEzProperties.__init__cCr r#)lenrRrr r r__len__ zProperties.__len__cCstt|jSr#)iterr rRvaluesrr r r__iter__rWzProperties.__iter__cs"ttt|dd|jDS)NcSsg|]}t|qSr )str)r$kr r rr&sz&Properties.__dir__..)dirsuperrPrRrrr<r r__dir__szProperties.__dir__cCst|t|Sr#r rotherr r r__add__rAzProperties.__add__cC||j|<dSr#rQrr*objr r rrCrHzProperties.__setitem__cC |j|Sr#rQrr*r r r __getitem__rZzProperties.__getitem__cCs |j|=dSr#rQrlr r rrBr-zProperties.__delitem__cCrhr#rQrir r rr,rHzProperties.__setattr__cCs d|jiSrSrQrr r r __getstate__rZzProperties.__getstate__cCst|d|ddSrSrT)rstater r r __setstate__zProperties.__setstate__cCs$z|j|WStyt|wr#)rRKeyErrorr(rlr r r __getattr__s   zProperties.__getattr__cC ||jvSr#rQrlr r r __contains__rZzProperties.__contains__cCr )z8Return an immutable proxy for this :class:`.Properties`.)ImmutablePropertiesrRrr r r as_immutables zProperties.as_immutablecCs|j|dSr#)rRrrr+r r rrrAzProperties.updateNcCs||vr||S|Sr#r )rr*defaultr r rgetszProperties.getcCr r#)r rRrr r rrrZzProperties.keyscCt|jSr#)r rRr\rr r rr\rHzProperties.valuescCr{r#)r rRitemsrr r rr|rHzProperties.itemscCrtr#rQrlr r rhas_keyrZzProperties.has_keycC|jdSr#)rRrMrr r rrMrHzProperties.clearr#)rrrr1rrErYr]rcrgrCrmrBr,rnrprsrurwrrzrr\r|r}rM __classcell__r r rbrrPs0  rPc@seZdZdZdZddZdS)OrderedPropertieszUProvide a __getattr__/__setattr__ interface with an OrderedDict as backing store.r cCst|tdSr#)rPrE OrderedDictrr r rrErWzOrderedProperties.__init__N)rrrr1rrEr r r rrs rc@seZdZdZdZdS)rvzDProvide immutable dict/object attribute to an underlying dictionary.r N)rrrr1rr r r rrvsrvc@seZdZdZdZddZd*ddZdd Zd d Zd d Z ddZ d*ddZ ddZ ddZ ddZddZddZerHddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)ZdS)+rzCA dict that returns keys/values/items in the order they were added._listcCst|ffSr#)rr|rr r rr5 rHzOrderedDict.__reduce__NcKs@g|_|dur|r|jdi|dSdS|j|fi|dS)Nr )rr)r_OrderedDict____sequencekwargsr r rrEs zOrderedDict.__init__cCsg|_t|dSr#)rr6rMrr r rrMzOrderedDict.clearcCs|Sr#)__copy__rr r rcopyzOrderedDict.copycCt|Sr#)rrr r rrrzOrderedDict.__copy__cOs|jj|i|dSr#)rsortr=r r rr!rqzOrderedDict.sortcKs^|dur$t|dr|D] }||||q n |D]\}}|||<q|r-||dSdS)Nr)hasattrrrCr)rrrr*r+r r rr$s    zOrderedDict.updatecCs"||vr ||||S||Sr#)rCrmr)r r rrO/s  zOrderedDict.setdefaultcCr r#r[rrr r rr]6rZzOrderedDict.__iter__cCrr#rdrr r rr9rzOrderedDict.keyscfddjDS)Ncsg|]}|qSr r r.rr rr&=z&OrderedDict.values..rrr rrr\<zOrderedDict.valuescr)Ncsg|]}||fqSr r r.rr rr&@r'z%OrderedDict.items..rrr rrr|?rzOrderedDict.itemscC t|Sr#)r[r\rr r r itervaluesDr-zOrderedDict.itervaluescCrr#)r[rr r riterkeysGrzOrderedDict.iterkeyscCrr#)r[r|rr r r iteritemsJr-zOrderedDict.iteritemscCsF||vrz|j|Wn ty|g|_Ynwt|||dSr#)rappendr(r6rCrir r rrCMs  zOrderedDict.__setitem__cCst|||j|dSr#)r6rBrremoverlr r rrBW zOrderedDict.__delitem__cGs0||v}tj||g|R}|r|j||Sr#)r6r7rr)rr*rypresentr+r r rr7[s  zOrderedDict.popcCst|}|j|d|SNr)r6rNrrritemr r rrNbs zOrderedDict.popitemr#)rrrr1rr5rErMrrrrrOr]rr\r|rrrrrCrBr7rNr r r rrs.     rc@seZdZd&ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ e Z ddZeZddZeZddZeZddZeZddZeZd d!ZeZd"d#ZeZd$d%ZeZdS)' OrderedSetNcCs>t|g|_|durt||_t||jdSg|_dSr#)setrEr unique_listrr8r r rrEis   zOrderedSet.__init__cCs$||vr |j|t||dSr#rrraddrelementr r rrrs zOrderedSet.addcCst|||j|dSr#)rrrrr r rrwrzOrderedSet.removecCs&||vr |j||t||dSr#)rinsertrr)rposrr r rr{szOrderedSet.insertcCs(||vr|j|t||dSdSr#)rrrrr r rdiscards zOrderedSet.discardcCst|g|_dSr#)rrMrrr r rrMs  zOrderedSet.clearcCrkr#rrlr r rrmrZzOrderedSet.__getitem__cCr r#rrr r rr]rZzOrderedSet.__iter__cCs ||Sr#)rKrer r rrgrZzOrderedSet.__add__cCsd|jj|jfSNz%s(%r))r<rrrr r rrLrWzOrderedSet.__repr__cCs.|D]}||vr|j|t||q|Sr#r)riterableer r rrs   zOrderedSet.updatecCs||}|||Sr#)r<rrrfresultr r rrKs  zOrderedSet.unionc t|fdd|DS)Nc3s|] }|vr|VqdSr#r r$arfr r z*OrderedSet.intersection..rr<rer rr intersectionzOrderedSet.intersectioncs<tfddD}|fddD|S)Nc3|] }|vr|VqdSr#r rrr rrrz2OrderedSet.symmetric_difference..c3rr#r rrr rrr)rr<rrr )rfrrsymmetric_differenceszOrderedSet.symmetric_differencecr)Nc3rr#r rrr rrrz(OrderedSet.difference..rrer rr differencerzOrderedSet.differencecs.tt|fdd|jD|_|S)Ncg|]}|vr|qSr r rrr rr&r'z2OrderedSet.intersection_update..)rintersection_updaterrer rrrs zOrderedSet.intersection_updatecsDt|fddjD_jfdd|jD7_S)Ncrr r rrr rr&r'z:OrderedSet.symmetric_difference_update..crr r rrr rr&r')rsymmetric_difference_updaterrer rrrs z&OrderedSet.symmetric_difference_updatecs&t|fddjD_S)Ncrr r rrr rr&r'z0OrderedSet.difference_update..)rdifference_updaterrer rrrs zOrderedSet.difference_updater#)rrrrErrrrrMrmr]rgrL__str__r__ior__rK__or__r__and__r__xor__r__sub__r__iand__r__ixor__r__isub__r r r rrhs8  rc@sJeZdZdZeZdOddZddZddZd d Z d d Z d dZ ddZ ddZ ddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Z d9d:Z!d;d<Z"d=d>Z#d?d@Z$dAdBZ%dCdDZ&dEdFZ'e'Z(dGdHZ)dIdJZ*dKdLZ+dMdNZ,dS)P IdentitySetzA set that considers only object id() for uniqueness. This strategy has edge cases for builtin types- it's possible to have two 'foo' strings in one of these sets, for example. Use sparingly. NcCs(t|_|r|D] }||qdSdSr#)r6_membersrrror r rrEs  zIdentitySet.__init__cCs||jt|<dSr#ridrxr r rrrWzIdentitySet.addcCst||jvSr#)rrrxr r rrurHzIdentitySet.__contains__cCs|jt|=dSr#rrxr r rrrAzIdentitySet.removecCs&z||WdStyYdSwr#)rrrrxr r rrs  zIdentitySet.discardcCs,z |j}|dWStytdw)Nrzpop from an empty set)rrNrr)rpairr r rr7s    zIdentitySet.popcCr~r#)rrMrr r rrMrHzIdentitySet.clearcCtd)Nzcannot compare sets using cmp()r;rer r r__cmp__rzIdentitySet.__cmp__cCst|tr |j|jkSdS)NFrIrrrer r r__eq__  zIdentitySet.__eq__cCst|tr |j|jkSdSNTrrer r r__ne__rzIdentitySet.__ne__cCsFt||}t|t|krdSt|jjt|jD]}dSdSNFTtyperXrrrur[rrrrfmr r rissubset s zIdentitySet.issubsetcCt|tstS||Sr#)rIrNotImplementedrrer r r__le__  zIdentitySet.__le__cCs(t|tstSt|t|ko||Sr#)rIrrrXrrer r r__lt__ zIdentitySet.__lt__cCsFt||}t|t|krdSt|jjt|jD]}dSdSrrrr r r issuperset s zIdentitySet.issupersetcCrr#)rIrrrrer r r__ge__,rzIdentitySet.__ge__cCs(t|tstSt|t|ko||Sr#)rIrrrXrrer r r__gt__1rzIdentitySet.__gt__cC6t|}|}t|}|j||||Sr#)r_member_id_tuples_iter_idrr _working_setrKrrrmembersrfr r rrK6 zIdentitySet.unioncCrr#)rIrrrKrer r rr>rzIdentitySet.__or__cC||j|_dSr#)rKrrrr r rrCrWzIdentitySet.updatecCt|tstS|||Sr#)rIrrrrer r rrF  zIdentitySet.__ior__cCrr#)rrrrrrrrr r rrLrzIdentitySet.differencecCrr#)rIrrrrer r rrTrzIdentitySet.__sub__cCrr#)rrrr r rrYrWzIdentitySet.difference_updatecCrr#)rIrrrrer r rr\rzIdentitySet.__isub__cCrr#)rrrrrrrrr r rrbrzIdentitySet.intersectioncCrr#)rIrrrrer r rrjrzIdentitySet.__and__cCrr#)rrrr r rrorWzIdentitySet.intersection_updatecCrr#)rIrrrrer r rrrrzIdentitySet.__iand__cCrr#)rrrrrrrrr r rrxs z IdentitySet.symmetric_differencecCsdd|jDS)Ncss|] }t||fVqdSr#r)r$vr r rrrz0IdentitySet._member_id_tuples..)rr\rr r rrrzIdentitySet._member_id_tuplescCrr#rIrrrrer r rrrzIdentitySet.__xor__cCrr#)rrrr r rrrWz'IdentitySet.symmetric_difference_updatecCrr#rrer r rrrzIdentitySet.__ixor__cCst|t|jSr#)rr[rr\rr r rrrqzIdentitySet.copycCr r#)rXrrr r rrYrZzIdentitySet.__len__cCr{r#)r[rr\rr r rr]rHzIdentitySet.__iter__cCr)Nzset objects are unhashablerrr r r__hash__rzIdentitySet.__hash__cCsdt|jt|jfSr)rrr rr\rr r rrLszIdentitySet.__repr__r#)-rrrr1rrrErrurrr7rMrrrrrrrrrrKrrrrrrrrrrrrrrrrrrrYr]rrLr r r rrsT     rc@s6eZdZd ddZddZddZdd Zd d Zd S) WeakSequencer cs0t|fdd|_fdd|D|_dS)NcSs"|}|dur|j|dSdSr#)_storager)rselfrefrr r r_removesz&WeakSequence.__init__.._removecsg|]}t|qSr )weakrefref)r$rrr rr&s z)WeakSequence.__init__..)rrrr)r_WeakSequence__elementsr rrrEs   zWeakSequence.__init__cCs|jt||jdSr#)rrrrrrr r rrszWeakSequence.appendcCr r#)rXrrr r rrYrZzWeakSequence.__len__cCsdddd|jDDS)Ncss|] }|dur|VqdSr#r )r$rjr r rrsz(WeakSequence.__iter__..css|]}|VqdSr#r )r$rr r rrs)rrr r rr]szWeakSequence.__iter__cCs.z |j|}W|Stytd|w)NzIndex %s out of range)rrr IndexError)rindexrjr r rrms   zWeakSequence.__getitem__N)r )rrrrErrYr]rmr r r rrs    rc@s&eZdZGdddeZdddZdS)OrderedIdentitySetc@seZdZdZdS)zOrderedIdentitySet._working_setTN)rrr__sa_hash_exempt__r r r rrsrNcCs2t|t|_|r|D] }||q dSdSr#)rrErrrrr r rrEs  zOrderedIdentitySet.__init__r#)rrrrrrEr r r rrsrc@ eZdZdZddZddZdS) PopulateDictzA dict which populates missing values via a creation function. Note the creation function takes a key, unlike collections.defaultdict. cCs ||_dSr#creator)rrr r rrErZzPopulateDict.__init__cCs||||<}|Sr#rrr*valr r r __missing__szPopulateDict.__missing__Nrrrr1rErr r r rrs rc@r)WeakPopulateDictzaLike PopulateDict, but assumes a self + a method and does not create a reference cycle. cCs|j|_|j}t||_dSr#)__func__r__self__rrweakself)rcreator_methodrr r rrEszWeakPopulateDict.__init__cCs|||||<}|Sr#)rrrr r rrszWeakPopulateDict.__missing__Nrr r r rrs rcCstt|Sr#)r2operator itemgetter)idxr r rsr cs:tjsfdd|DSfdd|DS)Ncs g|] }|vr|s|qSr r r$x)seenseen_addr rr& s zunique_list..cs(g|]}|vr|s|qSr r rhashfuncrrr rr& s )rr)seqrr rrrsrc@s*eZdZdZd ddZddZddZdS) UniqueAppenderzAppends items to a collection ensuring uniqueness. Additional appends() of the same object are ignored. Membership is determined by identity (``is a``) not equality (``==``). NcCsP||_i|_|rt|||_dSt|dr|j|_dSt|dr&|j|_dSdS)Nrr)rV_uniquegetattr_data_appenderrrr)rrVviar r rrEs    zUniqueAppender.__init__cCs.t|}||jvr||d|j|<dSdSr)rrr)rrid_r r rr%s   zUniqueAppender.appendcCr r#)r[rVrr r rr]+rZzUniqueAppender.__iter__r#)rrrr1rErr]r r r rrs   rcCs,t|dkrt|dtjrt|dS|S)Nrr)rXrItypes GeneratorTyper )r>r r rcoerce_generator_arg/s rcCsB|dur|St|tjrt|ttr|gSt|tr|St|Sr#)rIrIterablerrr )rryr r rto_list6s rcCst|dd|DS)zreturn True if any items of set\_ are present in iterable. Goes through special effort to ensure __hash__ is not called on items in iterable that don't support it. cSsg|]}|jr|qSr )rr$ir r rr&Ksz$has_intersection..)boolr)set_rr r rhas_intersectionCsr$cC(|durtSt|tstt|S|Sr#)rrIrrr r rto_setN   r'cCr%r#) column_setrIrr&r r r to_column_setWr(r*cKs*|}|r |||jdi||S)z5Copy the given dict and update with the given values.Nr )rr)r9_newr?r r r update_copy`s  r,ccs@|D]}t|tst|drt|D]}|Vqq|VqdS)zGiven an iterator of which further sub-elements may also be iterators, flatten the sub-elements into a single iterator. r]N)rIr^rflatten_iterator)relemyr r rr-js r-c@sdeZdZdZdZdddZdd Zdd d Zd d ZddZ ddZ ddZ e ddZ ddZdS)LRUCachezDictionary with 'squishy' removal of least recently used items. Note that either get() or [] should be used here, but generally its not safe to do an "in" check first as the dictionary can change subsequent to that call. )capacity threshold size_alert_counter_mutexd?NcCs&||_||_||_d|_t|_dSr)r1r2r3r4r Lockr5)rr1r2r3r r rrEs zLRUCache.__init__cCs|jd7_|jSNr)r4rr r r _inc_counterszLRUCache._inc_countercCs.t|||}||ur||d<|dS|SNr)r6rzr:)rr*ryrr r rrzs  z LRUCache.getcCs t||}||d<|dSr;)r6rmr:)rr*rr r rrms  zLRUCache.__getitem__cCsddt|DS)NcSsg|]}|dqS)rr r r r rr&rz#LRUCache.values..)r6r\rr r rr\rzLRUCache.valuescCs||vr||S|||<|Sr#r r)r r rrOszLRUCache.setdefaultcCsFt||}|dur|||g}t|||n||d<|dSr9)r6rzr:rC _manage_size)rr*r+rr r rrCs  zLRUCache.__setitem__cCs|j|j|jSr#)r1r2rr r rsize_thresholdszLRUCache.size_thresholdc Cs|jdsdSz_t|j}t||j|j|jkr`|r$d}||tt |t ddd}||jdD]}z||d=Wq8t yJYq8wt||j|j|jksW|j dSW|j dS|j w)NFr<T)r*reverser)r5acquirer"r3rXr1r2sortedr6r\r r rrrelease)rr3 by_counterrr r rr=s*    zLRUCache._manage_size)r6r7Nr#)rrrr1rrEr:rzrmr\rOrCr2r>r=r r r rr0ws    r0r6cCsl|ft|}t|}|r|St|tftddt|Ddg}||_tdd|D|_|t|<|S)NcSs$g|]\}}|dur|t|fqSr#)_property_getters)r$r fieldr r rr&s  z+lightweight_named_tuple..)rr cSr"r#r )r$fr r rr&r') r _lw_tuplesrzrr3r6 enumerater4r)namefieldshash_tp_clsr r rlightweight_named_tuples&  rMc@8eZdZdZddZddZddZdd Zd d Zd S) ScopedRegistryaA Registry that can store one or multiple instances of a single class on the basis of a "scope" function. The object implements ``__call__`` as the "getter", so by calling ``myregistry()`` the contained object is returned for the current scope. :param createfunc: a callable that returns a new object to be placed in the registry :param scopefunc: a callable that will return a key to store/retrieve an object. cCs||_||_i|_dS)aVConstruct a new :class:`.ScopedRegistry`. :param createfunc: A creation function that will generate a new value for the current scope, if none is present. :param scopefunc: A function that returns a hashable token representing the current scope (such as, current thread identifier). N) createfunc scopefuncregistry)rrPrQr r rrEs  zScopedRegistry.__init__cCs:|}z|j|WSty|j||YSwr#)rQrRrrrOrPrlr r r__call__s   zScopedRegistry.__call__cCs||jvS)z9Return True if an object is present in the current scope.)rQrRrr r rhas szScopedRegistry.hascCs||j|<dS)z$Set the value for the current scope.N)rRrQrrjr r rrszScopedRegistry.setcCs(z |j|=WdStyYdSw)z Clear the current scope, if any.N)rRrQrrrr r rrMs  zScopedRegistry.clearN rrrr1rErSrTrrMr r r rrOs rOc@rN) ThreadLocalRegistryz\A :class:`.ScopedRegistry` that uses a ``threading.local()`` variable for storage. cCs||_t|_dSr#)rPr localrR)rrPr r rrE#rzThreadLocalRegistry.__init__cCs2z|jjWSty|}|j_|YSwr#)rRr+r(rP)rrr r rrS's   zThreadLocalRegistry.__call__cCs t|jdS)Nr+)rrRrr r rrT.r-zThreadLocalRegistry.hascCs ||j_dSr#)rRr+rUr r rr1r-zThreadLocalRegistry.setcCs"z|j`WdStyYdSwr#)rRr+r(rr r rrM4s   zThreadLocalRegistry.clearNrVr r r rrWs rWccs|D] }t||fVqdS)z*Generator: ((id(o), o) for o in iterable).Nr)rrr r rr;srcCs0d}|D]}||ur|d7}|dkrdSqdS)zrGiven a sequence and search object, return True if there's more than one, False if zero or one of them. rrTFr )sequencetargetcrr r r has_dupesBs r\r#)8r1 __future__rr rrcompatrrrrrr frozenset EMPTY_SETrr rr3rUr:r6rDrPrrvrrrrrrrrr) column_dictordered_column_setr _gettersrDrrrrr$r'r*r,r-r0rGrMrOrWrr\r r r rsf       C O akS"         Q8