Skip to content

Commit

Permalink
refactor: add type hints to filter/order functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Dec 4, 2024
1 parent aba2b9f commit 5461fa1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.core.exceptions import FieldError, PermissionDenied, ValidationError as DjangoValidationError
from django.db.models import QuerySet
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseNotFound
from django.shortcuts import redirect
from django.urls import reverse
Expand Down Expand Up @@ -592,7 +593,7 @@ def filter_ccx(course_access):
return courses_list, []


def get_courses_by_status(active_only, archived_only, course_overviews):
def get_courses_by_status(active_only: bool, archived_only: bool, course_overviews: QuerySet[CourseOverview]):
"""
Return course overviews based on a base queryset filtered by a status.
Expand All @@ -606,7 +607,7 @@ def get_courses_by_status(active_only, archived_only, course_overviews):
return CourseOverview.get_courses_by_status(active_only, archived_only, course_overviews)


def get_courses_by_search_query(search_query, course_overviews):
def get_courses_by_search_query(search_query: str | None, course_overviews: QuerySet[CourseOverview]):
"""Return course overviews based on a base queryset filtered by a search query.
Args:
Expand All @@ -618,7 +619,7 @@ def get_courses_by_search_query(search_query, course_overviews):
return CourseOverview.get_courses_matching_query(search_query, course_overviews=course_overviews)


def get_courses_order_by(order_query, course_overviews):
def get_courses_order_by(order_query: str | None, course_overviews: QuerySet[CourseOverview]):
"""Return course overviews based on a base queryset ordered by a query.
Args:
Expand Down

0 comments on commit 5461fa1

Please sign in to comment.