From 9271fa613466a780441f503f8fc7d33ebe55579c Mon Sep 17 00:00:00 2001 From: "wenmeng.zwm" Date: Fri, 10 Nov 2023 18:59:17 +0800 Subject: [PATCH] format code --- examples/apps/llm_riddles/challenges/ch1.py | 2 +- examples/apps/llm_riddles/challenges/ch3.py | 5 ++++- examples/apps/llm_riddles/challenges/ch4.py | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/apps/llm_riddles/challenges/ch1.py b/examples/apps/llm_riddles/challenges/ch1.py index f1507d13..7f02d32f 100644 --- a/examples/apps/llm_riddles/challenges/ch1.py +++ b/examples/apps/llm_riddles/challenges/ch1.py @@ -9,7 +9,7 @@ def validate_palindrome_invariance(origin_input, response, generate_response): # 检查原始输入不是回文 if origin_input == origin_input[::-1]: return False - + # 将原始问题倒序并提交 reversed_question = origin_input[::-1] reversed_response = generate_response(reversed_question) diff --git a/examples/apps/llm_riddles/challenges/ch3.py b/examples/apps/llm_riddles/challenges/ch3.py index 1fe706da..72b1dac3 100644 --- a/examples/apps/llm_riddles/challenges/ch3.py +++ b/examples/apps/llm_riddles/challenges/ch3.py @@ -1,5 +1,6 @@ import re + def validate_palindrome_inverse(origin_input, response, generate_response): """ 验证器函数,检查对于给定的问题,正着问和倒着问的模型的回答本身不回文且也是逆序的关系。 @@ -71,7 +72,9 @@ challenge3 = { 'description': '请输入一个以“为什么”开头,以“?”结尾的不包含数字的问题,使回答中只包含数字。', 'validator': - lambda response, input: '为什么' == input[:3] and "?" == input[-1] and len(re.findall(r'\d+', input)) == 0 and response.isdigit() + lambda response, input: '为什么' == input[:3] and '?' == input[-1] + and # noqa: W504 + len(re.findall(r'\d+', input)) == 0 and response.isdigit() }, ] } diff --git a/examples/apps/llm_riddles/challenges/ch4.py b/examples/apps/llm_riddles/challenges/ch4.py index 0ec4f1da..ba2cce88 100644 --- a/examples/apps/llm_riddles/challenges/ch4.py +++ b/examples/apps/llm_riddles/challenges/ch4.py @@ -1,5 +1,6 @@ import re + def validate_reciprocal_question(input, response, generate_response): """ 验证器函数,检查给定的问题A和回答B,是否能够通过以B作为新的提问得到原始问题A作为回答。