MCPcopy Create free account
hub / github.com/rthalley/dnspython / intersection_update

Method intersection_update

dns/set.py:117–130  ·  view source on GitHub ↗

Update the set, removing any elements from other which are not in both sets.

(self, other)

Source from the content-addressed store, hash-verified

115 self.add(item)
116
117 def intersection_update(self, other):
118 """Update the set, removing any elements from other which are not
119 in both sets.
120 """
121
122 if not isinstance(other, Set):
123 raise ValueError("other must be a Set instance")
124 if self is other: # lgtm[py/comparison-using-is]
125 return
126 # we make a copy of the list so that we can remove items from
127 # the list without breaking the iterator.
128 for item in list(self.items):
129 if item not in other.items:
130 del self.items[item]
131
132 def difference_update(self, other):
133 """Update the set, removing any elements from other which are in

Callers 5

__iand__Method · 0.95
intersectionMethod · 0.45
testBadUpdatesMethod · 0.45
testSelfUpdatesMethod · 0.45

Calls

no outgoing calls

Tested by 3

testBadUpdatesMethod · 0.36
testSelfUpdatesMethod · 0.36