summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2016-01-21 15:07:20 +0100
committerJan Pokorný <jpokorny@redhat.com>2016-02-01 23:53:26 +0100
commite808b34b7040d4d81d423c287c51413253aad90e (patch)
treeb17d05c6feeb79c513a0ce7e209fe3b9f6abdf56
parent183bc49963df6b228f022a46084698214b38771a (diff)
downloadclufter-e808b34b7040d4d81d423c287c51413253aad90e.tar.gz
clufter-e808b34b7040d4d81d423c287c51413253aad90e.tar.xz
clufter-e808b34b7040d4d81d423c287c51413253aad90e.zip
utils: new helper areinstancesupto (akin to areinstances)
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--utils.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils.py b/utils.py
index 7bc36f9..4bb694a 100644
--- a/utils.py
+++ b/utils.py
@@ -117,6 +117,9 @@ def areinstances(obj1, obj2):
return isinstance(obj1, obj2.__class__) or isinstance(obj2, obj1.__class__)
+def areinstancesupto(obj1, obj2, *exc):
+ return isinstanceupto(obj1, obj2.__class__, *exc) \
+ or isinstanceupto(obj2, obj1.__class__, *exc)
def popattr(obj, what, *args):