lms.model.assignments
1import typing 2 3import edq.util.time 4 5import lms.model.base 6import lms.model.query 7 8class AssignmentQuery(lms.model.query.BaseQuery): 9 """ 10 A class for the different ways one can attempt to reference an LMS assignment. 11 In general, an assignment can be queried by: 12 - LMS Assignment ID (`id`) 13 - Full Name (`name`) 14 - f"{name} ({id})" 15 """ 16 17 _include_email = False 18 19class ResolvedAssignmentQuery(lms.model.query.ResolvedBaseQuery, AssignmentQuery): 20 """ 21 A AssignmentQuery that has been resolved (verified) from a real assignment instance. 22 """ 23 24 _include_email = False 25 26 def __init__(self, 27 assignment: 'Assignment', 28 **kwargs: typing.Any) -> None: 29 super().__init__(id = assignment.id, name = assignment.name, **kwargs) 30 31class Assignment(lms.model.base.BaseType): 32 """ 33 An assignment within a course. 34 """ 35 36 CORE_FIELDS = [ 37 'id', 'name', 'description', 38 'open_date', 'close_date', 'due_date', 39 'points_possible', 40 ] 41 42 def __init__(self, 43 id: typing.Union[str, int, None] = None, 44 name: typing.Union[str, None] = None, 45 description: typing.Union[str, None] = None, 46 open_date: typing.Union[edq.util.time.Timestamp, None] = None, 47 close_date: typing.Union[edq.util.time.Timestamp, None] = None, 48 due_date: typing.Union[edq.util.time.Timestamp, None] = None, 49 points_possible: typing.Union[float, None] = None, 50 **kwargs: typing.Any) -> None: 51 super().__init__(**kwargs) 52 53 if (id is None): 54 raise ValueError("Assignment must have an id.") 55 56 self.id: str = str(id) 57 """ The LMS's identifier for this assignment. """ 58 59 self.name: typing.Union[str, None] = name 60 """ The display name of this assignment. """ 61 62 self.description: typing.Union[str, None] = description 63 """ The description of this assignment. """ 64 65 self.open_date: typing.Union[edq.util.time.Timestamp, None] = open_date 66 """ The datetime that this assignment opens at. """ 67 68 self.close_date: typing.Union[edq.util.time.Timestamp, None] = close_date 69 """ The datetime that this assignment closes at. """ 70 71 self.due_date: typing.Union[edq.util.time.Timestamp, None] = due_date 72 """ The datetime that this assignment is due at. """ 73 74 self.points_possible: typing.Union[float, None] = points_possible 75 """ The maximum number of points possible for this assignment. """ 76 77 def to_query(self) -> ResolvedAssignmentQuery: 78 """ Get a query representation of this assignment. """ 79 80 return ResolvedAssignmentQuery(self) 81 82 def get_label(self) -> str: 83 """ Get the label for this assignment. """ 84 85 return f"{self.name} ({self.id})"
9class AssignmentQuery(lms.model.query.BaseQuery): 10 """ 11 A class for the different ways one can attempt to reference an LMS assignment. 12 In general, an assignment can be queried by: 13 - LMS Assignment ID (`id`) 14 - Full Name (`name`) 15 - f"{name} ({id})" 16 """ 17 18 _include_email = False
A class for the different ways one can attempt to reference an LMS assignment. In general, an assignment can be queried by:
20class ResolvedAssignmentQuery(lms.model.query.ResolvedBaseQuery, AssignmentQuery): 21 """ 22 A AssignmentQuery that has been resolved (verified) from a real assignment instance. 23 """ 24 25 _include_email = False 26 27 def __init__(self, 28 assignment: 'Assignment', 29 **kwargs: typing.Any) -> None: 30 super().__init__(id = assignment.id, name = assignment.name, **kwargs)
A AssignmentQuery that has been resolved (verified) from a real assignment instance.
ResolvedAssignmentQuery(assignment: Assignment, **kwargs: Any)
Inherited Members
32class Assignment(lms.model.base.BaseType): 33 """ 34 An assignment within a course. 35 """ 36 37 CORE_FIELDS = [ 38 'id', 'name', 'description', 39 'open_date', 'close_date', 'due_date', 40 'points_possible', 41 ] 42 43 def __init__(self, 44 id: typing.Union[str, int, None] = None, 45 name: typing.Union[str, None] = None, 46 description: typing.Union[str, None] = None, 47 open_date: typing.Union[edq.util.time.Timestamp, None] = None, 48 close_date: typing.Union[edq.util.time.Timestamp, None] = None, 49 due_date: typing.Union[edq.util.time.Timestamp, None] = None, 50 points_possible: typing.Union[float, None] = None, 51 **kwargs: typing.Any) -> None: 52 super().__init__(**kwargs) 53 54 if (id is None): 55 raise ValueError("Assignment must have an id.") 56 57 self.id: str = str(id) 58 """ The LMS's identifier for this assignment. """ 59 60 self.name: typing.Union[str, None] = name 61 """ The display name of this assignment. """ 62 63 self.description: typing.Union[str, None] = description 64 """ The description of this assignment. """ 65 66 self.open_date: typing.Union[edq.util.time.Timestamp, None] = open_date 67 """ The datetime that this assignment opens at. """ 68 69 self.close_date: typing.Union[edq.util.time.Timestamp, None] = close_date 70 """ The datetime that this assignment closes at. """ 71 72 self.due_date: typing.Union[edq.util.time.Timestamp, None] = due_date 73 """ The datetime that this assignment is due at. """ 74 75 self.points_possible: typing.Union[float, None] = points_possible 76 """ The maximum number of points possible for this assignment. """ 77 78 def to_query(self) -> ResolvedAssignmentQuery: 79 """ Get a query representation of this assignment. """ 80 81 return ResolvedAssignmentQuery(self) 82 83 def get_label(self) -> str: 84 """ Get the label for this assignment. """ 85 86 return f"{self.name} ({self.id})"
An assignment within a course.
Assignment( id: Union[str, int, NoneType] = None, name: Optional[str] = None, description: Optional[str] = None, open_date: Optional[edq.util.time.Timestamp] = None, close_date: Optional[edq.util.time.Timestamp] = None, due_date: Optional[edq.util.time.Timestamp] = None, points_possible: Optional[float] = None, **kwargs: Any)
43 def __init__(self, 44 id: typing.Union[str, int, None] = None, 45 name: typing.Union[str, None] = None, 46 description: typing.Union[str, None] = None, 47 open_date: typing.Union[edq.util.time.Timestamp, None] = None, 48 close_date: typing.Union[edq.util.time.Timestamp, None] = None, 49 due_date: typing.Union[edq.util.time.Timestamp, None] = None, 50 points_possible: typing.Union[float, None] = None, 51 **kwargs: typing.Any) -> None: 52 super().__init__(**kwargs) 53 54 if (id is None): 55 raise ValueError("Assignment must have an id.") 56 57 self.id: str = str(id) 58 """ The LMS's identifier for this assignment. """ 59 60 self.name: typing.Union[str, None] = name 61 """ The display name of this assignment. """ 62 63 self.description: typing.Union[str, None] = description 64 """ The description of this assignment. """ 65 66 self.open_date: typing.Union[edq.util.time.Timestamp, None] = open_date 67 """ The datetime that this assignment opens at. """ 68 69 self.close_date: typing.Union[edq.util.time.Timestamp, None] = close_date 70 """ The datetime that this assignment closes at. """ 71 72 self.due_date: typing.Union[edq.util.time.Timestamp, None] = due_date 73 """ The datetime that this assignment is due at. """ 74 75 self.points_possible: typing.Union[float, None] = points_possible 76 """ The maximum number of points possible for this assignment. """
CORE_FIELDS =
['id', 'name', 'description', 'open_date', 'close_date', 'due_date', 'points_possible']
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.
78 def to_query(self) -> ResolvedAssignmentQuery: 79 """ Get a query representation of this assignment. """ 80 81 return ResolvedAssignmentQuery(self)
Get a query representation of this assignment.