hpcflow.sdk.core.utils.remap#

hpcflow.sdk.core.utils.remap(lst: list[int], mapping_func: Callable[[Sequence[int]], Sequence[T]]) list[T]#
hpcflow.sdk.core.utils.remap(lst: list[list[int]], mapping_func: Callable[[Sequence[int]], Sequence[T]]) list[list[T]]
hpcflow.sdk.core.utils.remap(lst: list[list[list[int]]], mapping_func: Callable[[Sequence[int]], Sequence[T]]) list[list[list[T]]]

Apply a mapping to a structure of lists with ints (typically indices) as leaves to get a structure of lists with some objects as leaves.

Parameters:
  • lst (list[int] | list[list[int]] | list[list[list[int]]]) – The structure to remap.

  • mapping_func (Callable[[Sequence[int]], Sequence[T]]) – The mapping function from sequences of ints to sequences of objects.

Returns:

Nested list structure in same form as input, with leaves remapped.

Return type:

list[T] | list[list[T]] | list[list[list[T]]]