Is it possible to define two different config objects which are build from two different classes?
Some pseudo code
class Player:
def __init__(self, name: str):
self.name = name
def move(self):
print('Moving')
class Monster:
def __init__(self, magic_type: str):
self.magic_type = magic_type
def move(self):
print('Moving')
def run_engine(entity):
entity.move()
PlayerCfg = builds(Player)
MonsterCfg = builds(Monster)
main = builds(run_engine, entity=PlayerCfg('DummyPlayerDefault'))
Now assigning a MonsterCfg object to the main function will raise an error as MonsterCfg is not a child of PlayerCfg.
Is there a way to both assign a default value (here dummy player) and allow for different config class to be assigned?
Is it possible to define two different config objects which are build from two different classes?
Some pseudo code
Now assigning a MonsterCfg object to the main function will raise an error as MonsterCfg is not a child of PlayerCfg.
Is there a way to both assign a default value (here dummy player) and allow for different config class to be assigned?