Solved a circular import issue

This commit is contained in:
2025-07-04 19:59:39 -04:00
parent d83c29e1ec
commit 239f9573be

View File

@ -417,83 +417,6 @@ class ExpansionsManager:
self._createExpansion(expansionID)
class Expansion:
"""
A meta class implementation meant to describe how to interact with any kind
of expansions.
Attributes:
players (tuple of str):
tags (tuple of flag):
Methods:
step:
reset:
close:
Signals:
onError:
"""
def __init__(self, ID: str, expansionsManager: ExpansionsManager):
"""
Initialise the creation of an expansion and raise an error if not
available.
"""
self._ID = ID
self._manager = expansionsManager
self.onError = Hook()
@property
def config(self):
return copy.deepcopy(self._manager.config[self._ID]["config"])
@property
def players(self):
""" Players that have access to this expansion. """
return self._manager.config[self._ID]["players"]
@players.setter
def players(self, newPlayers):
""" Players that have access to this expansion. """
self._manager.config[self._ID]["players"] = tuple(newPlayers)
self._manager.expansionPlayersChanged(self._ID)
@players.deleter
def players(self):
self._manager.config[self._ID]["players"] = ()
self._manager.expansionPlayersChanged(self._ID)
@property
def tags(self):
""" Players that have access to this expansion. """
return self._manager.config[self._ID]["tags"]
@tags.setter
def tags(self, newPlayers):
""" Players that have access to this expansion. """
self._manager.config[self._ID]["tags"] = tuple(newPlayers)
@tags.deleter
def tags(self):
self._manager.config[self._ID]["tags"] = ()
@abc.abstractmethod
def step(self, action):
"""
Call close if an error is thrown
"""
raise NotImplementedError
@abc.abstractmethod
def reset(self):
raise NotImplementedError
@abc.abstractmethod
def close(self):
raise NotImplementedError
if __name__ == "__main__":
# Test run to make sure nothing is flagrantly flawed
configPath = Path(__file__).parent / "players.json"
@ -508,3 +431,4 @@ if __name__ == "__main__":
brosef.state = ["alive"]
# TODO Verify that changing the gameID works as intended
# TODO Test out the expansion manager
# Implement a way to search within expansions