|
|
|
|
|
|
from typing import NamedTuple, Optional |
|
|
|
from typing import NamedTuple |
|
|
|
from urllib.parse import urlparse, parse_qs |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
behavior_id: str |
|
|
|
brain_name: str |
|
|
|
team_id: int |
|
|
|
group_id: int |
|
|
|
Parses a name_behavior_id of the form name?team=0&group=0 |
|
|
|
Parses a name_behavior_id of the form name?team=0 |
|
|
|
|
|
|
|
group_id: int = 0 |
|
|
|
if "group" in ids: |
|
|
|
group_id = int(ids["group"][0]) |
|
|
|
behavior_id=name_behavior_id, |
|
|
|
brain_name=name, |
|
|
|
team_id=team_id, |
|
|
|
group_id=group_id, |
|
|
|
behavior_id=name_behavior_id, brain_name=name, team_id=team_id |
|
|
|
def create_name_behavior_id( |
|
|
|
name: str, team_id: Optional[int] = None, group_id: Optional[int] = None |
|
|
|
) -> str: |
|
|
|
def create_name_behavior_id(name: str, team_id: int) -> str: |
|
|
|
Reconstructs fully qualified behavior name from name and team_id |
|
|
|
:param name: brain name |
|
|
|
:param team_id: team ID |
|
|
|
:return: name_behavior_id |
|
|
|
""" |
|
|
|
final_name = name |
|
|
|
if team_id is not None: |
|
|
|
final_name += f"?team={team_id}" |
|
|
|
if group_id is not None: |
|
|
|
final_name += f"&group={group_id}" |
|
|
|
return final_name |
|
|
|
Reconstructs fully qualified behavior name from name and team_id |
|
|
|
:param name: brain name |
|
|
|
:param team_id: team ID |
|
|
|
:return: name_behavior_id |
|
|
|
""" |
|
|
|
return name + "?team=" + str(team_id) |
|
|
|
|
|
|
|
|
|
|
|
def get_global_agent_id(worker_id: int, agent_id: int) -> str: |
|
|
|