classification
Title: Unused imports, variables, file in IDLE
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.5, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Al.Sweigart, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2015-01-07 10:26 by Al.Sweigart, last changed 2015-05-16 03:56 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
idle_unused_patch.diff Al.Sweigart, 2015-01-07 10:26 Patch for this change review
idle_unused_patch2.diff Al.Sweigart, 2015-01-09 05:45 review
@unused.diff terry.reedy, 2015-05-15 02:13 review
@unused27.diff terry.reedy, 2015-05-15 02:13 review
Messages (11)
msg233573 - (view) Author: Al Sweigart (Al.Sweigart) * Date: 2015-01-07 10:26
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.
msg233606 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-01-07 22:03
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.
msg233623 - (view) Author: Roundup Robot (python-dev) Date: 2015-01-08 04:49
New changeset 1c3f8d044589 by Terry Jan Reedy in branch '2.7':
Issue #23184: delete unused idlelib file.
https://hg.python.org/cpython/rev/1c3f8d044589

New changeset 364e44a49a31 by Terry Jan Reedy in branch '3.4':
Issue #23184: delete unused idlelib file.
https://hg.python.org/cpython/rev/364e44a49a31
msg233624 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-01-08 06:14
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.
msg233716 - (view) Author: Al Sweigart (Al.Sweigart) * Date: 2015-01-09 05:45
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.
msg233717 - (view) Author: Al Sweigart (Al.Sweigart) * Date: 2015-01-09 05:46
*more transparent, that is. Not opaque.
msg243230 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-05-14 23:13
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.
msg243231 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-05-14 23:14
News entry, not new entry  (Cannot edit commit messages)
msg243239 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-05-15 02:13
More idlelib fixes. Will push after reviewing.  pyflakes shows extraneous items in idle_test also.
msg243293 - (view) Author: Roundup Robot (python-dev) Date: 2015-05-16 03:04
New changeset d50d661a08f5 by Terry Jan Reedy in branch '2.7':
Issue #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 #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 #23184: idlelib, remove more unused names and imports.
https://hg.python.org/cpython/rev/6c424b06320b
msg243294 - (view) Author: Roundup Robot (python-dev) Date: 2015-05-16 03:56
New changeset 8875d7c6a99d by Terry Jan Reedy in branch '2.7':
Issue #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 #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 #23184: idle tests, remove unused names and imports.
https://hg.python.org/cpython/rev/2a56eb5c08cc
History
Date User Action Args
2015-05-16 03:56:48terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2015-05-16 03:56:16python-devsetmessages: + msg243294
2015-05-16 03:04:24python-devsetmessages: + msg243293
2015-05-15 02:13:31terry.reedysetfiles: + @unused27.diff
2015-05-15 02:13:11terry.reedysetfiles: + @unused.diff

messages: + msg243239
2015-05-14 23:14:57terry.reedysetmessages: + msg243231
2015-05-14 23:13:51terry.reedysetmessages: + msg243230
2015-01-09 05:46:02Al.Sweigartsetmessages: + msg233717
2015-01-09 05:45:41Al.Sweigartsetfiles: + idle_unused_patch2.diff

messages: + msg233716
2015-01-08 06:14:06terry.reedysetmessages: + msg233624
2015-01-08 04:49:37python-devsetnosy: + python-dev
messages: + msg233623
2015-01-07 22:03:06terry.reedysetassignee: terry.reedy
type: behavior -> enhancement
versions: + Python 2.7
nosy: + terry.reedy

messages: + msg233606
stage: patch review
2015-01-07 10:26:58Al.Sweigartsettype: behavior
2015-01-07 10:26:51Al.Sweigartcreate