style: 代码格式化
This commit is contained in:
@@ -10,10 +10,10 @@ from .mcq import MCQPuzzle
|
||||
from .recognition import RecognitionPuzzle
|
||||
|
||||
__all__ = [
|
||||
'BasePuzzle',
|
||||
'ClozePuzzle',
|
||||
'MCQPuzzle',
|
||||
'RecognitionPuzzle',
|
||||
"BasePuzzle",
|
||||
"ClozePuzzle",
|
||||
"MCQPuzzle",
|
||||
"RecognitionPuzzle",
|
||||
]
|
||||
|
||||
puzzles = {
|
||||
@@ -23,6 +23,7 @@ puzzles = {
|
||||
"base": BasePuzzle,
|
||||
}
|
||||
|
||||
|
||||
@staticmethod
|
||||
def create_by_dict(config_dict: dict) -> BasePuzzle:
|
||||
"""
|
||||
@@ -37,19 +38,19 @@ def create_by_dict(config_dict: dict) -> BasePuzzle:
|
||||
Raises:
|
||||
ValueError: 当配置无效时抛出
|
||||
"""
|
||||
puzzle_type = config_dict.get('type')
|
||||
puzzle_type = config_dict.get("type")
|
||||
|
||||
if puzzle_type == 'cloze':
|
||||
if puzzle_type == "cloze":
|
||||
return puzzles["cloze"](
|
||||
text=config_dict['text'],
|
||||
min_denominator=config_dict.get('min_denominator', 7)
|
||||
text=config_dict["text"],
|
||||
min_denominator=config_dict.get("min_denominator", 7),
|
||||
)
|
||||
elif puzzle_type == 'mcq':
|
||||
elif puzzle_type == "mcq":
|
||||
return puzzles["mcq"](
|
||||
mapping=config_dict['mapping'],
|
||||
jammer=config_dict.get('jammer', []),
|
||||
max_riddles_num=config_dict.get('max_riddles_num', 2),
|
||||
prefix=config_dict.get('prefix', '')
|
||||
mapping=config_dict["mapping"],
|
||||
jammer=config_dict.get("jammer", []),
|
||||
max_riddles_num=config_dict.get("max_riddles_num", 2),
|
||||
prefix=config_dict.get("prefix", ""),
|
||||
)
|
||||
else:
|
||||
raise ValueError(f"未知的谜题类型: {puzzle_type}")
|
||||
raise ValueError(f"未知的谜题类型: {puzzle_type}")
|
||||
|
||||
Reference in New Issue
Block a user