mpacts.core.units. errors

Functions and classes related to unit definitions and conversions.

copyright:2016 by Pint Authors, see AUTHORS for more details.
license:BSD, see LICENSE for more details.

In order to be able to use this module import it like this:

import mpacts.core.units.errors
#or assign it to a shorter name
import mpacts.core.units.errors as err


class mpacts.core.units.errors.DefinitionSyntaxError(msg, filename=None, lineno=None)

Bases: exceptions.ValueError

Raised when a textual definition has a syntax error.

DefinitionSyntaxError(name, parent, **kwargs)


class mpacts.core.units.errors.DimensionalityError(units1, units2, dim1=None, dim2=None, extra_msg=u'')

Bases: exceptions.ValueError

Raised when trying to convert between incompatible units.

DimensionalityError(name, parent, **kwargs)


class mpacts.core.units.errors.OffsetUnitCalculusError(units1, units2=u'', extra_msg=u'')

Bases: exceptions.ValueError

Raised on ambiguous operations with offset units.

OffsetUnitCalculusError(name, parent, **kwargs)


class mpacts.core.units.errors.RedefinitionError(name, definition_type)

Bases: exceptions.ValueError

Raised when a unit or prefix is redefined.

RedefinitionError(name, parent, **kwargs)


class mpacts.core.units.errors.UndefinedUnitError(unit_names)

Bases: exceptions.ValueError

Raised when the units are not defined in the unit registry.

UndefinedUnitError(name, parent, **kwargs)