UniteLabs

unitelabs.labware.utils.list

Attributes

  • Name
    Item
    Type
    Value

    = typing.TypeVar('Item')

    Description

  • Name
    MaybeList
    Type
    Value

    = typing.Union[Item, collections.abc.Sequence[Item]]

    Description

  • Name
    CharSequence
    Type
    Value

    = typing.Union[str, bytes, bytearray, memoryview]

    Description

  • Name
    T
    Type
    Value

    = typing.TypeVar('T')

    Description

Functions

  • get(list_or_item : MaybeList[Item], index : typing.SupportsIndex) -> typing.Union[CharSequence, Item]

    Parameters

    • Name
      list_or_item
      Type
      MaybeList[Item]
      Default
      Description

    • Name
      index
      Type
      typing.SupportsIndex
      Default
      Description

    Response

    Type
    typing.Union[CharSequence, Item]
    Description

  • extend(
      index : typing.SupportsIndex,
      count : int
    ) -> list[Item]

    Parameters

    • Name
      value
      Type
      Item
      Default
      Description

    • Name
      default
      Type
      Item
      Default
      Description

    • Name
      index
      Type
      typing.SupportsIndex
      Default
      Description

    • Name
      count
      Type
      int
      Default
      Description

    Response

    Type
    list[Item]
    Description

  • expand(list_or_item : MaybeList[Item], count : int) -> collections.abc.Iterable[typing.Union[CharSequence, Item]]

    Uses the given sequence or repeats a single value a specified number of times.

    Parameters

    • Name
      list_or_item
      Type
      MaybeList[Item]
      Default
      Description

      Either a sequence or a single value.

    • Name
      count
      Type
      int
      Default
      Description

      The number of times the single value should be repeated.

    Response

    Type
    collections.abc.Iterable[typing.Union[CharSequence, Item]]
    Description

    A list with the specified number of values.

  • pairwise(iterable : typing.Iterable[T]) -> typing.Iterable[tuple[T, T]]

    s -> (s0,s1), (s1,s2), (s2, s3), ...

    Parameters

    • Name
      iterable
      Type
      typing.Iterable[T]
      Default
      Description

    Response

    Type
    typing.Iterable[tuple[T, T]]
    Description

Copyright © 2025