Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: incorrect type hints in a few places #33104

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/content_staging/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning here was openedx/core/djangoapps/content_staging/data.py:66: error: Only concrete class can be given where "Type[UsageKey]" is expected [type-abstract]

I don't think it's a valid warning so I've just ignored it.

5 changes: 2 additions & 3 deletions xmodule/partitions/partitions_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
Loading