a DOgr@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?Gd5d6d6edZ@Gd7d8d8e=ZAeA3eBGd9d:d:eAZCeC3eGd;d<dd>e;ZEGd?d@d@eEeAZFeF3e$GdAdBdBeEeAZGeG3e&GdCdDdDeEe=ZHeH3e%GdEdFdFeDZIeI3eJGdGdHdHe9e=ZKeK3eLeK3eMeK3eeK3eNGdIdJdJeKZOeO3ePeO3eGdKdLdLeKZQeQ3eeQ3edS)MzjAbstract Base Classes (ABCs) for collections, according to PEP 3119. Unit tests are in test_collections. )ABCMetaabstractmethodN.cCsdSNrrr5/opt/alt/python39/lib64/python3.9/_collections_abc.py_fr) Awaitable Coroutine AsyncIterable AsyncIteratorAsyncGeneratorHashableIterableIterator Generator ReversibleSized ContainerCallable CollectionSet MutableSetMappingMutableMapping MappingViewKeysView ItemsView ValuesViewSequenceMutableSequence ByteStringzcollections.abcrirccsdVSrrrrrr>rr$csdSrrrrrr_coro@rr%cCs dVdSrrrrrr_agFrr&cGsN|j}|D]>}|D],}||jvr|j|dur:tSq qtSq dS)NT)__mro____dict__NotImplemented)CmethodsmromethodBrrr_check_methodsNs   r/c@s(eZdZdZeddZeddZdS)rrcCsdSNrrselfrrr__hash__^szHashable.__hash__cCs|turt|dStS)Nr3)rr/r)clsr*rrr__subclasshook__bs zHashable.__subclasshook__N)__name__ __module__ __qualname__ __slots__rr3 classmethodr6rrrrrZs  r) metaclassc@s0eZdZdZeddZeddZeeZ dS)r rccs dVdSrrr1rrr __await__mszAwaitable.__await__cCs|turt|dStS)Nr=)r r/r)r4rrrr6qs zAwaitable.__subclasshook__N) r7r8r9r:rr=r;r6 GenericAlias__class_getitem__rrrrr is   r c@s>eZdZdZeddZed ddZddZed d Z dS) r rcCstdS)zcSend a value into the coroutine. Return next yielded value or raise StopIteration. N StopIterationr2valuerrrsend~szCoroutine.sendNcCs4|dur|dur||}|dur,||}|dS)zgRaise an exception in the coroutine. Return next yielded value or raise StopIteration. Nwith_tracebackr2typvaltbrrrthrows zCoroutine.throwc Cs2z|tWnttfy$Yn 0tddS).Raise GeneratorExit inside coroutine. zcoroutine ignored GeneratorExitNrK GeneratorExitrA RuntimeErrorr1rrrcloses zCoroutine.closecCs|turt|ddddStS)Nr=rDrKrP)r r/r)r4rrrr6szCoroutine.__subclasshook__)NN) r7r8r9r:rrDrKrPr;r6rrrrr zs   r c@s0eZdZdZeddZeddZeeZ dS)r rcCstSr)r r1rrr __aiter__szAsyncIterable.__aiter__cCs|turt|dStS)NrQ)r r/r)r4rrrr6s zAsyncIterable.__subclasshook__N) r7r8r9r:rrQr;r6r>r?rrrrr s   r c@s0eZdZdZeddZddZeddZdS) r rcstdS)z@Return the next item or raise StopAsyncIteration when exhausted.NStopAsyncIterationr1rrr __anext__szAsyncIterator.__anext__cCs|Srrr1rrrrQszAsyncIterator.__aiter__cCs|turt|ddStS)NrTrQ)r r/r)r4rrrr6s zAsyncIterator.__subclasshook__N) r7r8r9r:rrTrQr;r6rrrrr s  r c@sFeZdZdZddZeddZed ddZd d Ze d d Z dS)r rcs|dIdHS)zpReturn the next item from the asynchronous generator. When exhausted, raise StopAsyncIteration. N)asendr1rrrrTszAsyncGenerator.__anext__cstdS)zuSend a value into the asynchronous generator. Return next yielded value or raise StopAsyncIteration. NrRrBrrrrUszAsyncGenerator.asendNcs4|dur|dur||}|dur,||}|dS)zyRaise an exception in the asynchronous generator. Return next yielded value or raise StopAsyncIteration. NrErGrrrathrows zAsyncGenerator.athrowc s8z|tIdHWnttfy*Yn 0tddS)rLNz,asynchronous generator ignored GeneratorExit)rVrNrSrOr1rrracloses zAsyncGenerator.aclosecCs|turt|dddddStS)NrQrTrUrVrW)r r/r)r4rrrr6s zAsyncGenerator.__subclasshook__)NN) r7r8r9r:rTrrUrVrWr;r6rrrrr s   r c@s0eZdZdZeddZeddZeeZ dS)rrccsdSrrr1rrr__iter__szIterable.__iter__cCs|turt|dStS)NrX)rr/r)r4rrrr6s zIterable.__subclasshook__N) r7r8r9r:rrXr;r6r>r?rrrrrs   rc@s0eZdZdZeddZddZeddZdS) rrcCstdS)zKReturn the next item from the iterator. When exhausted, raise StopIterationNr@r1rrr__next__szIterator.__next__cCs|Srrr1rrrrXszIterator.__iter__cCs|turt|ddStS)NrXrY)rr/r)r4rrrr6s zIterator.__subclasshook__N) r7r8r9r:rrYrXr;r6rrrrrs  rc@s(eZdZdZeddZeddZdS)rrccsdSrrr1rrr __reversed__6szReversible.__reversed__cCs|turt|ddStS)NrZrX)rr/r)r4rrrr6;s zReversible.__subclasshook__N)r7r8r9r:rrZr;r6rrrrr2s  rc@sFeZdZdZddZeddZed ddZd d Ze d d Z dS)rrcCs |dS)z^Return the next item from the generator. When exhausted, raise StopIteration. N)rDr1rrrrYFszGenerator.__next__cCstdS)zcSend a value into the generator. Return next yielded value or raise StopIteration. Nr@rBrrrrDLszGenerator.sendNcCs4|dur|dur||}|dur,||}|dS)zgRaise an exception in the generator. Return next yielded value or raise StopIteration. NrErGrrrrKSs zGenerator.throwc Cs2z|tWnttfy$Yn 0tddS)z.Raise GeneratorExit inside generator. zgenerator ignored GeneratorExitNrMr1rrrrP`s zGenerator.closecCs|turt|dddddStS)NrXrYrDrKrP)rr/r)r4rrrr6js zGenerator.__subclasshook__)NN) r7r8r9r:rYrrDrKrPr;r6rrrrrBs   rc@s(eZdZdZeddZeddZdS)rrcCsdSr0rr1rrr__len__ysz Sized.__len__cCs|turt|dStS)Nr[)rr/r)r4rrrr6}s zSized.__subclasshook__N)r7r8r9r:rr[r;r6rrrrrus  rc@s0eZdZdZeddZeddZeeZ dS)rrcCsdSNFr)r2xrrr __contains__szContainer.__contains__cCs|turt|dStS)Nr^)rr/r)r4rrrr6s zContainer.__subclasshook__N) r7r8r9r:rr^r;r6r>r?rrrrrs   rc@seZdZdZeddZdS)rrcCs|turt|dddStS)Nr[rXr^)rr/r)r4rrrr6szCollection.__subclasshook__N)r7r8r9r:r;r6rrrrrsrcsPeZdZdZdZddZefddZfddZd d Z fd 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)``. rc Cs`z|||WStyZ}z4ddl}|t|dtt||WYd}~Sd}~00dS)Nrz. (This will raise a TypeError in Python 3.10.)) _CallableGenericAlias__create_ga TypeErrorwarningswarnstrDeprecationWarningr>)r5originargsexcrbrrr__new__sz_CallableGenericAlias.__new__csXt|trt|dkrtd|\}}t|ttfrDt||f}n|}t|||S)Nz6Callable must be used as Callable[[arg, ...], result].) isinstancetuplelenralistsuperri)r5rfrgt_argst_resultga_args __class__rr __create_gasz!_CallableGenericAlias.__create_gacs\t|jdkr&|jdtur&tSdddd|jddDdt|jdd S) Nrjrzcollections.abc.Callable[[z, cSsg|] }t|qSr) _type_repr).0arrr rz2_CallableGenericAlias.__repr__..z], ])rm__args__Ellipsisro__repr__joinrvr1rsrrr~s  z_CallableGenericAlias.__repr__cCsB|j}t|dkr|dtus6t|dd|df}tt|ffS)Nrjrrz)r|rmr}rnr_r)r2rgrrr __reduce__sz _CallableGenericAlias.__reduce__cs8t|}|j}|d}|dd}||f}tt|S)Nrz)ro __getitem__r|r_r)r2itemgargrqrprsrrrs   z!_CallableGenericAlias.__getitem__) r7r8r9__doc__r:rir;r`r~rr __classcell__rrrsrr_s   r_cCsbt|trt|St|tr>|jdkr,|jS|jd|jS|turJdSt|trZ|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...) rkr>reprtyper8r9r} FunctionTyper7)objrrrrvs    rvc@s0eZdZdZeddZeddZeeZ dS)rrcOsdSr\r)r2rgkwdsrrr__call__szCallable.__call__cCs|turt|dStS)Nr)rr/r)r4rrrr6s zCallable.__subclasshook__N) r7r8r9r:rrr;r6r_r?rrrrrs   rc@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|kr"dS|D]}||vr&dSq&dSNFTrkrr)rmr2otherelemrrr__le__s z Set.__le__cCs(t|tstSt|t|ko&||Srrkrr)rmrr2rrrr__lt__s z Set.__lt__cCs(t|tstSt|t|ko&||Sr)rkrr)rm__ge__rrrr__gt__!s z Set.__gt__cCs>t|tstSt|t|kr"dS|D]}||vr&dSq&dSrrrrrrr&s z Set.__ge__cCs(t|tstSt|t|ko&||Srrrrrr__eq__0s z 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. rr5itrrr_from_iterable5szSet._from_iterablecs&t|tstSfdd|DS)Nc3s|]}|vr|VqdSrrrwrCr1rr ArzSet.__and__..rkrr)rrrr1r__and__>s z Set.__and__cCs|D]}||vrdSqdS)z1Return True if two sets have a null intersection.FTr)r2rrCrrr isdisjointEszSet.isdisjointcCs*t|tstSdd||fD}||S)Ncss|]}|D] }|Vq qdSrr)rwserrrrOrzSet.__or__..r)r2rchainrrr__or__Ls z Set.__or__cs:tts"ttstS||fdd|DS)Nc3s|]}|vr|VqdSrrrrrrrYszSet.__sub__..rkrrr)rrrrr__sub__Ts    z Set.__sub__cs:t|ts"t|tstS|}fdd|DS)Nc3s|]}|vr|VqdSrrrr1rrraszSet.__rsub__..rrrr1r__rsub__\s    z Set.__rsub__cCs2t|ts"t|tstS||}||||BSrrrrrr__xor__ds    z Set.__xor__cCstj}d|d}t|}d|d}||M}|D],}t|}|||d>AdAdN}||M}q2||d?|d?AN}|d d }||M}||kr||d8}|d krd }|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. rjr"iMriM[l4~2 i i6rzi8#)sysmaxsizermhash)r2MAXMASKnhr]hxrrr_hashms"     z Set._hashN)r7r8r9rr:rrrrrr;rr__rand__rr__ror__rrr__rxor__rrrrrrs&    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. rcCstdS)zAdd an element.NNotImplementedErrorrBrrraddszMutableSet.addcCstdS)z8Remove an element. Do not raise an exception if absent.NrrBrrrdiscardszMutableSet.discardcCs||vrt|||dS)z5Remove an element. If not a member, raise a KeyError.N)KeyErrorrrBrrrremoveszMutableSet.removecCs<t|}z t|}Wnty,tdYn0|||S)z2Return the popped value. Raise KeyError if empty.N)iternextrArrr2rrCrrrpops    zMutableSet.popcCs&z|qWnty Yn0dS)z6This is slow (creates N new iterators!) but effective.N)rrr1rrrclears zMutableSet.clearcCs|D]}||q|Sr)rrrrr__ior__s zMutableSet.__ior__cCs||D]}||q|Sr)rrrrr__iand__s  zMutableSet.__iand__cCsR||ur|n D[k] if k in D, else d. d defaults to None.Nrr2rdefaultrrrgets  z Mapping.getcCs*z ||Wnty YdS0dSdSrrrrrrr^s   zMapping.__contains__cCst|S)z:D.keys() -> a set-like object providing a view on D's keys)rr1rrrkeyssz Mapping.keyscCst|S)z a set-like object providing a view on D's items)rr1rrritems sz Mapping.itemscCst|S)z6D.values() -> an object providing a view on D's values)rr1rrrvaluesszMapping.valuescCs&t|tstSt|t|kSr)rkrr)dictrrrrrrs zMapping.__eq__)N) r7r8r9r:rrrr^rrrrrZrrrrrs   rc@s0eZdZdZddZddZddZeeZ dS) r_mappingcCs ||_dSrr)r2mappingrrr__init__"szMappingView.__init__cCs t|jSr)rmrr1rrrr[%szMappingView.__len__cCs d|S)Nz&{0.__class__.__name__}({0._mapping!r}))formatr1rrrr~(szMappingView.__repr__N) r7r8r9r:rr[r~r;r>r?rrrrrs rc@s,eZdZdZeddZddZddZdS) rrcCst|Srsetrrrrr2szKeysView._from_iterablecCs ||jvSrrrrrrr^6szKeysView.__contains__ccs|jEdHdSrrr1rrrrX9szKeysView.__iter__Nr7r8r9r:r;rr^rXrrrrr.s  rc@s,eZdZdZeddZddZddZdS) rrcCst|SrrrrrrrDszItemsView._from_iterablecCs@|\}}z|j|}Wnty*YdS0||up:||kSdSr\)rr)r2rrrCvrrrr^Hs  zItemsView.__contains__ccs |jD]}||j|fVqdSrrrrrrrXQs zItemsView.__iter__Nrrrrrr@s   rc@s eZdZdZddZddZdS)rrcCs0|jD]$}|j|}||us$||krdSqdSNTFr)r2rCrrrrrr^]s   zValuesView.__contains__ccs|jD]}|j|VqdSrrrrrrrXds zValuesView.__iter__N)r7r8r9r:r^rXrrrrrYsrc@s^eZdZdZeddZeddZeZefddZ dd Z d d Z dd d Z dddZ dS)rrcCstdSrrr2rrCrrr __setitem__yszMutableMapping.__setitem__cCstdSrrrrrr __delitem__}szMutableMapping.__delitem__cCs>z ||}Wn"ty.||jur&|YS0||=|SdS)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. N)r_MutableMapping__marker)r2rrrCrrrrs    zMutableMapping.popcCs@ztt|}Wnty(tdYn0||}||=||fS)zD.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty. N)rrrArrrrrpopitems  zMutableMapping.popitemcCs&z|qWnty Yn0dS)z,D.clear() -> None. Remove all items from D.N)rrr1rrrrs zMutableMapping.clearcKs|t|tr"|D]}||||<qn 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 rN)rkrhasattrrr)r2rrrrCrrrupdates     zMutableMapping.updateNcCs*z ||WSty$|||<Yn0|S)z@D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in Drrrrr setdefaults   zMutableMapping.setdefault)r)N)r7r8r9r:rrrobjectrrrrrrrrrrrls      rc@sJeZdZdZdZeddZddZddZd d Z dd dZ ddZ d S)rzAll the operations on a read-only sequence. Concrete subclasses must override __new__ or __init__, __getitem__, and __len__. rcCstdSr IndexErrorr2indexrrrrszSequence.__getitem__ccs:d}z||}|V|d7}qWnty4YdS0dS)Nrr"r)r2irrrrrXs zSequence.__iter__cCs$|D]}||us||krdSqdSrr)r2rCrrrrr^szSequence.__contains__ccs$ttt|D]}||VqdSr)reversedrangerm)r2rrrrrZszSequence.__reversed__rNcCs|dur"|dkr"tt||d}|dur>|dkr>|t|7}|}|dusR||krz"||}||usl||krr|WSWntyYqYn0|d7}qBtdS)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")maxrmr ValueError)r2rCstartstoprrrrrrs     zSequence.indexcstfdd|DS)zBS.count(value) -> integer -- return number of occurrences of valuec3s"|]}|us|krdVqdS)r"Nr)rwrrCrrrrz!Sequence.count..)sumrBrrrcountszSequence.count)rN) r7r8r9rr:rrrXr^rZrrrrrrrs   rc@seZdZdZdZdS)r!zMThis unifies bytes and bytearray. XXX Should add all their methods. rN)r7r8r9rr:rrrrr! sr!c@sneZdZdZeddZeddZeddZdd Zd d Z d d Z ddZ dddZ ddZ ddZdS)r rcCstdSrrr2rrCrrrr"szMutableSequence.__setitem__cCstdSrrrrrrr&szMutableSequence.__delitem__cCstdS)z3S.insert(index, value) -- insert value before indexNrrrrrinsert*szMutableSequence.insertcCs|t||dS)z:S.append(value) -- append value to the end of the sequenceN)rrmrBrrrappend/szMutableSequence.appendcCs&z|qWnty Yn0dS)z,S.clear() -> None -- remove all items from SN)rrr1rrrr3s zMutableSequence.clearcCsHt|}t|dD].}|||d||||<|||d<qdS)z!S.reverse() -- reverse *IN PLACE*rjr"N)rmr)r2rrrrrreverse;szMutableSequence.reversecCs(||urt|}|D]}||qdS)zMS.extend(iterable) -- extend sequence by appending elements from the iterableN)rnr)r2rrrrrextendAszMutableSequence.extendrzcCs||}||=|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)r2rrrrrrHszMutableSequence.popcCs|||=dS)zvS.remove(value) -- remove first occurrence of value. Raise ValueError if the value is not present. N)rrBrrrrPszMutableSequence.removecCs|||Sr)r)r2rrrr__iadd__Vs zMutableSequence.__iadd__N)rz)r7r8r9r:rrrrrrrrrrrrrrrr s     r )Rrabcrrrrrnintr> EllipsisTyperr__all__r7rbytes_iterator bytearraybytearray_iteratorrdict_keyiteratorrdict_valueiteratorrdict_itemiterator list_iteratorrlist_reverseiteratorrrange_iteratorlongrange_iteratorr set_iterator str_iteratortuple_iteratorzip zip_iterator dict_keys dict_values dict_itemsr( mappingproxy generatorr% coroutinerPr&async_generatorr/rr r registerr r r rrrrrrrr_rvrr frozensetrrrrrrrrrrlrd memoryviewr!bytesr rrrrs          ) 0              0  = P 3    T >      D