After we merged this PR: https://github.com/openedx/edx-platform/pull/33920 this error began popping up in logs: Unable to load XBlock 'staffgradedxblock' .... ImportError: cannot import name 'get_course_blocks' from partially initialized module 'lms.djangoapps.course_blocks.api' (most likely due to a circular import) ... The root cause was the new imports of `derived_key` and `BlockKey` into xmodule/library_content_block.py. Those new imports come from xmodule/modulestore/store_utilities.py, which runs `XBlock.load_classes()` at the module level, which fails because we are still in the process of loading xmodule/library_content_block. As a solution, we move both `derived_key` and `BlockKey` to xmodule/util/keys.py. We could potentially move that file to opaque-keys eventually, depending on how well we think that those concepts generalize. Also: * We rename the function from derived_key to derive_key, as functions should be verbs. * We combine the first to parameters of derive_key (a source ContextKey and a source BlockKey) into a single parameter (a source UsageKey). In my opinion, this makes the function call easier to understand.
64 lines
1.7 KiB
INI
64 lines
1.7 KiB
INI
[mypy]
|
|
follow_imports = silent
|
|
ignore_missing_imports = True
|
|
allow_untyped_globals = True
|
|
plugins =
|
|
mypy_django_plugin.main,
|
|
mypy_drf_plugin.main
|
|
files =
|
|
openedx/core/djangoapps/content/learning_sequences/,
|
|
openedx/core/djangoapps/content_staging,
|
|
openedx/core/djangoapps/content_libraries,
|
|
openedx/core/djangoapps/xblock,
|
|
openedx/core/types,
|
|
openedx/core/djangoapps/content_tagging,
|
|
xmodule/util/keys.py
|
|
|
|
[mypy.plugins.django-stubs]
|
|
# content_staging only works with CMS; others work with either, so we run mypy with CMS settings.
|
|
django_settings_module = "cms.envs.test"
|
|
|
|
# Selectively ignore packages known to be lacking type hints
|
|
[mypy-bridgekeeper.*]
|
|
ignore_missing_imports = True
|
|
[mypy-celery.*]
|
|
ignore_missing_imports = True
|
|
[mypy-celery_utils.*]
|
|
ignore_missing_imports = True
|
|
[mypy-completion.*]
|
|
ignore_missing_imports = True
|
|
[mypy-crum.*]
|
|
ignore_missing_imports = True
|
|
[mypy-ddt.*]
|
|
ignore_missing_imports = True
|
|
[mypy-edx_api_doc_tools.*]
|
|
ignore_missing_imports = True
|
|
[mypy-edx_django_utils.*]
|
|
ignore_missing_imports = True
|
|
[mypy-edx_proctoring.*]
|
|
ignore_missing_imports = True
|
|
[mypy-edx_rest_api_client.*]
|
|
ignore_missing_imports = True
|
|
[mypy-edx_rest_framework_extensions.*]
|
|
ignore_missing_imports = True
|
|
[mypy-eventtracking.*]
|
|
ignore_missing_imports = True
|
|
[mypy-fs.*]
|
|
ignore_missing_imports = True
|
|
[mypy-model_utils.*]
|
|
ignore_missing_imports = True
|
|
[mypy-openedx_events.*]
|
|
ignore_missing_imports = True
|
|
[mypy-organizations.*]
|
|
ignore_missing_imports = True
|
|
[mypy-search.*]
|
|
ignore_missing_imports = True
|
|
[mypy-rules.*]
|
|
ignore_missing_imports = True
|
|
[mypy-web_fragments.*]
|
|
ignore_missing_imports = True
|
|
[mypy-webob.*]
|
|
ignore_missing_imports = True
|
|
[mypy-xblock.*]
|
|
ignore_missing_imports = True
|