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

Unused imports, variables, file in IDLE #67373

Closed
AlSweigart mannequin opened this issue Jan 7, 2015 · 11 comments
Closed

Unused imports, variables, file in IDLE #67373

AlSweigart mannequin opened this issue Jan 7, 2015 · 11 comments
Assignees
Labels
topic-IDLE type-feature A feature request or enhancement

Comments

@AlSweigart
Copy link
Mannequin

AlSweigart mannequin commented Jan 7, 2015

BPO 23184
Nosy @terryjreedy
Files
  • idle_unused_patch.diff: Patch for this change
  • idle_unused_patch2.diff
  • @unused.diff
  • @unused27.diff
  • 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 2015-05-16.03:56:48.174>
    created_at = <Date 2015-01-07.10:26:51.471>
    labels = ['expert-IDLE', 'type-feature']
    title = 'Unused imports, variables, file in IDLE'
    updated_at = <Date 2015-05-16.03:56:48.173>
    user = 'https://bugs.python.org/AlSweigart'

    bugs.python.org fields:

    activity = <Date 2015-05-16.03:56:48.173>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2015-05-16.03:56:48.174>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2015-01-07.10:26:51.471>
    creator = 'Al.Sweigart'
    dependencies = []
    files = ['37626', '37651', '39375', '39376']
    hgrepos = []
    issue_num = 23184
    keywords = ['patch']
    message_count = 11.0
    messages = ['233573', '233606', '233623', '233624', '233716', '233717', '243230', '243231', '243239', '243293', '243294']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'python-dev', 'Al.Sweigart']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue23184'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @AlSweigart
    Copy link
    Mannequin Author

    AlSweigart mannequin commented Jan 7, 2015

    The IDLE code base has several unused imports and local variables. The testcode.py file seems to have been accidentally checked in.

    These changes were found through a lint program, not by hand. All idle unit tests pass after these changes.

    @AlSweigart AlSweigart mannequin added topic-IDLE type-bug An unexpected behavior, bug, or error labels Jan 7, 2015
    @terryjreedy
    Copy link
    Member

    I am aware of some of these from running PyChecker over idlelib, but had not gotten around to an global patch yet. The unit test coverage is still woefully incomplete, so I will want to check each deletion.

    I have been meaning to delete testcode.py, but in a separate commit.

    @terryjreedy terryjreedy self-assigned this Jan 7, 2015
    @terryjreedy terryjreedy added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Jan 7, 2015
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 8, 2015

    New changeset 1c3f8d044589 by Terry Jan Reedy in branch '2.7':
    Issue bpo-23184: delete unused idlelib file.
    https://hg.python.org/cpython/rev/1c3f8d044589

    New changeset 364e44a49a31 by Terry Jan Reedy in branch '3.4':
    Issue bpo-23184: delete unused idlelib file.
    https://hg.python.org/cpython/rev/364e44a49a31

    @terryjreedy
    Copy link
    Member

    There were errors in the patch.
    FileList.py: EditorWindow is used later.
    RemoteDebugger.py: frame is used twice, as visible in the diff.
    My copy of hg is not working right at the moment, or I would have applied the rest.

    @AlSweigart
    Copy link
    Mannequin Author

    AlSweigart mannequin commented Jan 9, 2015

    I've updated the patch.

    I've removed the EditorWindow deletion. Importing that and using it as a class variable instead of using an assignment statement wasn't picked up. (Is there a more opaque way to do this import?)

    I've left the RemoteDebugger.py change in. The frame variable name is (confusingly) reused:

            frame = frametable[fid]
            # ...cut for brevity...
            stack, i = self.idb.get_stack(frame, tb)
            stack = [(wrap_frame(frame), k) for frame, k in stack]

    Changed to:

        # ...cut for brevity...
        stack, i = self.idb.get_stack(frametable[fid], tb)
        stack = [(wrap_frame(frame), k) for frame, k in stack]
    

    The first use of frame is eliminated by simply using frametable[fid] instead. The second use is as the temporary variable inside the list comprehension, which means the "frame" name is reused. With this change, the only time the frame local variable is used is in the list comprehension. This gets rid of the name reuse and makes it a bit simpler.

    @AlSweigart
    Copy link
    Mannequin Author

    AlSweigart mannequin commented Jan 9, 2015

    *more transparent, that is. Not opaque.

    @terryjreedy
    Copy link
    Member

    I got hg working and pushed the patch I had in January as a980da5f79f9, 5386aedf3ac9, 15701e89d710, and 3fa58e779308. Having forgotten that this issue was on the tracker (rather than just idle-sig post), I omitted the issue number and acknowledgement for the initial patch. I will add both when I add a new entry.

    I am working on another patch to include maxOsSupport and other changes found by pyflakes. I will add in the 'frame' change, the double use *is* confusing.

    pyflakes identifies files with * imports with a note that this prevents checks. I try to removed them when adding tests. I might do more just to make files checkable.

    @terryjreedy
    Copy link
    Member

    News entry, not new entry (Cannot edit commit messages)

    @terryjreedy
    Copy link
    Member

    More idlelib fixes. Will push after reviewing. pyflakes shows extraneous items in idle_test also.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 16, 2015

    New changeset d50d661a08f5 by Terry Jan Reedy in branch '2.7':
    Issue bpo-23184: idlelib, remove more unused names and imports.
    https://hg.python.org/cpython/rev/d50d661a08f5

    New changeset 777569dd4bca by Terry Jan Reedy in branch '3.4':
    Issue bpo-23184: idlelib, remove more unused names and imports.
    https://hg.python.org/cpython/rev/777569dd4bca

    New changeset 6c424b06320b by Terry Jan Reedy in branch 'default':
    Merge with 3.4 Issue bpo-23184: idlelib, remove more unused names and imports.
    https://hg.python.org/cpython/rev/6c424b06320b

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 16, 2015

    New changeset 8875d7c6a99d by Terry Jan Reedy in branch '2.7':
    Issue bpo-23184: idle tests, remove unused names and imports.
    https://hg.python.org/cpython/rev/8875d7c6a99d

    New changeset 526ce81f700d by Terry Jan Reedy in branch '3.4':
    Issue bpo-23184: idle tests, remove unused names and imports.
    https://hg.python.org/cpython/rev/526ce81f700d

    New changeset 2a56eb5c08cc by Terry Jan Reedy in branch 'default':
    Merge 3.4 bpo-23184: idle tests, remove unused names and imports.
    https://hg.python.org/cpython/rev/2a56eb5c08cc

    @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
    topic-IDLE type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant