Spaces:
Build error
Build error
File size: 659 Bytes
d7a991a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
"""
This file contains the defition of the base Dataset class.
"""
class DatasetRegistration(type):
"""
Metaclass for registering different datasets
"""
def __init__(cls, name, bases, nmspc):
super().__init__(name, bases, nmspc)
if not hasattr(cls, 'registry'):
cls.registry = dict()
cls.registry[name] = cls
# Metamethods, called on class objects:
def __iter__(cls):
return iter(cls.registry)
def __str__(cls):
return str(cls.registry)
class Dataset(metaclass=DatasetRegistration):
"""
Base Dataset class
"""
def __init__(self, *args, **kwargs):
pass |