-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Problem
Having this folder structure:
- Base.py
- classes
- child1.py
- child2.py
At some point, I have to import every single child in some file to register it, and also I have to decorate it. Sometimes it's hard to remember to do this and add the right properties to the children.
Solution suggestion
registery = registerer.Registerer(
parent_class=BaseClass,
autoregister=["./classes/*"],
)This case is suitable for auto-registering. also If I want to unregister, maybe I could add an unregister property to the child class to avoid getting registered automatically.
# classes/child1.py
from base import BaseClass
class Child(BaseClass):
slug = "child1"# classes/child2.py
from base import BaseClass
class Child(BaseClass):
slug = "child1"
unregister = TrueReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels