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

feat: Make dump for fns, classes more stable and helpful #36188

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

kdmccormick
Copy link
Member

Description

This is a light iteration on #36162, making the dump_settings management command more helpful and stable for functions and classes.

Supporting information

In particular, the dump_settings command currently prints out the raw repr(...)s for defined functions:

    "WIKI_CAN_ASSIGN": "<function CAN_ASSIGN at 0x74ce5e9b2020>",
    "WIKI_CAN_CHANGE_PERMISSIONS": "<function CAN_CHANGE_PERMISSIONS at 0x74ce5e9b1f80>",
    "WIKI_CAN_DELETE": "<function CAN_DELETE at 0x74ce5e9b1b20>",
    "WIKI_CAN_MODERATE": "<function CAN_MODERATE at 0x74ce5e9b1bc0>",

In addition to being uninformative, these at 0x123abc... hashes change every run, so they appear in the diff as having "changed" every time.

With this PR, here's what dump_settings will print out for functions:

    "WIKI_CAN_ASSIGN": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_ASSIGN"
    },
    "WIKI_CAN_CHANGE_PERMISSIONS": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_CHANGE_PERMISSIONS"
    },
    "WIKI_CAN_DELETE": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_DELETE"
    },
    "WIKI_CAN_MODERATE": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_MODERATE"
    },

It will do something similarly helpful for classes and lambdas.

Deadline

Asap, as this unblocks several pending settings refactorings.

@kdmccormick kdmccormick requested review from feanil and dcoa January 28, 2025 20:39
@kdmccormick
Copy link
Member Author

@feanil or @dianakhuang , can one of you take a look?

@kdmccormick kdmccormick merged commit 98a4a32 into openedx:master Jan 29, 2025
49 checks passed
@kdmccormick kdmccormick deleted the kdmccormick/dump-settings-2 branch January 29, 2025 16:06
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

leoaulasneo98 pushed a commit to aulasneo/edx-platform that referenced this pull request Jan 30, 2025
The `dump_settings` command currently prints out the raw `repr(...)`s for
defined functions, e.g.:

    "WIKI_CAN_ASSIGN": "<function CAN_ASSIGN at 0x74ce5e9b2020>",

In addition to being uninformative, these `at 0x74ce...` hashes change every
run, so they appear in the diff as having "changed" every time. With this
commit, here's what `dump_settings` will print out for a function instead:

    "WIKI_CAN_ASSIGN": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_ASSIGN"
    },
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.

3 participants