-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
87 lines (80 loc) · 1.95 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
from dataclasses import dataclass, field
from enum import Enum
from typing import List
from zhixuewang.models import Subject
@dataclass
class QuestionSection:
code: str
name: str
categoryCode: str
categoryName: str
sort: int
isSubjective: bool
'''是否为客观题'''
score: int
@dataclass
class QuestionDifficulty:
code: str
name: str
value: int
@dataclass
class QuestionKnowledges:
code: str
name: str
weight: float
'''权重'''
@dataclass
class Question:
id: str
number: str
section: QuestionSection
materials: list
difficulty: QuestionDifficulty
knowledges: List[QuestionKnowledges]
commonKnowledges: List[QuestionKnowledges]
usedPapers: List[str]
contentHtml: str
'''手动解析originalStruct.contentHtml'''
score: float
paperName: str
'''何处来的题目'''
answerImg: str
analysisImg: str
createTime: str
'''题目创建时间'''
isXGKQuestion: bool
'''是否为新高考'''
@dataclass
class Knowledge:
id: str
name: str
isChild: bool
'''是否为子知识'''
parentKnowledgeId: str
'''如果是,上一级的知识ID'''
@dataclass
class TextBookChapter:
chapterId: str = None
'''教科书章节的编号'''
chapterName: str = None
'''章节名'''
chapterType: str = None
'''本章节的类型,有unit和course'''
@dataclass
class TextBook:
"""教科书属性"""
code: str = None
"""教科书编号"""
name: str = None
"""教科书名称"""
version: str = None
"""教科书版本,如北师大、人教、部编等,等同于pressCode"""
versionCode: str = None
pressCode: str = versionCode
"""教科书版本编号"""
bindSubject: Subject = None
availableChapters: list = field(default_factory=list, repr = False)
def __str__(self) -> str:
return (
f"{self.bindSubject.name} {self.name}({self.version})"
)