Skip to content

datatype value is actually not used #49

@kbabioch

Description

@kbabioch

The base class for all datatypes is Base, which looks as follows:

class Base:
"""Base datatype, no conversions."""
measurement_type = None
def __init__(self, name, writeable=False):
self.value = None
self.name = name
self.writeable = writeable
def to_heatpump(self, value):
"""Convert a value into heatpump units."""
return value
def from_heatpump(self, value):
"""Convert a value from heatpump units."""
return value
def __repr__(self):
return str(self.value)
def __str__(self):
return str(self.value)

All other datatypes are derived from that. I'm currently wondering what the attribute value is actually used for in this context. The __repr__ and __str__ methods are referring to it, but actually the value is never set (other than during initialization). Any invocation of from_heatpump and to_heatpump will just calculate and return the value, but never set it.

Is this attribute actually needed and if so, what for and how is it used? Am I missing something here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions