ensure_tuple#
- composer.utils.ensure_tuple(x)[source]#
Converts
x
into a tuple.If
x
isNone
, thentuple()
is returned.If
x
is a tuple, thenx
is returned as-is.If
x
is a list, thentuple(x)
is returned.If
x
is a dict, thentuple(v for v in x.values())
is returned.
Otherwise, a single element tuple of
(x,)
is returned.- Parameters
x (Any) โ The input to convert into a tuple.
- Returns
tuple โ A tuple of
x
.