ensure_tuple#
- composer.utils.ensure_tuple(x)[source]#
Converts
xinto a tuple.If
xisNone, thentuple()is returned.If
xis a tuple, thenxis returned as-is.If
xis a list, thentuple(x)is returned.If
xis 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.