fix: incorrect type hints in a few places (#33104)

This commit is contained in:
Braden MacDonald
2023-08-28 10:34:08 -07:00
committed by GitHub
parent 776f4bf94e
commit a013c08ae6
3 changed files with 7 additions and 7 deletions

View File

@@ -1,11 +1,12 @@
# lint-amnesty, pylint: disable=missing-module-docstring # lint-amnesty, pylint: disable=missing-module-docstring
from __future__ import annotations
import logging import logging
from collections import defaultdict # lint-amnesty, pylint: disable=unused-import from collections import defaultdict # lint-amnesty, pylint: disable=unused-import
from datetime import datetime, timedelta from datetime import datetime, timedelta
from typing import Dict
from edx_when.api import get_dates_for_course 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 openedx.core import types
from common.djangoapps.student.auth import user_has_role 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): def __init__(self, course_key: CourseKey, user: types.User, at_time: datetime):
super().__init__(course_key, user, at_time) super().__init__(course_key, user, at_time)
self.dates = None 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_start = None
self._course_end = None self._course_end = None
self._is_beta_tester = False self._is_beta_tester = False

View File

@@ -63,4 +63,4 @@ class StagedContentFileData:
class UserClipboardData: class UserClipboardData:
""" Read-only data model for User Clipboard data (copied OLX) """ """ Read-only data model for User Clipboard data (copied OLX) """
content: StagedContentData = field(validator=validators.instance_of(StagedContentData)) 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]

View File

@@ -3,13 +3,12 @@ This is a service-like API that assigns tracks which groups users are in for var
user partitions. It uses the user_service key/value store provided by the LMS runtime to user partitions. It uses the user_service key/value store provided by the LMS runtime to
persist the assignments. persist the assignments.
""" """
import logging import logging
from typing import Dict from typing import Dict
from django.conf import settings from django.conf import settings
from django.contrib.auth import get_user_model 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.cache_utils import request_cached
from openedx.core.lib.dynamic_partitions_generators import DynamicPartitionGeneratorsPluginManager 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 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]: partition_dict_key: str = 'name') -> Dict[str, Group]:
""" """
Collect group ID for each partition in this course for this user. Collect group ID for each partition in this course for this user.