1 import sets
2 from copy import deepcopy
3
8
10 values=list(self)
11 values.sort()
12 attributes=', '.join([repr(x) for x in values])
13 return '%s(%r, [%s])' % (
14 self.__class__.__name__,
15 self.key,
16 attributes)
17
19 """
20 Note that LDAPAttributeSets can also be compared against any
21 iterator. In that case the attributeType will be ignored.
22 """
23 if isinstance(other, LDAPAttributeSet):
24 if self.key != other.key:
25 return False
26 return super(LDAPAttributeSet, self).__eq__(other)
27 else:
28 me=list(self)
29 me.sort()
30 him=list(other)
31 him.sort()
32 return me == him
33
35 return not self==other
36
38 return sets.Set(self) - sets.Set(other)
39
41 return sets.Set(self) | sets.Set(other)
42
44 return sets.Set(self) & sets.Set(other)
45
47 return sets.Set(self) ^ sets.Set(other)
48
50 result = self.__class__(self.key)
51 result.update(self)
52 return result
53 __copy__ = copy
54
56 result = self.__class__(self.key)
57 memo[id(self)] = result
58 data = deepcopy(sets.Set(self), memo)
59 result.update(data)
60 return result
61