Skip to content

Commit

Permalink
Support None as input
Browse files Browse the repository at this point in the history
  • Loading branch information
BelKed committed Jul 16, 2024
1 parent 98bce68 commit de806d8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion edupage_api/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_classes(self) -> Optional[list]:
def get_class(self, class_id: int | str) -> Optional[Class]:
try:
class_id = int(class_id)
except ValueError:
except (ValueError, TypeError):
return None

return next(
Expand Down
2 changes: 1 addition & 1 deletion edupage_api/classrooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_classrooms(self) -> Optional[list]:
def get_classroom(self, classroom_id: int | str) -> Optional[Classroom]:
try:
classroom_id = int(classroom_id)
except ValueError:
except (ValueError, TypeError):
return None

return next(
Expand Down
4 changes: 2 additions & 2 deletions edupage_api/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def get_all_students(self) -> Optional[list[EduStudent]]:
def get_teacher(self, teacher_id: int | str) -> Optional[EduTeacher]:
try:
teacher_id = int(teacher_id)
except ValueError:
except (ValueError, TypeError):
return None

return next(
Expand All @@ -234,7 +234,7 @@ def get_teacher(self, teacher_id: int | str) -> Optional[EduTeacher]:
def get_student(self, student_id: int | str) -> Optional[EduStudent]:
try:
student_id = int(student_id)
except ValueError:
except (ValueError, TypeError):
return None

return next(
Expand Down
2 changes: 1 addition & 1 deletion edupage_api/subjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_subjects(self) -> Optional[list]:
def get_subject(self, subject_id: int | str) -> Optional[Subject]:
try:
subject_id = int(subject_id)
except ValueError:
except (ValueError, TypeError):
return None

return next(
Expand Down

0 comments on commit de806d8

Please sign in to comment.