Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions src/pymodaq_data/h5modules/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,14 @@
logger = set_logger(get_module_name(__file__))


class H5Exporter(metaclass=ABCMeta):
"""Base class for an exporter. """

# This is to define an abstract class attribute
@classmethod
@property
@abstractmethod
def FORMAT_DESCRIPTION(cls):
"""str: file format description as a short text. eg: text file"""
raise NotImplementedError

@classmethod
@property
@abstractmethod
def FORMAT_EXTENSION(cls):
"""str: File format extension. eg: txt"""
raise NotImplementedError
class H5Exporter(metaclass=ABCMeta):
"""Base class for an exporter. """

FORMAT_EXTENSION: str = NotImplemented
FORMAT_DESCRIPTION: str = NotImplemented

def __init__(self):
"""Abstract Exporter Constructor"""
pass
Expand Down Expand Up @@ -63,6 +53,11 @@ def register_exporter(cls) -> Callable:
"""

def inner_wrapper(wrapped_class) -> Callable:
if wrapped_class.FORMAT_EXTENSION is NotImplemented or \
wrapped_class.FORMAT_DESCRIPTION is NotImplemented:
raise NotImplementedError(f'{wrapped_class} does not properly provide a valid value for '
f'`FORMAT_EXTENSION` ({wrapped_class.FORMAT_EXTENSION}) or for '
f'`FORMAT_DESCRIPTION` ({wrapped_class.FORMAT_DESCRIPTION})')
extension = wrapped_class.FORMAT_EXTENSION
format_desc = wrapped_class.FORMAT_DESCRIPTION

Expand Down
Loading