Skip to main content

项目类型一览

本项目所涉及的类型一览

注意!

ExtraRank现在暂时无法使用

提示

可以使用import zhixuewang.models来导入这些类型

总览

类型名实现备注
Exam见下方考试
ExamInfo见下方继承Exam类
ExtendedList见下方继承List
ExtraRank见下方分数额外信息
Gradename: str, code: str, phase: Phase年级
Markexam: Exam, person: StuPerson考试成绩
Person见下方基本属性
Phasename: str, code: str学期
Schoolid: str, name: str学校
Sex性别
StuClass见下方班级
StuPerson见下方学生信息
StuPersonList见下方继承ExtendedList
Subject见下方学科
SubjectScore见下方学科成绩
SubjectTable暂未实现暂无

实现部分

Exam实现

class Exam
(id: str = '',
name: str = '',
status: str = '',
grade_code: str = '',
subject_codes: ExtendedList[str][str] = <factory>,
schools: ExtendedList[School][School] = <factory>,
create_school: School = <factory>,
create_user: Person = <factory>,
_create_timestamp: float = 0,
_exam_timestamp: float = 0,
_complete_timestamp: float = 0,
class_rank: int = 0,
grade_rank: int = 0,
is_final: bool = False):
pass

解释

注意

class_rankgrade_rank暂时不可用

参数名类型注解
idstr该次考试的唯一ID(examId
namestr本次考试的名称(如XX中学期中考试
statusstr不明,无法取值
grade_codestr年级ID(如07指7年级)
schoolsExtendList学校
subject_codesExtendList学科代码
create_schoolSchool创建的学校
class_rankint班级排名,失效
注意

status, schools, subject_codes, create_school, class_rank, grade_rank等均暂时失效。


ExamInfo实现

提示

本类继承自Exam

class ExamInfo(
id: str = '',
name: str = '',
status: str = '',
grade_code: str = '',
subject_codes: ExtendedList[str] = <factory>,
schools: ExtendedList[School] = <factory>,
create_school: School = <factory>,
create_user: Person = <factory>,
_create_timestamp: float = 0,
_exam_timestamp: float = 0,
_complete_timestamp: float = 0,
class_rank: int = 0,
grade_rank: int = 0,
is_final: bool = False,
classId: str = '',
subjects: ExtendedList[Subject] = <factory>):
pass

其他同上,但subjects属性可以获得每门考试对应的学科ID(paperIdtopicsetId

可以通过get_exam()来获得。


ExtendList(I: List[T] = None)实现

提示

本类继承自list, typing.Generic

扩展列表,方便寻找。

实现的方法:

def find(f: Callable([T], bool)) -> T:
pass

返回列表内满足函数f的第一个元素

def find_all(f: Callable[[T], bool]) → List[T]:
pass

返回列表内所有满足函数f的元素

def find_all_by_id(id: str) -> List[T]:
pass

返回列表内所有特定id的元素

def find_all_by_name(name: str) -> List[T]:
pass

返回列表内所有名字为name的元素

def find_by_id(id: str) -> T:
pass

返回列表里第一个ID为id的元素

def find_by_name(name: str) -> T:
pass

返回列表里第一个name为name的元素


ExtraRank实现

class ExtraRank(
rank: int = 0,
avg_score: float = 0,
low_score: float = 0,
high_score: float = 0):
pass

关于分数的额外信息,暂时无法使用


Grade实现

class Grade(
name: str = '',
code: str = '',
phase: Phase = <factory>):
pass

年级(暂时还没找到在哪里实现了)


Mark实现

提示

本类继承自ExtendedList

class Mark(
l: list = None,
exam: Exam = None,
person: StuPerson = None):
pass

考试的成绩


Person实现

class Person(
id: str = '',
name: str = '',
gender: Sex = <Sex.GIRL: '女'>,
email: str = '',
mobile: str = '',
qq_number: str = '',
_birthday_timestamp: float = 0,
avatar: str = ''):
pass

用户基本属性。

参数名类型解释
idstr用户的唯一ID
namestr用户的名称
genderSex性别,默认女
emailstr邮箱
mobilestr手机号码
qq_numberstrQQ号
_birthday_timestampfloat生日
avatarstr头像

Phase实现

class Phase(name: str='', code: str=""):
pass

学期,如七年级,八年级等


School实现

class School(id: str="",name: str=""):
pass

学校,id是该学校唯一的id,name是该学校的名称,如“XX市XX中学"


Sex实现

提示

继承自Enum

class Sex

性别


StuClass实现

class StuClass(
id: str = '',
name: str = '',
grade: Grade = <factory>,
school: School = <factory>):
pass

班级,id是该班级的唯一编号,name是该班级的友好名称(如高中 2022年1班, 初中 2022年1班小学 2022年1班


StuPerson实现

提示

继承自Person

class StuPerson(
id: str = '',
name: str = '',
gender: Sex = <Sex.GIRL: '女'>,
email: str = '',
mobile: str = '',
qq_number: str = '',
_birthday_timestamp: float = 0,
avatar: str = '',
code: str = '',
clazz: StuClass = <factory>):
pass

学生信息,code是准考证号,id是学生的唯一编号


StuPersonList实现

提示

继承自ExtendedList

def find_all_by_clazz(clazz: StuClass) -> ExtendedList[StuPerson][StuPerson]:
pass

返回所有班级为clazz的学生