refactor(simulation): Add strict type hints to simulation modules
This commit is contained in:
@@ -8,7 +8,7 @@ class WorkflowSimulator:
|
||||
self.client = hook_client
|
||||
self.user_agent = UserSimAgent(hook_client)
|
||||
|
||||
def setup_new_project(self, name, git_dir, project_path=None):
|
||||
def setup_new_project(self, name: str, git_dir: str, project_path: str = None) -> None:
|
||||
print(f"Setting up new project: {name}")
|
||||
if project_path:
|
||||
self.client.click("btn_project_new_automated", user_data=project_path)
|
||||
@@ -19,13 +19,13 @@ class WorkflowSimulator:
|
||||
self.client.click("btn_project_save")
|
||||
time.sleep(1)
|
||||
|
||||
def create_discussion(self, name):
|
||||
def create_discussion(self, name: str) -> None:
|
||||
print(f"Creating discussion: {name}")
|
||||
self.client.set_value("disc_new_name_input", name)
|
||||
self.client.click("btn_disc_create")
|
||||
time.sleep(1)
|
||||
|
||||
def switch_discussion(self, name):
|
||||
def switch_discussion(self, name: str) -> None:
|
||||
print(f"Switching to discussion: {name}")
|
||||
self.client.select_list_item("disc_listbox", name)
|
||||
time.sleep(1)
|
||||
@@ -37,18 +37,18 @@ class WorkflowSimulator:
|
||||
# without more hooks, but we can verify the button click.
|
||||
time.sleep(1)
|
||||
|
||||
def truncate_history(self, pairs):
|
||||
def truncate_history(self, pairs: int) -> None:
|
||||
print(f"Truncating history to {pairs} pairs")
|
||||
self.client.set_value("disc_truncate_pairs", pairs)
|
||||
self.client.click("btn_disc_truncate")
|
||||
time.sleep(1)
|
||||
|
||||
def run_discussion_turn(self, user_message=None):
|
||||
def run_discussion_turn(self, user_message: str = None) -> dict | None:
|
||||
self.run_discussion_turn_async(user_message)
|
||||
# Wait for AI
|
||||
return self.wait_for_ai_response()
|
||||
|
||||
def run_discussion_turn_async(self, user_message=None):
|
||||
def run_discussion_turn_async(self, user_message: str = None) -> None:
|
||||
if user_message is None:
|
||||
# Generate from AI history
|
||||
session = self.client.get_session()
|
||||
@@ -58,7 +58,7 @@ class WorkflowSimulator:
|
||||
self.client.set_value("ai_input", user_message)
|
||||
self.client.click("btn_gen_send")
|
||||
|
||||
def wait_for_ai_response(self, timeout=60):
|
||||
def wait_for_ai_response(self, timeout: int = 60) -> dict | None:
|
||||
print("Waiting for AI response...", end="", flush=True)
|
||||
start_time = time.time()
|
||||
last_count = len(self.client.get_session().get('session', {}).get('entries', []))
|
||||
|
||||
Reference in New Issue
Block a user