From eda4108d20b8379120c2598e8ecf8bd7b1434a2d Mon Sep 17 00:00:00 2001 From: Hyeong Joon Suh Date: Mon, 9 Sep 2024 14:47:32 -0700 Subject: [PATCH] fix mypy --- .../danswerbot/slack/handlers/handle_standard_answers.py | 3 ++- backend/danswer/db/standard_answer.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/danswer/danswerbot/slack/handlers/handle_standard_answers.py b/backend/danswer/danswerbot/slack/handlers/handle_standard_answers.py index 0f959d9b6..40baf1497 100644 --- a/backend/danswer/danswerbot/slack/handlers/handle_standard_answers.py +++ b/backend/danswer/danswerbot/slack/handlers/handle_standard_answers.py @@ -50,7 +50,8 @@ def oneoff_standard_answers( ) server_standard_answers = [ - StandardAnswer.from_model(db_answer) for db_answer in matching_standard_answers + StandardAnswer.from_model(db_answer[0]) + for db_answer in matching_standard_answers ] return server_standard_answers diff --git a/backend/danswer/db/standard_answer.py b/backend/danswer/db/standard_answer.py index 27e2df0bb..3e4a04965 100644 --- a/backend/danswer/db/standard_answer.py +++ b/backend/danswer/db/standard_answer.py @@ -182,7 +182,7 @@ def find_matching_standard_answers( id_in: list[int], query: str, db_session: Session, -) -> list[(StandardAnswer, bool)]: +) -> list[tuple[StandardAnswer, bool]]: """ Returns a list of tuples, where each tuple contains a StandardAnswer and a boolean indicating if the query is a regex match. @@ -194,7 +194,7 @@ def find_matching_standard_answers( ) possible_standard_answers = db_session.scalars(stmt).all() - matching_standard_answers: list[StandardAnswer] = [] + matching_standard_answers: list[tuple[StandardAnswer, bool]] = [] for standard_answer in possible_standard_answers: # Remove punctuation and split the keyword into individual words keyword_words = "".join(