lms.model.courses
1import typing 2 3import lms.model.base 4import lms.model.query 5 6class CourseQuery(lms.model.query.BaseQuery): 7 """ 8 A class for the different ways one can attempt to reference an LMS course. 9 In general, a course can be queried by: 10 - LMS Course ID (`id`) 11 - Full Name (`name`) 12 - f"{name} ({id})" 13 """ 14 15 _include_email = False 16 17class ResolvedCourseQuery(lms.model.query.ResolvedBaseQuery, CourseQuery): 18 """ 19 A CourseQuery that has been resolved (verified) from a real course instance. 20 """ 21 22 _include_email = False 23 24 def __init__(self, 25 course: 'Course', 26 **kwargs: typing.Any) -> None: 27 super().__init__(id = course.id, name = course.name, **kwargs) 28 29class Course(lms.model.base.BaseType): 30 """ 31 A course. 32 """ 33 34 CORE_FIELDS = [ 35 'id', 'name', 36 ] 37 38 def __init__(self, 39 id: typing.Union[str, int, None] = None, 40 name: typing.Union[str, None] = None, 41 **kwargs: typing.Any) -> None: 42 super().__init__(**kwargs) 43 44 if (id is None): 45 raise ValueError("Course must have an id.") 46 47 self.id: str = str(id) 48 """ The LMS's identifier for this course. """ 49 50 self.name: typing.Union[str, None] = name 51 """ The display name of this course. """ 52 53 def to_query(self) -> ResolvedCourseQuery: 54 """ Get a query representation of this course. """ 55 56 return ResolvedCourseQuery(self)
7class CourseQuery(lms.model.query.BaseQuery): 8 """ 9 A class for the different ways one can attempt to reference an LMS course. 10 In general, a course can be queried by: 11 - LMS Course ID (`id`) 12 - Full Name (`name`) 13 - f"{name} ({id})" 14 """ 15 16 _include_email = False
A class for the different ways one can attempt to reference an LMS course. In general, a course can be queried by:
18class ResolvedCourseQuery(lms.model.query.ResolvedBaseQuery, CourseQuery): 19 """ 20 A CourseQuery that has been resolved (verified) from a real course instance. 21 """ 22 23 _include_email = False 24 25 def __init__(self, 26 course: 'Course', 27 **kwargs: typing.Any) -> None: 28 super().__init__(id = course.id, name = course.name, **kwargs)
A CourseQuery that has been resolved (verified) from a real course instance.
ResolvedCourseQuery(course: Course, **kwargs: Any)
Inherited Members
30class Course(lms.model.base.BaseType): 31 """ 32 A course. 33 """ 34 35 CORE_FIELDS = [ 36 'id', 'name', 37 ] 38 39 def __init__(self, 40 id: typing.Union[str, int, None] = None, 41 name: typing.Union[str, None] = None, 42 **kwargs: typing.Any) -> None: 43 super().__init__(**kwargs) 44 45 if (id is None): 46 raise ValueError("Course must have an id.") 47 48 self.id: str = str(id) 49 """ The LMS's identifier for this course. """ 50 51 self.name: typing.Union[str, None] = name 52 """ The display name of this course. """ 53 54 def to_query(self) -> ResolvedCourseQuery: 55 """ Get a query representation of this course. """ 56 57 return ResolvedCourseQuery(self)
A course.
Course( id: Union[str, int, NoneType] = None, name: Optional[str] = None, **kwargs: Any)
39 def __init__(self, 40 id: typing.Union[str, int, None] = None, 41 name: typing.Union[str, None] = None, 42 **kwargs: typing.Any) -> None: 43 super().__init__(**kwargs) 44 45 if (id is None): 46 raise ValueError("Course must have an id.") 47 48 self.id: str = str(id) 49 """ The LMS's identifier for this course. """ 50 51 self.name: typing.Union[str, None] = name 52 """ The display name of this course. """
CORE_FIELDS =
['id', 'name']
The common fields shared across backends for this type that are used for comparison and other operations. Child classes should set this to define how comparisons are made.