Skip to content

refactor: remove dead settings.FEATURES grabs in xmodule - #39016

Draft
feanil wants to merge 1 commit into
masterfrom
feanil/features-dict-remove-dead-getattr
Draft

refactor: remove dead settings.FEATURES grabs in xmodule#39016
feanil wants to merge 1 commit into
masterfrom
feanil/features-dict-remove-dead-getattr

Conversation

@feanil

@feanil feanil commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Removes two module-level FEATURES = getattr(settings, "FEATURES", {}) assignments that nothing reads.

  • xmodule/capa_block.py — the try/except ImproperlyConfigured grab was orphaned when the flags it once gated were deprecated. Nothing reads the module-level FEATURES, and the extracted xblocks_contrib copy of this block already omits it. Also drops the now-unused ImproperlyConfigured import (settings stays — it's used elsewhere).
  • xmodule/partitions/partitions_service.py — long-unused module-level grab; drops the assignment and the now-unused from django.conf import settings import.

Safety

  • Neither capa_block.FEATURES nor partitions_service.FEATURES is imported anywhere in the openedx GitHub org (org-wide code search: 0 hits).
  • AST analysis of the app tree (resolving django.conf.settings aliases + getattr) shows no reader of either.
  • xmodule/partitions/tests/test_partitions.py and xmodule/tests/test_capa_block.py pass (218); both modules import cleanly; ruff clean.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant