format code

This commit is contained in:
wenmeng.zwm
2023-11-10 18:59:17 +08:00
parent 331b71092b
commit 9271fa6134
3 changed files with 6 additions and 2 deletions

View File

@@ -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)

View File

@@ -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()
},
]
}

View File

@@ -1,5 +1,6 @@
import re
def validate_reciprocal_question(input, response, generate_response):
"""
验证器函数检查给定的问题A和回答B是否能够通过以B作为新的提问得到原始问题A作为回答。