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

Any(*args, **kwargs)

Special type indicating an unconstrained type.

Iterable()

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

Type variable.

class ArgType#

ArgType generic type.

alias of TypeVar(‘ArgType’)

as_list(arg: ~rics.collections.misc.ArgType | ~collections.abc.Iterable[~rics.collections.misc.ArgType] | None = None, excl_types: tuple[type[~typing.Any]] = (<class 'str'>, )) list[ArgType][source]#

Create a list or list-wrapping of arg.

Parameters:
  • arg – An object to name.

  • 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.