liblaf.melon.utils
¶
Small utility helpers used by Melon internals and workflows.
Functions:
-
filter_kwargs–Filter keyword arguments to those accepted by
func. -
pick–Return dictionary items whose keys are in
allowlist. -
temporary_array–Attach a temporary PyVista data array and remove it on exit.
-
warp_stream_from_torch–
filter_kwargs
¶
Filter keyword arguments to those accepted by func.
Functions with **kwargs receive the original mapping unchanged.
Parameters:
-
func(Callable[..., Any]) –Callable whose signature should be respected.
-
kwargs(Mapping[str, Any]) –Candidate keyword arguments.
Returns:
Source code in src/liblaf/melon/utils/_toolz.py
pick
¶
Return dictionary items whose keys are in allowlist.
Parameters:
Returns:
-
dict[K, V]–A plain dictionary containing only allowed keys.
Source code in src/liblaf/melon/utils/_toolz.py
temporary_array
¶
temporary_array(
attributes: DataSetAttributes,
data: Float[ArrayLike, ...] | None = None,
name: str = "",
length: int = 8,
) -> Generator[str]
Attach a temporary PyVista data array and remove it on exit.
Parameters:
-
attributes(DataSetAttributes) –Point, cell, or field data container to mutate.
-
data(Float[ArrayLike, ...] | None, default:None) –Optional array value to store under the generated name.
-
name(str, default:'') –Prefix for the generated array name.
-
length(int, default:8) –Number of random suffix characters to append.
Yields: