Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 537ddf4 commit d854332Copy full SHA for d854332
src/runtime/Mixins/collections.py
@@ -7,7 +7,11 @@
7
8
class IteratorMixin(col.Iterator):
9
def close(self):
10
- self.Dispose()
+ if hasattr(self, 'Dispose'):
11
+ self.Dispose()
12
+ else:
13
+ from System import IDisposable
14
+ IDisposable(self).Dispose()
15
16
class IterableMixin(col.Iterable):
17
pass
@@ -16,7 +20,12 @@ class SizedMixin(col.Sized):
20
def __len__(self): return self.Count
21
18
22
class ContainerMixin(col.Container):
19
- def __contains__(self, item): return self.Contains(item)
23
+ def __contains__(self, item):
24
+ if hasattr('self', 'Contains'):
25
+ return self.Contains(item)
26
27
+ from System.Collections.Generic import ICollection
28
+ return ICollection(self).Contains(item)
29
30
try:
31
abc_Collection = col.Collection
0 commit comments