pyxx.units.UnitConverterEntry#

class pyxx.units.UnitConverterEntry(unit: Unit, tags: TypedList[str] | List[str] | Tuple[str, ...] | str | None = None, name: str | None = None, description: str | None = None)#

Bases: object

Data structure for storing information about a unit in a unit converter

The UnitConverterEntry is designed to be used in combination with a UnitConverter object. A UnitConverterEntry object stores data about a particular unit, allowing such information to be grouped and changes to the data validated. Many such objects are stored in in a UnitConverter, allowing it to relate and perform conversions between different units, while the “lower-level” details of managing unit data are handled by UnitConverterEntry.

Methods

__init__(unit[, tags, name, description])

Creates a UnitConverterEntry to store data about a particular unit

Attributes

description

A description of the unit

name

A name by which to reference the unit

tags

Tags that associate the unit with various categories or groups

unit

A Unit object representing the unit

__init__(unit: Unit, tags: TypedList[str] | List[str] | Tuple[str, ...] | str | None = None, name: str | None = None, description: str | None = None) None#

Creates a UnitConverterEntry to store data about a particular unit

Parameters:
  • unit (Unit) – A Unit object describing the unit

  • tags (TypedList or list or tuple or str, optional) – One or more strings containing brief, one-word descriptors to use to group similar units, such as “length” or “speed” (default is None, meaning that no tags are associated with the unit)

  • name (str, optional) – A name for the unit (default is None)

  • description (str, optional) – A written description of the unit (default is None)

property description: str | None#

A description of the unit

property name: str | None#

A name by which to reference the unit

property tags: TypedList[str]#

Tags that associate the unit with various categories or groups

property unit: Unit#

A Unit object representing the unit