2 from itertools
import repeat
7 if isinstance(x, container_abcs.Iterable):
9 return tuple(repeat(x, n))
15 _quadruple = _ntuple(4)
18 def _list_with_default(out_size, defaults):
19 if isinstance(out_size, int):
21 if len(defaults) <= len(out_size):
22 raise ValueError(
'Input dimension should be at least {}'.format(len(out_size) + 1))
23 return [v
if v
is not None else d
for v, d
in zip(out_size, defaults[-len(out_size):])]