o ?Og~@sdZddlmZmZddlZeeeZedZ ddZ ee Z [ gdZ dZ eed ZeeeZeeiZeeiZeeiZeegZeeegZeeedZeeed d >ZeeeZeed Z eed Z!eee"Z#eiZ$eiZ%eiZ&eej'Z(eddZ)ddZ*e*Z*ee*Z+e*,[*ddZ-e-Z-ee-Z.[-ddZ/GdddedZ0GdddedZ1Gddde1Z2e23e+GdddedZ4Gdd d e4Z5Gd!d"d"e5Z6e63e.Gd#d$d$edZ7Gd%d&d&e7Z8e83ee83ee83ee83ee83ee83ee83ee83ee83ee83ee83e e83e!e83e#Gd'd(d(e7Z9Gd)d*d*e8Z:e:3e)Gd+d,d,edZ;Gd-d.d.edZd3d4Z?d5d6Z@d7d8ZAGd9d:d:edZBGd;d<dd>eCZEeE3eGd?d@d@e=ZFeF3e(GdAdBdBe;ZGGdCdDdDeGeCZHeH3e$GdEdFdFeGeCZIeI3e&GdGdHdHeGe=ZJeJ3e%GdIdJdJeFZKeK3eLGdKdLdLe9e=ZMeM3eNeM3eOeM3eeM3ePGdMdNdNeMZQeQ3eReQ3eGdOdPdPeMZSeS3eeS3edS)QzjAbstract Base Classes (ABCs) for collections, according to PEP 3119. Unit tests are in test_collections. )ABCMetaabstractmethodN.cCsdSNrrr7/opt/alt/python310/lib64/python3.10/_collections_abc.py_fsr) Awaitable Coroutine AsyncIterable AsyncIteratorAsyncGeneratorHashableIterableIterator Generator ReversibleSized ContainerCallable CollectionSet MutableSetMappingMutableMapping MappingViewKeysView ItemsView ValuesViewSequenceMutableSequence ByteStringzcollections.abcirccsdVSrrrrrr>sr$csdSrrrrrr_coro@sr%cCs dVdSrrrrrr_agFs r&cGsN|j}|D]}|D]}||jvr|j|durtSnq tSqdS)NT)__mro____dict__NotImplemented)CmethodsmromethodBrrr_check_methodsNs  r/c@(eZdZdZeddZeddZdS)r rcCdSNrrselfrrr__hash__^zHashable.__hash__cC|tur t|dStS)Nr5)r r/r)clsr*rrr__subclasshook__b zHashable.__subclasshook__N)__name__ __module__ __qualname__ __slots__rr5 classmethodr:rrrrr Z  r ) metaclassc@0eZdZdZeddZeddZeeZ dS)rrccs dVdSrrr3rrr __await__ms zAwaitable.__await__cCr7)NrD)rr/r)r8rrrr:qr;zAwaitable.__subclasshook__N) r<r=r>r?rrDr@r: GenericAlias__class_getitem__rrrrri   rc@s>eZdZdZeddZed ddZddZed d Z dS) r rcCt)zcSend a value into the coroutine. Return next yielded value or raise StopIteration.  StopIterationr4valuerrrsend~zCoroutine.sendNcC0|dur |dur ||}|dur||}|)zgRaise an exception in the coroutine. Return next yielded value or raise StopIteration. Nwith_tracebackr4typvaltbrrrthrow zCoroutine.throwc C.z |tWtdttfyYdSw).Raise GeneratorExit inside coroutine. zcoroutine ignored GeneratorExitNrV GeneratorExitrJ RuntimeErrorr3rrrclose  zCoroutine.closecCs|tur t|ddddStS)NrDrMrVr])r r/r)r8rrrr:szCoroutine.__subclasshook__NN) r<r=r>r?rrMrVr]r@r:rrrrr zs    r c@rC)r rcCstSr)r r3rrr __aiter__szAsyncIterable.__aiter__cCr7)Nr`)r r/r)r8rrrr:r;zAsyncIterable.__subclasshook__N) r<r=r>r?rr`r@r:rErFrrrrr rGr c@0eZdZdZeddZddZeddZdS) r rct)z@Return the next item or raise StopAsyncIteration when exhausted.StopAsyncIterationr3rrr __anext__szAsyncIterator.__anext__cC|Srrr3rrrr`zAsyncIterator.__aiter__cC|tur t|ddStS)Nrer`)r r/r)r8rrrr: zAsyncIterator.__subclasshook__N) r<r=r>r?rrer`r@r:rrrrr  r c@FeZdZdZddZeddZed ddZd d Ze d d Z dS)r rcs|dIdHS)zpReturn the next item from the asynchronous generator. When exhausted, raise StopAsyncIteration. N)asendr3rrrreszAsyncGenerator.__anext__crb)zuSend a value into the asynchronous generator. Return next yielded value or raise StopAsyncIteration. rcrKrrrrlszAsyncGenerator.asendNcs2|dur|dur ||}|dur||}|)zyRaise an exception in the asynchronous generator. Return next yielded value or raise StopAsyncIteration. NrPrRrrrathrows zAsyncGenerator.athrowc s6z |tIdHWtdttfyYdSw)rYNz,asynchronous generator ignored GeneratorExit)rmr[rdr\r3rrracloseszAsyncGenerator.aclosecC|tur t|dddddStS)Nr`rerlrmrn)r r/r)r8rrrr: zAsyncGenerator.__subclasshook__r_) r<r=r>r?rerrlrmrnr@r:rrrrr     r c@rC)rrccdSrrr3rrr__iter__zIterable.__iter__cCr7)Nrs)rr/r)r8rrrr:r;zIterable.__subclasshook__N) r<r=r>r?rrsr@r:rErFrrrrrs   rc@ra) rrcCrH)zKReturn the next item from the iterator. When exhausted, raise StopIterationrIr3rrr__next__zIterator.__next__cCrfrrr3rrrrsrgzIterator.__iter__cCrh)Nrsru)rr/r)r8rrrr:rizIterator.__subclasshook__N) r<r=r>r?rrursr@r:rrrrrrjrc@r0)rrccrrrrr3rrr __reversed__6rtzReversible.__reversed__cCrh)Nrwrs)rr/r)r8rrrr:;rizReversible.__subclasshook__N)r<r=r>r?rrwr@r:rrrrr2s  rc@rk)rrcCs |dS)z^Return the next item from the generator. When exhausted, raise StopIteration. N)rMr3rrrruFs zGenerator.__next__cCrH)zcSend a value into the generator. Return next yielded value or raise StopIteration. rIrKrrrrMLrNzGenerator.sendNcCrO)zgRaise an exception in the generator. Return next yielded value or raise StopIteration. NrPrRrrrrVSrWzGenerator.throwc CrX)z.Raise GeneratorExit inside generator. zgenerator ignored GeneratorExitNrZr3rrrr]`r^zGenerator.closecCro)NrsrurMrVr])rr/r)r8rrrr:jrpzGenerator.__subclasshook__r_) r<r=r>r?rurrMrVr]r@r:rrrrrBrqrc@r0)rrcCr1r2rr3rrr__len__yr6z Sized.__len__cCr7)Nrx)rr/r)r8rrrr:}r;zSized.__subclasshook__N)r<r=r>r?rrxr@r:rrrrrurArc@rC)rrcCr1NFr)r4xrrr __contains__r6zContainer.__contains__cCr7)Nr{)rr/r)r8rrrr:r;zContainer.__subclasshook__N) r<r=r>r?rr{r@r:rErFrrrrrrGrc@seZdZdZeddZdS)rrcCs|tur t|dddStS)Nrxrsr{)rr/r)r8rrrr:szCollection.__subclasshook__N)r<r=r>r?r@r:rrrrrsrcsLeZdZdZdZfddZeddZfddZd d Z d d Z Z S) _CallableGenericAliasz Represent `Callable[argtypes, resulttype]`. This sets ``__args__`` to a tuple containing the flattened ``argtypes`` followed by ``resulttype``. Example: ``Callable[[int, str], float]`` sets ``__args__`` to ``(int, str, float)``. rcsft|tr t|dkstd|\}}t|tr g||R}n t|s+td|t|||S)Nz6Callable must be used as Callable[[arg, ...], result].FExpected a list of types, an ellipsis, ParamSpec, or Concatenate. Got ) isinstancetuplelen TypeErrorlist_is_param_exprsuper__new__)r9originargst_argst_result __class__rrrs z_CallableGenericAlias.__new__cCsjg}|jD](}t|trt|tsqt|dr$t|jtr$||jqt|r-| |qtt |S)N__parameters__) __args__rtyperEhasattrrrextend_is_typevarlikeappenddictfromkeys)r4paramsargrrrrs  z$_CallableGenericAlias.__parameters__cs\t|jdkrt|jdrtSdddd|jddDdt|jdd S) Nr}rzcollections.abc.Callable[[z, cSsg|]}t|qSr) _type_repr).0arrr sz2_CallableGenericAlias.__repr__..z], ])rrrr__repr__joinrr3rrrrs  z_CallableGenericAlias.__repr__cCsB|j}t|dkrt|dst|dd|df}tt|ffS)Nr}rr)rrrrr|r)r4rrrr __reduce__s z _CallableGenericAlias.__reduce__c st|j}|dkrt|dt|ts|f}|dkr0t|jdr0|r0t|ds0t|f}t|}||krNtd||kr@dndd|d|d |tt|j|g}|j D]^}t|t rmt|t sm| |q[t |rt|r|}t|std |n$|}nt|d rt|jtr|j}|rtfd d |D}||}t|tr||q[| |q[t|dts|d}|dd} | |f}ttt|S)Nrz is not a generic classr"zToo manyfewz arguments for z ; actual z , expected r~rc3s|]}|VqdSrr)rrzsubstrr sz4_CallableGenericAlias.__getitem__..r)rrrrrrrrziprrrErrrrr|r) r4item param_lenitem_lennew_argsr subparamssubargsrrrrr __getitem__s`           z!_CallableGenericAlias.__getitem__) r<r=r>__doc__r?rpropertyrrrr __classcell__rrrrr|s   r|cCst|}|jdko |jdvS)Ntyping> ParamSpecTypeVar)rr=r<)robjrrrr s rcsFturdSttr dStd}jdko"tfdd|DS)z|Checks if obj matches either a list of types, ``...``, ``ParamSpec`` or ``_ConcatenateGenericAlias`` from typing.py T)r_ConcatenateGenericAliasrc3s|]}j|kVqdSr)r<)rnamerrrrsz!_is_param_expr..)Ellipsisrrrr=any)rnamesrrrrs  rcCsbt|tr t|St|tr|jdkr|jS|jd|jS|tur%dSt|tr-|jSt|S)zReturn the repr() of an object, special-casing types (internal helper). Copied from :mod:`typing` since collections.abc shouldn't depend on that module. builtins.z...) rrEreprrr=r>r FunctionTyper<rrrrrs    rc@rC)rrcOr1ryr)r4rkwdsrrr__call__2r6zCallable.__call__cCr7)Nr)rr/r)r8rrrr:6r;zCallable.__subclasshook__N) r<r=r>r?rrr@r:r|rFrrrrr.rGrc@seZdZdZdZddZddZddZd d Zd d Z e d dZ ddZ e Z ddZddZeZddZddZddZeZddZdS)raZA set is a finite, iterable container. This class provides concrete generic implementations of all methods except for __contains__, __iter__ and __len__. To override the comparisons (presumably for speed, as the semantics are fixed), redefine __le__ and __ge__, then the other operations will automatically follow suit. rcCs>t|tstSt|t|krdS|D] }||vrdSqdSNFTrrr)rr4otherelemrrr__le__O z Set.__le__cCs(t|tstSt|t|ko||Srrrr)rrr4rrrr__lt__Y z Set.__lt__cCs(t|tstSt|t|ko||Sr)rrr)r__ge__rrrr__gt__^rz Set.__gt__cCs>t|tstSt|t|krdS|D] }||vrdSqdSrrrrrrrcrz Set.__ge__cCs(t|tstSt|t|ko||Srrrrrr__eq__mrz Set.__eq__cCs||S)zConstruct an instance of the class from any iterable input. Must override this method if the class constructor signature does not accept an iterable for an input. rr9itrrr_from_iterablerszSet._from_iterablecs&t|tstSfdd|DS)Nc3s|] }|vr|VqdSrrrrLr3rrr~szSet.__and__..rrr)rrrr3r__and__{ z Set.__and__cCs|D] }||vr dSqdS)z1Return True if two sets have a null intersection.FTr)r4rrLrrr isdisjoints zSet.isdisjointcCs*t|tstSdd||fD}||S)Ncss|] }|D]}|VqqdSrr)rserrrrszSet.__or__..r)r4rchainrrr__or__s  z Set.__or__cs:ttstts tS||fdd|DS)Nc3|] }|vr|VqdSrrrrrrr zSet.__sub__..rrrr)rrrrr__sub__   z Set.__sub__cs:t|tst|ts tS|}fdd|DS)Nc3rrrrr3rrrrzSet.__rsub__..rrrr3r__rsub__rz Set.__rsub__cCs2t|tst|ts tS||}||||BSrrrrrr__xor__s   z Set.__xor__cCstj}d|d}t|}d|d}||M}|D]}t|}|||d>AdAdN}||M}q||d?|d?AN}|d d }||M}||krN||d8}|d krTd }|S) a+Compute the hash value of a set. Note that we don't define __hash__: not all sets are hashable. But if you define a hashable set type, its __hash__ should call this function. This must be compatible __eq__. All sets ought to compare equal if they contain the same elements, regardless of how they are implemented, and regardless of the order of the elements; so there's not much freedom for __eq__ or __hash__. We match the algorithm used by the built-in frozenset type. r}r"iMriM[l4~2 i i6ri8#)sysmaxsizerhash)r4MAXMASKnhrzhxrrr_hashs"     z Set._hashN)r<r=r>rr?rrrrrr@rr__rand__rr__ror__rrr__rxor__rrrrrrBs(     rc@sdeZdZdZdZeddZeddZddZd d Z d d Z d dZ ddZ ddZ ddZdS)raA mutable set is a finite, iterable container. This class provides concrete generic implementations of all methods except for __contains__, __iter__, __len__, add(), and discard(). To override the comparisons (presumably for speed, as the semantics are fixed), all you have to do is redefine __le__ and then the other operations will automatically follow suit. rcCrH)zAdd an element.NotImplementedErrorrKrrraddrvzMutableSet.addcCrH)z8Remove an element. Do not raise an exception if absent.rrKrrrdiscardrvzMutableSet.discardcCs||vrt|||dS)z5Remove an element. If not a member, raise a KeyError.N)KeyErrorrrKrrrremoveszMutableSet.removecCs8t|}zt|}Wn tytdw|||S)z2Return the popped value. Raise KeyError if empty.N)iternextrJrrr4rrLrrrpops   zMutableSet.popcC"z |qtyYdSw)z6This is slow (creates N new iterators!) but effective.TN)rrr3rrrclear zMutableSet.clearcCs|D]}||q|Sr)rrrrr__ior__s zMutableSet.__ior__cCs||D]}||q|Sr)rrrrr__iand__s  zMutableSet.__iand__cCsT||ur ||St|ts||}|D]}||vr"||q||q|Sr)rrrrrrrrrr__ixor__ s   zMutableSet.__ixor__cCs,||ur ||S|D]}||q |Sr)rrrrrr__isub__s  zMutableSet.__isub__N)r<r=r>rr?rrrrrrrrrrrrrrrs     rc@sZeZdZdZdZdZeddZdddZd d Z d d Z d dZ ddZ ddZ dZdS)rzA Mapping is a generic container for associating key/value pairs. This class provides concrete generic implementations of all methods except for __getitem__, __iter__, and __len__. r@cCrHrrr4keyrrrr1r6zMapping.__getitem__NcCs"z||WSty|YSw)z D[k] if k in D, else d. d defaults to None.rr4rdefaultrrrget5s   z Mapping.getcCs$z||WdStyYdSwrrrrrrr{<s   zMapping.__contains__cCt|S)z:D.keys() -> a set-like object providing a view on D's keys)rr3rrrkeysDz Mapping.keyscCr )z a set-like object providing a view on D's items)rr3rrritemsHr z Mapping.itemscCr )z6D.values() -> an object providing a view on D's values)rr3rrrvaluesLr zMapping.valuescCs&t|tstSt|t|kSr)rrr)rr rrrrrPrzMapping.__eq__r)r<r=r>rr?__abc_tpflags__rrr r{r r rrrwrrrrr$s  rc@s0eZdZdZddZddZddZeeZ dS) r_mappingcCs ||_dSrr)r4mappingrrr__init__^ zMappingView.__init__cCs t|jSr)rrr3rrrrxarzMappingView.__len__cCs d|S)Nz&{0.__class__.__name__}({0._mapping!r}))formatr3rrrrdrzMappingView.__repr__N) r<r=r>r?rrxrr@rErFrrrrrZs  rc@,eZdZdZeddZddZddZdS) rrcCt|Srsetrrrrrnr zKeysView._from_iterablecCs ||jvSrrrrrrr{rrzKeysView.__contains__ccs|jEdHdSrrr3rrrrsuszKeysView.__iter__Nr<r=r>r?r@rr{rsrrrrrjs   rc@r) rrcCrrrrrrrrr zItemsView._from_iterablecCs<|\}}z|j|}Wn tyYdSw||up||kSry)rr)r4rrrLvrrrr{s zItemsView.__contains__ccs"|jD] }||j|fVqdSrrrrrrrss zItemsView.__iter__Nrrrrrr|s   rc@s eZdZdZddZddZdS)rrcCs0|jD]}|j|}||us||krdSqdSNTFr)r4rLrrrrrr{s  zValuesView.__contains__ccs|jD]}|j|VqdSrrrrrrrss zValuesView.__iter__N)r<r=r>r?r{rsrrrrrs rc@sbeZdZdZdZeddZeddZeZ e fddZ d d Z d d Z dd dZ dddZdS)rzA MutableMapping is a generic container for associating key/value pairs. This class provides concrete generic implementations of all methods except for __getitem__, __setitem__, __delitem__, __iter__, and __len__. rcCrHrrr4rrLrrr __setitem__r6zMutableMapping.__setitem__cCrHrrrrrr __delitem__r6zMutableMapping.__delitem__cCs:z||}Wnty||jur|YSw||=|S)zD.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. )r_MutableMapping__marker)r4rrrLrrrrs   zMutableMapping.popcCs<ztt|}Wn tytdw||}||=||fS)zD.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty. N)rrrJrrrrrpopitems zMutableMapping.popitemcCr)z,D.clear() -> None. Remove all items from D.TN)r!rr3rrrrrzMutableMapping.clearcKs|t|tr|D]}||||<qnt|dr$|D]}||||<qn |D]\}}|||<q&|D]\}}|||<q3dS)aK D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v r N)rrrr r )r4rrrrLrrrupdates      zMutableMapping.updateNcCs(z||WSty|||<Y|Sw)z@D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in Drrrrr setdefaults    zMutableMapping.setdefault)rr)r<r=r>rr?rrrobjectr rr!rr"r#rrrrrs    rc@sNeZdZdZdZdZeddZddZdd Z d d Z dddZ ddZ d S)rzAll the operations on a read-only sequence. Concrete subclasses must override __new__ or __init__, __getitem__, and __len__. r cCrHr IndexErrorr4indexrrrr r6zSequence.__getitem__ccs6d}z ||}|V|d7}qtyYdSw)NrTr"r&)r4irrrrrss zSequence.__iter__cCs$|D] }||us ||krdSqdSrr)r4rLrrrrr{s zSequence.__contains__ccs&ttt|D]}||Vq dSr)reversedranger)r4r*rrrrws zSequence.__reversed__rNcCs|dur|dkrtt||d}|dur|dkr|t|7}|}|dus)||krQz||}||us6||kr9|WSWn tyDYtw|d7}|dus)||ks)t)zS.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present. Supporting start and stop arguments is optional, but recommended. Nrr")maxrr' ValueError)r4rLstartstopr*rrrrr)#s$  zSequence.indexcstfdd|DS)zBS.count(value) -> integer -- return number of occurrences of valuec3s$|] }|us |krdVqdS)r"Nr)rrrLrrr<s"z!Sequence.count..)sumrKrr1rcount:szSequence.count)rN) r<r=r>rr?rrrrsr{rwr)r3rrrrrs    rc@seZdZdZdZdS)r zMThis unifies bytes and bytearray. XXX Should add all their methods. rN)r<r=r>rr?rrrrr Dsr c@sreZdZdZdZeddZeddZeddZd d Z d d Z d dZ ddZ dddZ ddZddZdS)rzAll the operations on a read-write sequence. Concrete subclasses must provide __new__ or __init__, __getitem__, __setitem__, __delitem__, __len__, and insert(). rcCrHrr&r4r)rLrrrrYr6zMutableSequence.__setitem__cCrHrr&r(rrrr]r6zMutableSequence.__delitem__cCrH)z3S.insert(index, value) -- insert value before indexr&r4rrrinsertarvzMutableSequence.insertcCs|t||dS)z:S.append(value) -- append value to the end of the sequenceN)r5rrKrrrrfszMutableSequence.appendcCr)z,S.clear() -> None -- remove all items from STN)rr'r3rrrrjrzMutableSequence.clearcCsHt|}t|dD]}|||d||||<|||d<q dS)z!S.reverse() -- reverse *IN PLACE*r}r"N)rr,)r4rr*rrrreversers,zMutableSequence.reversecCs(||urt|}|D]}||q dS)zMS.extend(iterable) -- extend sequence by appending elements from the iterableN)rr)r4rrrrrrxs  zMutableSequence.extendrcCs||}||=|S)zS.pop([index]) -> item -- remove and return item at index (default last). Raise IndexError if list is empty or index is out of range. r)r4r)rrrrrszMutableSequence.popcCs|||=dS)zvS.remove(value) -- remove first occurrence of value. Raise ValueError if the value is not present. N)r)rKrrrrszMutableSequence.removecCs|||Sr)r)r4rrrr__iadd__s zMutableSequence.__iadd__N)r)r<r=r>rr?rrrr5rrr6rrrr7rrrrrPs      r)TrabcrrrrrintrE EllipsisTyperr__all__r<rbytes_iterator bytearraybytearray_iteratorr dict_keyiteratorrdict_valueiteratorr dict_itemiterator list_iteratorr+list_reverseiteratorr,range_iteratorlongrange_iteratorr set_iterator str_iteratortuple_iteratorr zip_iterator dict_keys dict_values dict_itemsr( mappingproxy generatorr% coroutiner]r&async_generatorr/r rr registerr r r rrrrrrrr|rrrrr frozensetrrrrrrrrrrstr memoryviewr bytesrrrrrs           ) 0              0 i   P 3    R ?      B