diff --git a/alab_management/lab_view.py b/alab_management/lab_view.py index b9414f64..04822718 100644 --- a/alab_management/lab_view.py +++ b/alab_management/lab_view.py @@ -300,16 +300,33 @@ def run_subtask( return result def request_user_input(self, prompt: str, options: list[str]) -> str: - """Request user input from the user. This function will block until the user inputs something. Returns the - value returned by the user. + """ + Request user input from the user. This function will block until the user inputs something. + + Args: + prompt (str): The prompt to display to the user. + options (list[str]): A list of options to display to the user. + + Returns + ------- + response (str): The value returned by the user (from the buttons). """ return request_user_input(task_id=self.task_id, prompt=prompt, options=options) def request_user_input_with_note( self, prompt: str, options: list[str] ) -> tuple[str, str]: - """Request user input from the user. This function will block until the user inputs something. Returns the - value returned by the user and the note. + """ + Request user input from the user. This function will block until the user inputs something. + + Args: + prompt (str): The prompt to display to the user. + options (list[str]): A list of options to display to the user. + + Returns + ------- + response (str): The value returned by the user (from the buttons). + note (str): The note returned by the user. """ return request_user_input_with_note( task_id=self.task_id, prompt=prompt, options=options diff --git a/alab_management/user_input.py b/alab_management/user_input.py index 7f89921f..f62e97de 100644 --- a/alab_management/user_input.py +++ b/alab_management/user_input.py @@ -175,12 +175,15 @@ def request_user_input( """ Request user input through the dashboard. Blocks until response is given. - task_id (ObjectId): task id requesting user input - prompt (str): prompt to give user - options (List[str]): response options to give user - maintenance (bool): if true, mark this as a request for overall system maintenance - - Returns user response as string. + Args: + task_id (ObjectId): task id requesting user input + prompt (str): prompt to give user + options (List[str]): response options to give user + maintenance (bool): if true, mark this as a request for overall system maintenance + + Returns + ------- + response (str): user response as string """ user_input_view = UserInputView() request_id = user_input_view.insert_request( @@ -195,11 +198,15 @@ def request_user_input( def request_maintenance_input(prompt: str, options: list[str]): """ - Request user input through the dashboard. Blocks until response is given. + Request user input for maintenance through the dashboard. Blocks until response is given. Args: - prompt: prompt to give user - options: response options to give user + prompt (str): prompt to give user + options (List[str]): response options to give user + + Returns + ------- + response (str): user response as string """ return request_user_input( task_id=None, @@ -218,14 +225,18 @@ def request_user_input_with_note( category: str = "Unknown Category", ) -> tuple[str, str]: """ - Request user input through the dashboard. Blocks until response is given. - - task_id (ObjectId): task id requesting user input - prompt (str): prompt to give user - options (List[str]): response options to give user - maintenance (bool): if true, mark this as a request for overall system maintenance + Request user input through the dashboard. Blocks until response. Returns response and note. - Returns user response as string. + Args: + task_id (ObjectId): task id requesting user input + prompt (str): prompt to give user + options (List[str]): response options to give user + maintenance (bool): if true, mark this as a request for overall system maintenance + + Returns + ------- + response (str): user response as string + note (str): note from the user """ user_input_view = UserInputView() request_id = user_input_view.insert_request(