Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-x-c committed Oct 23, 2024
1 parent 3a805e9 commit e2fda5d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/agentscope/environment/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ def set_parent(self, parent: Env) -> None:
Args:
parent (`Env`): The parent env.
"""
if self.parent is not None:
self.parent.remove_child(self.name)
self.parent = parent

def get_children(self) -> dict[str, Env]:
Expand Down Expand Up @@ -391,5 +393,6 @@ def __setitem__(self, env_name: str, env: Env) -> None:
if env_name not in self.children:
self.children[env_name] = env
env.set_parent(self)
logger.debug(f"Set Env[{env_name}] as child of Env[{self.name}]")
else:
raise EnvAlreadyExistError(env_name)

0 comments on commit e2fda5d

Please sign in to comment.