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

IDLE: Revise ModuleBrowser API #75641

Closed
terryjreedy opened this issue Sep 13, 2017 · 5 comments
Closed

IDLE: Revise ModuleBrowser API #75641

terryjreedy opened this issue Sep 13, 2017 · 5 comments
Assignees
Labels
3.7 (EOL) end of life topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 31460
Nosy @terryjreedy, @csabella
PRs
  • bpo-31460: Simplify the API of IDLE's Module Browser. #3842
  • [3.6] bpo-31460: Simplify the API of IDLE's Module Browser. (GH-3842) #3843
  • 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-10-01.01:24:34.263>
    created_at = <Date 2017-09-13.21:33:39.952>
    labels = ['expert-IDLE', 'type-bug', '3.7']
    title = 'IDLE: Revise ModuleBrowser API'
    updated_at = <Date 2017-10-01.01:24:34.262>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2017-10-01.01:24:34.262>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2017-10-01.01:24:34.263>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2017-09-13.21:33:39.952>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31460
    keywords = ['patch']
    message_count = 5.0
    messages = ['302119', '302806', '303417', '303436', '303438']
    nosy_count = 2.0
    nosy_names = ['terry.reedy', 'cheryl.sabella']
    pr_nums = ['3842', '3843']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31460'
    versions = ['Python 3.6', 'Python 3.7']

    @terryjreedy
    Copy link
    Member Author

    The signature of browser.ClassBrowser(to be renamed ModuleBrowser).__init__ is

    def __init__(self, flist, name, path, _htest=False, _utest=False)

    flist is only used to access the application root. Change it to master. Then text can directly pass the test root.

    name and path are the split apart pieces of the module path, minus '.py', which are promptly rejoined, with '.py'. Callers always start valid path and have to split it and delete '.py' for the call. Let them pass the full path. A side-effect is that the browser will not work with a file without '.py'.

    ModuleBrowser can them split off the filename and remove a '.p?' extension, if present.

    The patch will have to change both .__init__ and callers, and ideally should somehow test that everything works.

    @terryjreedy terryjreedy added the 3.7 (EOL) end of life label Sep 13, 2017
    @terryjreedy terryjreedy self-assigned this Sep 13, 2017
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels Sep 13, 2017
    @terryjreedy
    Copy link
    Member Author

    I meant .py?, as in .py, .pyw, .pyo, not .p?

    @terryjreedy
    Copy link
    Member Author

    Menu item 'Module Browser' invokes '<<open-class-browser>>', which calls Editor_Window.open_module_browser. If the window is an actual editor, its path is used; otherwise open_module is called. In either case, ModuleBrowser is called with flist and path pieces.

    PathBrowser subclasses ModuleBrowser. Menu item 'Path Browser' invokes '<<open-path-browser>>', which calls Editor_Window.open_path_browser, which calles PathBrowser. PathBrowser.__init__'s only parameter is flist and it does not call ModuleBrowser.__init__. So the APIs are independent and can be modified or not separately.

    For ModuleBrowser, changing flist to master and changing (name, path) to to filepath can be done independently.

    @terryjreedy
    Copy link
    Member Author

    New changeset d6bb65f by Terry Jan Reedy in branch 'master':
    bpo-31460: Simplify the API of IDLE's Module Browser. (bpo-3842)
    d6bb65f

    @terryjreedy
    Copy link
    Member Author

    New changeset c8198c9 by Terry Jan Reedy in branch '3.6':
    [3.6] bpo-31460: Simplify the API of IDLE's Module Browser. (GH-3842) (bpo-3843)
    c8198c9

    @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 topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant