Skip to content

Commit

Permalink
Remove obsolete code in converters
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxcode123 committed Feb 20, 2024
1 parent cc7aa0e commit 5f68899
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions src/property_utils/units/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,6 @@
ExponentiatedPhysicalPropertyUnitConverter,
CompositePhysicalPropertyUnitConverter,
)
from property_utils.exceptions.units.converters import (
InvalidUnitConversion,
UndefinedConverter,
)

_converters: dict[GenericUnitDescriptor, Type["PhysicalPropertyUnitConverter"]] = {}


def get_converter(
generic: GenericUnitDescriptor,
) -> Type["PhysicalPropertyUnitConverter"]:
"""
Get converter for given generic descriptor.
"""
try:
return _converters[generic]
except KeyError as exc:
raise UndefinedConverter(
f"a converter has not been defined for {generic}"
) from exc


def register_converter(generic: GenericUnitDescriptor):
"""
Decorate a converter class to register the generic descriptor of the units it
operates on.
"""

def wrapper(cls):
_converters[generic] = cls
cls.generic_unit_descriptor = generic
return cls

return wrapper


class UnitPrefix(float, Enum):
Expand Down

0 comments on commit 5f68899

Please sign in to comment.