Skip to content

BaseIO Abstract Base Class #122

@JaimeRZP

Description

@JaimeRZP
        if cls.storage_type == ONE_OBJECT_PER_TABLE:
            check_has_standard_method(cls, 'to_table')
            check_has_class_method(cls, 'from_table')

        elif cls.storage_type == ONE_OBJECT_MULTIPLE_TABLES:
            check_has_standard_method(cls, 'to_tables')
            check_has_class_method(cls, 'from_tables')

        elif cls.storage_type == MULTIPLE_OBJECTS_PER_TABLE:
            check_has_class_method(cls, 'to_table')
            check_has_class_method(cls, 'from_table')
        else:
            raise RuntimeError(f"Subclasses of BaseIO must have a class variable storage_type set to one of "
                               f"{ONE_OBJECT_PER_TABLE}, {MULTIPLE_OBJECTS_PER_TABLE}, or {ONE_OBJECT_MULTIPLE_TABLES}, "

Currently baseio has a series of checks to ensure that the classes are properly created.
Could we look into enforcing this with an abstract base class?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions