Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/lxml/html/_setmixin.py @ 2:6af9afd405e9 draft
"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
author | shellac |
---|---|
date | Thu, 14 May 2020 14:56:58 -0400 |
parents | 26e78fe6e8c4 |
children |
comparison
equal
deleted
inserted
replaced
1:75ca89e9b81c | 2:6af9afd405e9 |
---|---|
1 try: | |
2 from collections.abc import MutableSet | |
3 except ImportError: | |
4 from collections import MutableSet | |
5 | |
6 | |
7 class SetMixin(MutableSet): | |
8 | |
9 """ | |
10 Mix-in for sets. You must define __iter__, add, remove | |
11 """ | |
12 | |
13 def __len__(self): | |
14 length = 0 | |
15 for item in self: | |
16 length += 1 | |
17 return length | |
18 | |
19 def __contains__(self, item): | |
20 for has_item in self: | |
21 if item == has_item: | |
22 return True | |
23 return False | |
24 | |
25 issubset = MutableSet.__le__ | |
26 issuperset = MutableSet.__ge__ | |
27 | |
28 union = MutableSet.__or__ | |
29 intersection = MutableSet.__and__ | |
30 difference = MutableSet.__sub__ | |
31 symmetric_difference = MutableSet.__xor__ | |
32 | |
33 def copy(self): | |
34 return set(self) | |
35 | |
36 def update(self, other): | |
37 self |= other | |
38 | |
39 def intersection_update(self, other): | |
40 self &= other | |
41 | |
42 def difference_update(self, other): | |
43 self -= other | |
44 | |
45 def symmetric_difference_update(self, other): | |
46 self ^= other | |
47 | |
48 def discard(self, item): | |
49 try: | |
50 self.remove(item) | |
51 except KeyError: | |
52 pass | |
53 | |
54 @classmethod | |
55 def _from_iterable(cls, it): | |
56 return set(it) |