edZdZddlmZddlmZGddej ZGddejeZ Gd d eje Z Gd d e Z Gd deZ Gdde ZGdde eZy)a Sequence Interfaces Importing this module does *not* mark any standard classes as implementing any of these interfaces. While this module is not deprecated, new code should generally use :mod:`zope.interface.common.collections`, specifically :class:`~zope.interface.common.collections.ISequence` and :class:`~zope.interface.common.collections.IMutableSequence`. This module is occasionally useful for its fine-grained breakdown of interfaces. The standard library :class:`list`, :class:`tuple` and :class:`collections.UserList`, among others, implement ``ISequence`` or ``IMutableSequence`` but *do not* implement any of the interfaces in this module. restructuredtext) Interface) collectionsceZdZdZdZy)IMinimalSequenceaMost basic sequence interface. All sequences are iterable. This requires at least one of the following: - a `__getitem__()` method that takes a single argument; integer values starting at 0 must be supported, and `IndexError` should be raised for the first index for which there is no value, or - an `__iter__()` method that returns an iterator as defined in the Python documentation (http://docs.python.org/lib/typeiter.html). cy)z``x.__getitem__(index) <==> x[index]`` Declaring this interface does not specify whether `__getitem__` supports slice objects.Nindexs @/usr/lib/python3/dist-packages/zope/interface/common/sequence.py __getitem__zIMinimalSequence.__getitem__3N)__name__ __module__ __qualname____doc__r r rr rr$s  #rrceZdZdZy)IFiniteSequencez[ A sequence of bound size. .. versionchanged:: 5.0.0 Extend ``ISized`` Nrrrrr rr rr9srrcLeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z y ) IReadSequencea. read interface shared by tuple and list This interface is similar to :class:`~zope.interface.common.collections.ISequence`, but requires that all instances be totally ordered. Most users should prefer ``ISequence``. .. versionchanged:: 5.0.0 Extend ``IContainer`` cy)z'``x.__contains__(item) <==> item in x``Nr items r __contains__zIReadSequence.__contains__Nrrcy)z"``x.__lt__(other) <==> x < other``Nr others r __lt__zIReadSequence.__lt__Rrrcy)z#``x.__le__(other) <==> x <= other``Nr rs r __le__zIReadSequence.__le__Urrcy)z#``x.__eq__(other) <==> x == other``Nr rs r __eq__zIReadSequence.__eq__Xrrcy)z#``x.__ne__(other) <==> x != other``Nr rs r __ne__zIReadSequence.__ne__[rrcy)z"``x.__gt__(other) <==> x > other``Nr rs r __gt__zIReadSequence.__gt__^rrcy)z#``x.__ge__(other) <==> x >= other``Nr rs r __ge__zIReadSequence.__ge__arrcy)z#``x.__add__(other) <==> x + other``Nr rs r __add__zIReadSequence.__add__drrcy)z``x.__mul__(n) <==> x * n``Nr ns r __mul__zIReadSequence.__mul__grrcy)z``x.__rmul__(n) <==> n * x``Nr r.s r __rmul__zIReadSequence.__rmul__jrrN)rrrrrr r"r$r&r(r*r,r0r2r rr rrAs9 61222122*+rrceZdZdZdZdZy)IExtendedReadSequencezFull read interface for listscy)z%Return number of occurrences of valueNr rs r countzIExtendedReadSequence.countqrrcy)zTindex(value, [start, [stop]]) -> int Return first index of *value* Nr )rargss r r zIExtendedReadSequence.indextrrN)rrrrr6r r rr r4r4ns'4 rr4cPeZdZdZdZdZdZdZdZd dZ dZ d Z dd Z d Z y )IUniqueMemberWriteSequencezAThe write contract for a sequence that may enforce unique memberscy)z``x.__setitem__(index, item) <==> x[index] = item`` Declaring this interface does not specify whether `__setitem__` supports slice objects. Nr r rs r __setitem__z&IUniqueMemberWriteSequence.__setitem__}rrcy)z``x.__delitem__(index) <==> del x[index]`` Declaring this interface does not specify whether `__delitem__` supports slice objects. Nr r s r __delitem__z&IUniqueMemberWriteSequence.__delitem__rrcy)z``x.__iadd__(y) <==> x += y``Nr )ys r __iadd__z#IUniqueMemberWriteSequence.__iadd__rrcy)zAppend item to endNr rs r appendz!IUniqueMemberWriteSequence.appendrrcy)zInsert item before indexNr r<s r insertz!IUniqueMemberWriteSequence.insertrrcy)z.Remove and return item at index (default last)Nr r s r popzIUniqueMemberWriteSequence.poprrcy)z Remove first occurrence of valueNr rs r removez!IUniqueMemberWriteSequence.removerrcy)zReverse *IN PLACE*Nr r rr reversez"IUniqueMemberWriteSequence.reverserrNcy)z3Stable sort *IN PLACE*; `cmpfunc(x, y)` -> -1, 0, 1Nr )cmpfuncs r sortzIUniqueMemberWriteSequence.sortrrcy)z3Extend list by appending elements from the iterableNr )iterables r extendz!IUniqueMemberWriteSequence.extendrr))N)rrrrr=r?rBrDrFrHrJrLrOrRr rr r:r:zs9K  ,!'=/!BBrr:ceZdZdZdZy)IWriteSequencez!Full write contract for sequencescy)z``x.__imul__(n) <==> x *= n``Nr r.s r __imul__zIWriteSequence.__imul__rrN)rrrrrWr rr rUrUs +,rrUceZdZdZy) ISequencea Full sequence contract. New code should prefer :class:`~zope.interface.common.collections.IMutableSequence`. Compared to that interface, which is implemented by :class:`list` (:class:`~zope.interface.common.builtins.IList`), among others, this interface is missing the following methods: - clear - count - index This interface adds the following methods: - sort Nrr rr rYrYsrrYN)r __docformat__zope.interfacerzope.interface.commonr IIterablerISizedr IContainerrr4r:rUrYr rr r`s$# $-#{,,#*k((*:*+K**O*+Z  M  'B'BR,/,  ~r