mr2.utils.to_tuple
- mr2.utils.to_tuple(length: int, arg: Sequence[T] | T) tuple[T, ...][source]
Standardize an argument to a fixed-length tuple.
If the argument is a sequence, it checks if its length matches the specified dimension. If it’s a single value, it replicates it
dimtimes.- Parameters:
- Returns:
A tuple of length
dimcontaining elements of type T.- Raises:
ValueError – If
argis a sequence and its length does not matchlength.