diff --git a/lms/djangoapps/mobile_api/users/views.py b/lms/djangoapps/mobile_api/users/views.py index d959e188b4ee..b5b900b4504c 100644 --- a/lms/djangoapps/mobile_api/users/views.py +++ b/lms/djangoapps/mobile_api/users/views.py @@ -5,7 +5,7 @@ import logging from functools import cached_property -from typing import Optional +from typing import Optional, List from completion.exceptions import UnavailableCompletionData from completion.utilities import get_key_to_last_completed_block @@ -410,7 +410,7 @@ def get_queryset(self): # return all courses, with associated expiration return mobile_available - def get_same_org_mobile_available_enrollments(self) -> list[CourseEnrollment]: + def get_same_org_mobile_available_enrollments(self) -> List[CourseEnrollment]: """ Gets list with `CourseEnrollment` for mobile available courses. """ diff --git a/openedx/core/djangoapps/content_tagging/rest_api/v1/serializers.py b/openedx/core/djangoapps/content_tagging/rest_api/v1/serializers.py index 8bd26230855a..ac44cec2e12b 100644 --- a/openedx/core/djangoapps/content_tagging/rest_api/v1/serializers.py +++ b/openedx/core/djangoapps/content_tagging/rest_api/v1/serializers.py @@ -4,6 +4,8 @@ from __future__ import annotations +from typing import List + from rest_framework import serializers, fields from openedx_tagging.core.tagging.rest_api.v1.serializers import ( @@ -72,7 +74,7 @@ class TaxonomyOrgSerializer(TaxonomySerializer): orgs = serializers.SerializerMethodField() all_orgs = serializers.SerializerMethodField() - def get_orgs(self, obj) -> list[str]: + def get_orgs(self, obj) -> List[str]: """ Return the list of orgs for the taxonomy. """ diff --git a/openedx/core/djangoapps/content_tagging/rules.py b/openedx/core/djangoapps/content_tagging/rules.py index 72b744f5bf8e..84b4b701c7ac 100644 --- a/openedx/core/djangoapps/content_tagging/rules.py +++ b/openedx/core/djangoapps/content_tagging/rules.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, List import django.contrib.auth.models import openedx_tagging.core.tagging.rules as oel_tagging @@ -41,7 +41,7 @@ def is_org_user(user: UserType, orgs: list[Organization]) -> bool: return len(get_user_orgs(user, orgs)) > 0 -def get_admin_orgs(user: UserType, orgs: list[Organization] | None = None) -> list[Organization]: +def get_admin_orgs(user: UserType, orgs: list[Organization] | None = None) -> List[Organization]: """ Returns a list of orgs that the given user is an org-level staff, from the given list of orgs. @@ -53,7 +53,7 @@ def get_admin_orgs(user: UserType, orgs: list[Organization] | None = None) -> li ] -def _get_content_creator_orgs(user: UserType, orgs: list[Organization]) -> list[Organization]: +def _get_content_creator_orgs(user: UserType, orgs: list[Organization]) -> List[Organization]: """ Returns a list of orgs that the given user is an org-level library user or instructor, from the given list of orgs. """ @@ -66,7 +66,7 @@ def _get_content_creator_orgs(user: UserType, orgs: list[Organization]) -> list[ ] -def _get_course_user_orgs(user: UserType, orgs: list[Organization]) -> list[Organization]: +def _get_course_user_orgs(user: UserType, orgs: list[Organization]) -> List[Organization]: """ Returns a list of orgs for courses where the given user is staff or instructor, from the given list of orgs. @@ -97,7 +97,7 @@ def user_has_role_ignore_course_id(user, role_name, org_name) -> bool: ] -def _get_library_user_orgs(user: UserType, orgs: list[Organization]) -> list[Organization]: +def _get_library_user_orgs(user: UserType, orgs: list[Organization]) -> List[Organization]: """ Returns a list of orgs (from the given list of orgs) that are associated with libraries that the given user has explicitly been granted access to. @@ -110,7 +110,7 @@ def _get_library_user_orgs(user: UserType, orgs: list[Organization]) -> list[Org return list(set(library_orgs).intersection(orgs)) -def get_user_orgs(user: UserType, orgs: list[Organization] | None = None) -> list[Organization]: +def get_user_orgs(user: UserType, orgs: list[Organization] | None = None) -> List[Organization]: """ Return a list of orgs that the given user is a member of (instructor or content creator), from the given list of orgs. diff --git a/openedx/core/djangoapps/content_tagging/utils.py b/openedx/core/djangoapps/content_tagging/utils.py index 8cc9c9e7f7a9..5743abaf9a18 100644 --- a/openedx/core/djangoapps/content_tagging/utils.py +++ b/openedx/core/djangoapps/content_tagging/utils.py @@ -3,6 +3,8 @@ """ from __future__ import annotations +from typing import List + from edx_django_utils.cache import RequestCache from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey, UsageKey @@ -89,7 +91,7 @@ def clear(self): """ self.request_cache.clear() - def get_orgs(self, org_names: list[str] | None = None) -> list[Organization]: + def get_orgs(self, org_names: list[str] | None = None) -> List[Organization]: """ Returns the Organizations with the given name(s), or all Organizations if no names given. @@ -111,7 +113,7 @@ def get_orgs(self, org_names: list[str] | None = None) -> list[Organization]: return all_orgs.values() - def get_library_orgs(self, user, org_names: list[str]) -> list[Organization]: + def get_library_orgs(self, user, org_names: list[str]) -> List[Organization]: """ Returns the Organizations that are associated with libraries that the given user has explicitly been granted access to.