vllm.utils.collection_utils ¶
Contains helpers that are applied to collections.
This is similar in concept to the collections
module.
ClassRegistry ¶
A registry that acts like a dictionary but searches for other classes in the MRO if the original class is not found.
Source code in vllm/utils/collection_utils.py
LazyDict ¶
Bases: Mapping[str, T]
, Generic[T]
Evaluates dictionary items only when they are accessed.
Adapted from: https://stackoverflow.com/a/47212782/5082708
Source code in vllm/utils/collection_utils.py
as_iter ¶
as_list ¶
chunk_list ¶
flatten_2d_lists ¶
full_groupby ¶
Unlike itertools.groupby
, groups are not broken by non-contiguous data.
Source code in vllm/utils/collection_utils.py
is_list_of ¶
is_list_of(
value: object,
typ: type[T] | tuple[type[T], ...],
*,
check: Literal["first", "all"] = "first",
) -> TypeIs[list[T]]