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

Support for nested classes and function for pyclbr #50940

Closed
gpolo mannequin opened this issue Aug 12, 2009 · 12 comments
Closed

Support for nested classes and function for pyclbr #50940

gpolo mannequin opened this issue Aug 12, 2009 · 12 comments
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@gpolo
Copy link
Mannequin

gpolo mannequin commented Aug 12, 2009

BPO 6691
Nosy @rhettinger, @terryjreedy, @amauryfa, @vstinner, @csabella
PRs
  • bpo-6691: Support for nested classes and functions in pyclbr #2503
  • Files
  • pyclbr_nested_objects.diff
  • pyclbr_nested_objects-py3k.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2017-07-04.01:40:09.953>
    created_at = <Date 2009-08-12.22:47:40.604>
    labels = ['3.7', 'type-feature', 'library']
    title = 'Support for nested classes and function for pyclbr'
    updated_at = <Date 2017-07-05.20:18:14.336>
    user = 'https://bugs.python.org/gpolo'

    bugs.python.org fields:

    activity = <Date 2017-07-05.20:18:14.336>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2017-07-04.01:40:09.953>
    closer = 'terry.reedy'
    components = ['Library (Lib)']
    creation = <Date 2009-08-12.22:47:40.604>
    creator = 'gpolo'
    dependencies = []
    files = ['14705', '19100']
    hgrepos = []
    issue_num = 6691
    keywords = ['patch']
    message_count = 12.0
    messages = ['91508', '112311', '117847', '297252', '297292', '297301', '297331', '297341', '297377', '297622', '297623', '297777']
    nosy_count = 6.0
    nosy_names = ['rhettinger', 'terry.reedy', 'amaury.forgeotdarc', 'vstinner', 'gpolo', 'cheryl.sabella']
    pr_nums = ['2503']
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue6691'
    versions = ['Python 3.7']

    @gpolo
    Copy link
    Mannequin Author

    gpolo mannequin commented Aug 12, 2009

    I have worked on a patch for adding support for nested classes and
    nested functions in pyclbr. I believe this might be useful for some
    applications, and also for bpo-1612262.

    The patch attached also contains a test and updated documentation.

    @gpolo gpolo mannequin added the stdlib Python modules in the Lib dir label Aug 12, 2009
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Aug 1, 2010

    Patch tested ok against 2.7 on windows vista. Patch seems clean to me, can we get this committed please.

    @amauryfa
    Copy link
    Member

    amauryfa commented Oct 1, 2010

    Too late for version 2. I updated patch for 3.2, and tried to improve the documentation a little bit.

    @terryjreedy terryjreedy added the type-feature A feature request or enhancement label Sep 14, 2015
    @terryjreedy
    Copy link
    Member

    Looking at the code, there are several references to nested classes, implying that they should already work. So I might want to claim this is a behavior issue, contrary to my adding 'enhancement' before. But moot point until patch is reviewed and otherwise ready to merge. And 3.7 would be better than never. The patch does have a new test.

    @csabella
    Copy link
    Contributor

    I'm working on a PR for this. It passed the existing test cases, but then I tried something that didn't pass, so I'm working on fixing that.

    @terryjreedy
    Copy link
    Member

    I would like to get this in 3.7.0a1, scheduled for 2017 Sept 9, and subsequently in 3.6.3.

    Cheryl, this is why I distracted you from the configdialog patch. As a non-idlelib patch, more discussion by more people may be needed before a merge.

    If this is not backported to 3.6 Lib/pyclbr, I will backport it to 3.6, maybe as Lib/idlelib/_pyclbr, or maybe as a direct addition to browser.py, replacing the import statement.

    @terryjreedy terryjreedy added the 3.7 (EOL) end of life label Jun 29, 2017
    @terryjreedy terryjreedy self-assigned this Jun 29, 2017
    @csabella
    Copy link
    Contributor

    I have the change ready to push. I didn't change the tests, except to fix what was failing earlier, so the tests would need to be reviewed (the test currently creates a real temporary file that it opened and read, but a Mock would be better?)

    Anyway, do you want me to make the PR with what I have or would you rather a new diff file?

    @terryjreedy
    Copy link
    Member

    PR. Also manually test classbrowser with the modified pyclbr and report what you see on your system.

    @csabella
    Copy link
    Contributor

    I've created the PR. I had actually manually looked at classbrowser yesterday. It still works just as it did before this change. The patch in 1612262 is needed for it to loop through the new Object class.

    Also, for reference, the test that didn't work initially was the case where anything was defined past the second level of nesting of a class, for example class -> def -> def or class -> def -> class. The original patch wasn't adding those last items, but now should be. Ironically, running this over test_pyclbr (to parse it, not to run the test), was where I saw that it wasn't showing all the nesting.

    @terryjreedy
    Copy link
    Member

    New changeset 246ff3b by terryjreedy (csabella) in branch 'master':
    bpo-6691: Pyclbr now reports nested classes and functions. (bpo-2503)
    246ff3b

    @terryjreedy
    Copy link
    Member

    Test_pyclbr could improve. There are notes on the PR for a new issue for that. If I find that further change is needed after applying to IDLE's module browser, bpo-1612262, that will be another new issue.

    @terryjreedy
    Copy link
    Member

    Unlinked bogus revert message. I checked the file and it has the new function.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants