refactor: remove dead settings.FEATURES grabs in xmodule - #39016
Draft
feanil wants to merge 1 commit into
Draft
Conversation
xmodule/capa_block.py and xmodule/partitions/partitions_service.py each grabbed the
FEATURES dict at import time into a module-level variable that nothing reads:
FEATURES = getattr(settings, "FEATURES", {})
In capa_block this was orphaned when the flags it once gated were deprecated (the extracted
xblocks_contrib copy already omits it); in partitions_service it has been unused for a long
time. Neither module-level name is imported anywhere in the openedx GitHub org (confirmed by
org-wide code search) and AST analysis shows no reader.
Remove both assignments and the imports they leave unused: ImproperlyConfigured in
capa_block (settings is still used elsewhere and stays) and django.conf.settings in
partitions_service.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes two module-level
FEATURES = getattr(settings, "FEATURES", {})assignments that nothing reads.xmodule/capa_block.py— thetry/except ImproperlyConfiguredgrab was orphaned when the flags it once gated were deprecated. Nothing reads the module-levelFEATURES, and the extractedxblocks_contribcopy of this block already omits it. Also drops the now-unusedImproperlyConfiguredimport (settingsstays — it's used elsewhere).xmodule/partitions/partitions_service.py— long-unused module-level grab; drops the assignment and the now-unusedfrom django.conf import settingsimport.Safety
capa_block.FEATURESnorpartitions_service.FEATURESis imported anywhere in theopenedxGitHub org (org-wide code search: 0 hits).django.conf.settingsaliases +getattr) shows no reader of either.xmodule/partitions/tests/test_partitions.pyandxmodule/tests/test_capa_block.pypass (218); both modules import cleanly;ruffclean.