Skip to content

Decrease the number of levels of hierarchy for EITData subclasses. #152

Description

@DaniBodor

Currently, EITData_ is the direct parent for individual vendor EITData classes (e.g. DraegerEITData) and itself inherits from EITData. It would be nice if we can find a way to circumvent this intermediate class. However, that would lead to the following issue:

EITData.from_path() requires vendor as argument, so it can choose the right class to load the file.
DraegerEITData.from_path() does not allow vendor as argument, because the vendor is implicit in the choice of class. Of course the same is true for SentecEITData and TimpelEITData.
It is possible to override from_path() in each of the three subclasses, but that would not be DRY.

EITData_ removes vendor from the initializer with field(init=False).
Each subclass sets vendor to the proper value.
EITData_ also changes the arguments required for from_path().

I wasn't able to solve this without an intermediate class. Any other solution I came up with requires re-implementing from_path() in each of the three subclasses.

Originally posted by @psomhorst in #142 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions