unitelabs.labware.math.decimal

Attributes

  • Name
    Number
    Type
    Value

    = typing.Union[str, int, float, tuple[int, collections.abc.Sequence[int], int], decimal.Decimal]

    Description

Functions

  • is_number(value : typing.Any) -> bool

    Check whether a value is of numeric type.

    Parameters

    • Name
      value
      Type
      typing.Any
      Default
      Description

      The number to check.

    Response

    Type
    bool
    Description

  • parse_number(value : Number) -> decimal.Decimal

    Convert any valid number to a decimal value.

    Parameters

    • Name
      value
      Type
      Number
      Default
      Description

      The number to convert.

    Response

    Type
    decimal.Decimal
    Description

    The decimal value.

Classes

  • Decimal

    Decimal number for fast correctly rounded decimal floating point arithmetic.

    Methods

    • __init__(self, default : Number) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        default
        Type
        Number
        Default
        Description

    • __set_name__(self, owner : type[object], name : str) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        owner
        Type
        type[object]
        Default
        Description

      • Name
        name
        Type
        str
        Default
        Description

    • __get__(self, instance : typing.Optional[object], owner : typing.Optional[type[object]]) -> decimal.Decimal

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        instance
        Type
        typing.Optional[object]
        Default
        Description

      • Name
        owner
        Type
        typing.Optional[type[object]]
        Default
        Description

      Response

      Type
      decimal.Decimal
      Description

    • __set__(self, instance : typing.Optional[object], value : Number) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        instance
        Type
        typing.Optional[object]
        Default
        Description

      • Name
        value
        Type
        Number
        Default
        Description

    Attributes

    • Name
      _default_value
      Type
      Value

      = default

      Description

    • Name
      _attr_name
      Type
      Value

      = ''

      Description

  • DecimalField

    Bases
    marshmallow.fields.Field

    Methods

    • _serialize(
        self,
        value : typing.Any,
        attr : typing.Optional[str],
        obj : typing.Any,
        **kwargs
      ) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        value
        Type
        typing.Any
        Default
        Description

      • Name
        attr
        Type
        typing.Optional[str]
        Default
        Description

      • Name
        obj
        Type
        typing.Any
        Default
        Description

      • Name
        **kwargs
        Type
        Default
        = {}
        Description

    • _deserialize(
        self,
        value : typing.Any,
        attr : typing.Optional[str],
        data : typing.Optional[typing.Mapping[str, typing.Any]],
        **kwargs
      ) -> None

      Parameters

      • Name
        self
        Type
        Default
        Description

      • Name
        value
        Type
        typing.Any
        Default
        Description

      • Name
        attr
        Type
        typing.Optional[str]
        Default
        Description

      • Name
        data
        Type
        typing.Optional[typing.Mapping[str, typing.Any]]
        Default
        Description

      • Name
        **kwargs
        Type
        Default
        = {}
        Description

Copyright © 2024