Skip to content

Commit

Permalink
chore: address mypy/pylint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Oct 11, 2024
1 parent 89f369c commit d90a334
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions openedx/core/djangoapps/xblock/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def render_block_view(block, view_name, user): # pylint: disable=unused-argumen
def get_handler_url(
usage_key: UsageKeyV2,
handler_name: str,
user: UserType,
user: UserType | None,
*,
version: int | LatestVersion = LatestVersion.AUTO,
):
Expand Down Expand Up @@ -281,9 +281,9 @@ def get_handler_url(
"""
usage_key_str = str(usage_key)
site_root_url = get_xblock_app_config().get_site_root_url()
if not user: # lint-amnesty, pylint: disable=no-else-raise
if not user:
raise TypeError("Cannot get handler URLs without specifying a specific user ID.")
elif user.is_authenticated:
if user.is_authenticated:
user_id = user.id
elif user.is_anonymous:
user_id = get_xblock_id_for_anonymous_user(user)
Expand Down
11 changes: 6 additions & 5 deletions openedx/core/djangoapps/xblock/runtime/runtime.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""
Common base classes for all new XBlock runtimes.
"""
from __future__ import annotations
import logging
from typing import Callable, Optional, Protocol
from typing import Callable, Protocol
from urllib.parse import urljoin # pylint: disable=import-error

import crum
Expand Down Expand Up @@ -68,7 +67,7 @@ def __call__(
self,
usage_key: UsageKeyV2,
handler_name: str,
user: UserType,
user: UserType | None,
*,
version: int | LatestVersion = LatestVersion.AUTO,
) -> str:
Expand Down Expand Up @@ -106,6 +105,8 @@ class XBlockRuntime(RuntimeShim, Runtime):
# keep track of view name (student_view, studio_view, etc)
# currently only used to track if we're in the studio_view (see below under service())
view_name: str | None
# backing store for authored field data (mostly content+settings scopes)
authored_data_store: FieldData

def __init__(
self,
Expand All @@ -114,8 +115,8 @@ def __init__(
handler_url: GetHandlerFunction,
student_data_mode: StudentDataMode,
authored_data_mode: AuthoredDataMode,
id_reader: Optional[IdReader] = None,
authored_data_store: Optional[FieldData] = None,
authored_data_store: FieldData,
id_reader: IdReader | None = None,
):
super().__init__(
id_reader=id_reader or OpaqueKeyReader(),
Expand Down

0 comments on commit d90a334

Please sign in to comment.