Make it possible to use ContextSet with an iterable parameter
This commit is contained in:
1 parent
ef9d0421fa
commit
bbc6e830e2
1 file changed
+4
@@ -13,6 +13,10 @@ class BaseContext(object):
|
|||||||
|
|
||||||
class BaseContextSet(object):
|
class BaseContextSet(object):
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
|
if len(args) == 1 and hasattr(args[0], '__iter__'):
|
||||||
|
# TODO replace with this everywhere.
|
||||||
|
self._set = frozenset(args[0])
|
||||||
|
return
|
||||||
for arg in args:
|
for arg in args:
|
||||||
assert not isinstance(arg, BaseContextSet)
|
assert not isinstance(arg, BaseContextSet)
|
||||||
self._set = frozenset(args)
|
self._set = frozenset(args)
|
||||||
|
|||||||
Reference in new issue
Block a user