An IPSet object represents any set of IP addresses, as
produced by rwsetbuild and related programs. The
IPSet object handles iteration over IP addresses with
for x in set, and iteration over CIDR blocks using
for x in set.cidr_iter().
| [iterable]) |
Other constructors, all class methods:
| path) |
Supported operations:
| Operation | Equivalent | Result | Notes |
|---|---|---|---|
len(s) |
cardinality of IPset s | (1) | |
s.cardinality() |
cardinality of IPset s | ||
addr in s |
test addr for membership in s | (2) | |
addr not in s |
test addr for non-membership in s | (2) | |
s.issubset(t) |
s <= t |
test whether every element in s is in t | (3) |
s.issuperset(t) |
s >= t |
test whether every element in t is in s | (3) |
s.union(t) |
s | t |
new IPset with elements from both s and t | (3) |
s.intersection(t) |
s & t |
new IPset with elements common to s and t | (3) |
s.difference(t) |
s - t |
new IPset with elements in s but not in t | (3) |
s.symmetric_difference(t) |
s ^ t |
new IPset with elements in either s or t but not both | (3) |
s.copy() |
new set with a copy of s | ||
s.update(t) |
s |= t |
update s, adding elements from t | (3) |
s.intersection_update(t) |
s &= t |
update s, keeping only elements found in both s and t | (3) |
s.difference_update(t) |
s -= t |
update s, removing elements found in t | (3) |
s.symmetric_difference_update(t) |
s ^= t |
update s, keeping elements found in s or t but not in both | (3) |
s.add(addr) |
add element addr to IPset s | (2) | |
s.remove(addr) |
remove addr from IPset s; raises KeyError if not present | ||
s.discard(addr) |
removes addr from IPset s if present | ||
s.clear() |
remove all elements from IPset s |
s.cardinality()
instead.
Instance methods:
| ) |
for (addr, prefix) in s.cidr_iter().
| filename) |