From e364ef51ed453b0d438ed5a5453179d552c298a1 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sat, 6 Oct 2007 05:46:28 +0000 Subject: Checkpoint svn path=/scripts/rpki/left_right.py; revision=1103 --- scripts/rpki/resource_set.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'scripts/rpki/resource_set.py') diff --git a/scripts/rpki/resource_set.py b/scripts/rpki/resource_set.py index b0de948b..705b0ac7 100644 --- a/scripts/rpki/resource_set.py +++ b/scripts/rpki/resource_set.py @@ -208,6 +208,17 @@ class resource_set(list): assert isinstance(item, (type(i), type(i.min))) return False + def issubset(self, other): + """Test whether self is a subset of other.""" + for i in self: + if not other.contains(i): + return False + return True + + def issuperset(self, other): + """Test whether self is a superset of other.""" + return other.issubset(self) + @classmethod def from_sql(cls, cursor, query): """Create resource set from an SQL query. -- cgit v1.2.3