Specify interfaces for inheritance with abstract base classes #26
Labels
bug
Something isn't working
documentation
Improvements or additions to documentation
help wanted
Extra attention is needed
Some base classes in RAIL are commonly used implement algorithms or other utilities. In some cases it is not immediately clear which class methods are part of the base implementation and which should be overwritten/implemented by a subclass.
Example
rail.core.DataHandle
: The methods_open
,_read
,_write
,_initialize_write
,_write_chunk
,_finalize_write
,_size
,_iterator
all raiseNotImplementedError
s when the subclass does not implement them.ModelHandle
for example implements only the first three methods, which may lead to unexpected behaviour. It is not clear which methods are required and in which context exceptions may occur. Furthermore, the methods are not fully documented and it is not always clear which functionality and in/outputs must be covered.Suggestions
abc.ABC
, and methods with the@abstract...
decorators. Missing method implementations will be flagged when creating a class instance instead of during runtime.and remove these methods from
DataHandle
.Impact
Simplifies subclassing and clarifies the logical relationship between different classes.
The text was updated successfully, but these errors were encountered: