File size: 487 Bytes
e75adba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from .artifact import Artifact
from . import blocks

import inspect


def register_blocks():
    # Iterate over every object in the blocks module
    for name, obj in inspect.getmembers(blocks):
        # Make sure the object is a class
        if inspect.isclass(obj):
            # Make sure the class is a subclass of Artifact (but not Artifact itself)
            if issubclass(obj, Artifact) and obj is not Artifact:
                Artifact.register_class(obj)


register_blocks()