unitelabs.labware.utils

Packages

Attributes

  • Name
    MaybeList
    Type
    Value

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

    Description

  • Name
    __all__
    Type
    Value

    = [ "find_subclass", "get_index_for_label", "MaybeList", "get", "extend", "expand", "pairwise", "get_default_for_field", "Level", "log", "LabwareEncoder" ]

    Description

Functions

  • get_default_for_field(field : dataclasses.Field) -> typing.Any

    Get the default value of a dataclass field.

    Parameters

    • Name
      field
      Type
      dataclasses.Field
      Default
      Description

    Response

    Type
    typing.Any
    Description

  • get_index_for_label(label : str, cols : int, rows : int) -> int

    Parameters

    • Name
      label
      Type
      str
      Default
      Description

    • Name
      cols
      Type
      int
      Default
      Description

    • Name
      rows
      Type
      int
      Default
      Description

    Response

    Type
    int
    Description

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

  • log(level : typing.Union[typing.Literal['CRITICAL', 'FATAL', 'ERROR', 'WARN', 'WARNING', 'INFO', 'DEBUG'], Level]) -> None

    Log the method execution of a class with the provided arguments.

    Parameters

    • Name
      level
      Type
      typing.Union[typing.Literal['CRITICAL', 'FATAL', 'ERROR', 'WARN', 'WARNING', 'INFO', 'DEBUG'], Level]
      Default
      = NOTSET
      Description

      The log level to be used for logging.

  • 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

Classes

  • LabwareEncoder

    Bases
    json.JSONEncoder

    Methods

    • default(self, o) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        o
        Type
        Default
        Description

  • Level

    Bases
    enum.IntEnum

    Attributes

    • Name
      CRITICAL
      Type
      Value

      = logging.CRITICAL

      Description

    • Name
      FATAL
      Type
      Value

      = logging.CRITICAL

      Description

    • Name
      ERROR
      Type
      Value

      = logging.ERROR

      Description

    • Name
      WARN
      Type
      Value

      = logging.WARNING

      Description

    • Name
      WARNING
      Type
      Value

      = logging.WARNING

      Description

    • Name
      INFO
      Type
      Value

      = logging.INFO

      Description

    • Name
      DEBUG
      Type
      Value

      = logging.DEBUG

      Description

    • Name
      NOTSET
      Type
      Value

      = logging.NOTSET

      Description

Copyright © 2024