rics.collections.misc#

Miscellaneous utility methods for collections.

Module Attributes

ArgType

ArgType generic type.

Functions

as_list([arg, excl_types])

Create a list or list-wrapping of arg.

Classes

TypeVar(name, *constraints[, bound, ...])

Type variable.

ArgType#

ArgType generic type.

alias of TypeVar(‘ArgType’)

as_list(arg: ~typing.Optional[~typing.Union[~rics.collections.misc.ArgType, ~typing.Iterable[~rics.collections.misc.ArgType]]] = None, excl_types: ~typing.Tuple[~typing.Type[~typing.Any]] = (<class 'str'>, )) List[ArgType][source]#

Create a list or list-wrapping of arg.

Parameters:
  • arg – Input data..

  • excl_types – Iterable types that should be treated as single elements, such as strings.

Returns:

A list representation of arg.

Notes

For all zero-length arguments, i.e. len(arg) == 0, an empty list is returned.