diff --git a/openedx/core/djangoapps/content/learning_sequences/api/processors/schedule.py b/openedx/core/djangoapps/content/learning_sequences/api/processors/schedule.py index 643559e51a90..7d6e373b43e1 100644 --- a/openedx/core/djangoapps/content/learning_sequences/api/processors/schedule.py +++ b/openedx/core/djangoapps/content/learning_sequences/api/processors/schedule.py @@ -1,11 +1,12 @@ # lint-amnesty, pylint: disable=missing-module-docstring +from __future__ import annotations + import logging from collections import defaultdict # lint-amnesty, pylint: disable=unused-import from datetime import datetime, timedelta -from typing import Dict from edx_when.api import get_dates_for_course -from opaque_keys.edx.keys import CourseKey # lint-amnesty, pylint: disable=unused-import +from opaque_keys.edx.keys import UsageKey, CourseKey # lint-amnesty, pylint: disable=unused-import from openedx.core import types from common.djangoapps.student.auth import user_has_role @@ -37,7 +38,7 @@ class ScheduleOutlineProcessor(OutlineProcessor): def __init__(self, course_key: CourseKey, user: types.User, at_time: datetime): super().__init__(course_key, user, at_time) self.dates = None - self.keys_to_schedule_fields: Dict[str, Dict[str, datetime]] = defaultdict(dict) + self.keys_to_schedule_fields: dict[UsageKey, dict[str, datetime]] = defaultdict(dict) self._course_start = None self._course_end = None self._is_beta_tester = False diff --git a/openedx/core/djangoapps/content_staging/data.py b/openedx/core/djangoapps/content_staging/data.py index a33dcca470a1..4f42de9c6ef9 100644 --- a/openedx/core/djangoapps/content_staging/data.py +++ b/openedx/core/djangoapps/content_staging/data.py @@ -63,4 +63,4 @@ class StagedContentFileData: class UserClipboardData: """ Read-only data model for User Clipboard data (copied OLX) """ content: StagedContentData = field(validator=validators.instance_of(StagedContentData)) - source_usage_key: UsageKey = field(validator=validators.instance_of(UsageKey)) + source_usage_key: UsageKey = field(validator=validators.instance_of(UsageKey)) # type: ignore[type-abstract] diff --git a/xmodule/partitions/partitions_service.py b/xmodule/partitions/partitions_service.py index 57fd8b61ae26..e0d976dad7ad 100644 --- a/xmodule/partitions/partitions_service.py +++ b/xmodule/partitions/partitions_service.py @@ -3,13 +3,12 @@ user partitions. It uses the user_service key/value store provided by the LMS runtime to persist the assignments. """ - - import logging from typing import Dict from django.conf import settings from django.contrib.auth import get_user_model +from opaque_keys.edx.keys import CourseKey from openedx.core.lib.cache_utils import request_cached from openedx.core.lib.dynamic_partitions_generators import DynamicPartitionGeneratorsPluginManager @@ -44,7 +43,7 @@ def get_all_partitions_for_course(course, active_only=False): return all_partitions -def get_user_partition_groups(course_key: str, user_partitions: list, user: User, +def get_user_partition_groups(course_key: CourseKey, user_partitions: list, user: User, partition_dict_key: str = 'name') -> Dict[str, Group]: """ Collect group ID for each partition in this course for this user.