# HG changeset patch # User Thierry Florac # Date 1381926744 -7200 # Node ID 6c087119379d0003345f79b4df3d37a95f67e1b5 # Parent dabc8ebe131d3d14bcf1b0afd882a69166eb04f8 Added ISet interface diff -r dabc8ebe131d -r 6c087119379d src/ztfy/utils/configure.zcml --- a/src/ztfy/utils/configure.zcml Wed Oct 16 14:31:37 2013 +0200 +++ b/src/ztfy/utils/configure.zcml Wed Oct 16 14:32:24 2013 +0200 @@ -1,6 +1,7 @@ @@ -18,6 +19,18 @@ factory=".schema.DottedDecimalDataConverter" trusted="True" /> + + + + + + diff -r dabc8ebe131d -r 6c087119379d src/ztfy/utils/interfaces.py --- a/src/ztfy/utils/interfaces.py Wed Oct 16 14:31:37 2013 +0200 +++ b/src/ztfy/utils/interfaces.py Wed Oct 16 14:32:24 2013 +0200 @@ -146,6 +146,154 @@ # +# Generic set interfaces +# + +class ISetInfo(Interface): + """Set-like interfaces""" + + def copy(self, *args, **kwargs): + """ Return a shallow copy of a set. """ + + def difference(self, *args, **kwargs): + """Return the difference of two or more sets as a new set""" + + def intersection(self, *args, **kwargs): + """Return the intersection of two or more sets as a new set""" + + def isdisjoint(self, *args, **kwargs): + """ Return True if two sets have a null intersection. """ + + def issubset(self, *args, **kwargs): + """ Report whether another set contains this set. """ + + def issuperset(self, *args, **kwargs): + """ Report whether this set contains another set. """ + + def symmetric_difference(self, *args, **kwargs): + """Return the symmetric difference of two sets as a new set""" + + def union(self, *args, **kwargs): + """Return the union of sets as a new set""" + + def __and__(self, y): + """ x.__and__(y) <==> x&y """ + + def __cmp__(self, y): + """ x.__cmp__(y) <==> cmp(x,y) """ + + def __contains__(self, y): + """ x.__contains__(y) <==> y in x. """ + + def __eq__(self, y): + """ x.__eq__(y) <==> x==y """ + + def __getattribute__(self, name): + """ x.__getattribute__('name') <==> x.name """ + + def __ge__(self, y): + """ x.__ge__(y) <==> x>=y """ + + def __gt__(self, y): + """ x.__gt__(y) <==> x>y """ + + def __hash__(self): + """Compute hash value""" + + def __iter__(self): + """ x.__iter__() <==> iter(x) """ + + def __len__(self): + """ x.__len__() <==> len(x) """ + + def __le__(self, y): # real signature unknown; restored from __doc__ + """ x.__le__(y) <==> x<=y """ + + def __lt__(self, y): # real signature unknown; restored from __doc__ + """ x.__lt__(y) <==> x x!=y """ + + def __or__(self, y): # real signature unknown; restored from __doc__ + """ x.__or__(y) <==> x|y """ + + def __reduce__(self, *args, **kwargs): # real signature unknown + """ Return state information for pickling. """ + + def __repr__(self): # real signature unknown; restored from __doc__ + """ x.__repr__() <==> repr(x) """ + + def __rand__(self, y): + """ x.__rand__(y) <==> y&x """ + + def __ror__(self, y): + """ x.__ror__(y) <==> y|x """ + + def __rsub__(self, y): + """ x.__rsub__(y) <==> y-x """ + + def __rxor__(self, y): + """ x.__rxor__(y) <==> y^x """ + + def __sizeof__(self): + """ S.__sizeof__() -> size of S in memory, in bytes """ + + def __sub__(self, y): + """ x.__sub__(y) <==> x-y """ + + def __xor__(self, y): + """ x.__xor__(y) <==> x^y """ + + +class ISetWriter(Interface): + """Set-like writer interface""" + + def add(self, *args, **kwargs): + """Add an element to set""" + + def clear(self, *args, **kwargs): + """ Remove all elements from this set. """ + + def difference_update(self, *args, **kwargs): + """ Remove all elements of another set from this set. """ + + def discard(self, *args, **kwargs): + """Remove an element from a set if it is a member""" + + def intersection_update(self, *args, **kwargs): + """ Update a set with the intersection of itself and another. """ + + def pop(self, *args, **kwargs): + """Remove and return an arbitrary set element""" + + def remove(self, *args, **kwargs): + """Remove an element from a set; it must be a member""" + + def symmetric_difference_update(self, *args, **kwargs): + """ Update a set with the symmetric difference of itself and another """ + + def update(self, *args, **kwargs): + """ Update a set with the union of itself and others. """ + + def __iand__(self, y): + """ x.__iand__(y) <==> x&=y """ + + def __ior__(self, y): + """ x.__ior__(y) <==> x|=y """ + + def __isub__(self, y): + """ x.__isub__(y) <==> x-=y """ + + def __ixor__(self, y): + """ x.__ixor__(y) <==> x^=y """ + + +class ISet(ISetInfo, ISetWriter): + """Marker interface for set-like components""" + + +# # ZEO connection settings interface #