whylogs.api.logger.experimental.logger.actor.list_util#

Module Contents#

Functions#

get_like_items(→ Tuple[Optional[List[K]], ...)

Given a list of items, return a tuple of:

type_batched_items(...)

Given a list of items, return a generator that yields tuples. This is a generator version of

Attributes#

K

whylogs.api.logger.experimental.logger.actor.list_util.K#
whylogs.api.logger.experimental.logger.actor.list_util.get_like_items(items: List[K]) Tuple[Optional[List[K]], Optional[Type[K]], List[K]]#

Given a list of items, return a tuple of:

  • A list of the items that are of the same type. It will take items from the input until it encounters an item that is not of the same type.

  • The type of the items in the first list

  • The remaining items in the list

This is most useful when K is a union type but also works when K is a single type, or just an optional.

Parameters

items (List[K]) –

Return type

Tuple[Optional[List[K]], Optional[Type[K]], List[K]]

whylogs.api.logger.experimental.logger.actor.list_util.type_batched_items(items: List[K]) Generator[Tuple[Optional[List[K]], Optional[Type[K]]], None, None]#

Given a list of items, return a generator that yields tuples. This is a generator version of get_like_items and has the same semantics.

Parameters

items (List[K]) –

Return type

Generator[Tuple[Optional[List[K]], Optional[Type[K]]], None, None]