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
bpo-29919: Remove unused imports found by pyflakes #137
Conversation
Please open an issue on the tracker. This is enough large change.
@@ -9,8 +9,7 @@ | |||
get_tk_patchlevel, widget_eq) | |||
from tkinter.test.widget_tests import ( | |||
add_standard_options, noconv, pixels_round, | |||
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests, | |||
setUpModule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setUpModule should be imported in the module namespace!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -8,8 +8,7 @@ | |||
from tkinter.test.support import (AbstractTkTest, tcl_version, get_tk_patchlevel, | |||
simulate_mouse_click) | |||
from tkinter.test.widget_tests import (add_standard_options, noconv, | |||
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests, | |||
setUpModule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -13,6 +13,6 @@ | |||
|
|||
__unittest = True | |||
|
|||
from .main import main, TestProgram |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks suspicious. Are you sure that TestProgram is not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lib/unittest/main.py ends with "main = TestProgram". And TestProgram is not used in Lib/unittest/main.py.
@@ -5,7 +5,7 @@ | |||
''' | |||
import unittest | |||
from test.support import requires | |||
from tkinter import Tk, Toplevel, Frame ##, BooleanVar, StringVar | |||
from tkinter import Tk, Frame ##, BooleanVar, StringVar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why BooleanVar and StringVar are commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are used in commented code a few lines below. I don't want to remove this commented code, since I don't know this file.
Here was my basis for approval. The change is an automated one using pyflakes and our unit-tests are successful. I could not spot anything critical after looking at the diff. ( That is, if things would have broken by removal of top-level imports, then we should have seen when the module was invoked). |
Gosh I'd love to enable flake8 on the stdlib, since it often causes my eyes to bleed red when I open a py file from the stdlib. But I suppose that will just cause unnecessary code churn. It's still nice to clean things up when you can, like unused imports. |
2017-02-18 0:35 GMT+01:00 Barry Warsaw <notifications@github.com>:
Gosh I'd love to enable flake8 on the stdlib, since it often causes my eyes to bleed red when I open a py file from the stdlib. But I suppose that will just cause unnecessary code churn. It's still nice to clean things up when you can, like unused imports.
Technically, it's possible, but you should expect a lot of "# noqa" to
ignore warnings when pyflakes is not smart enough to understand
"Python magic". For example, even with my patch, there are still tons
of "unused import" warnings.
|
Make also minor PEP8 coding style fixes on modified imports.
I rebased my patch and removed the two changes removing setUpModule() :-) |
@serhiy-storchaka: "Please open an issue on the tracker. This is enough large change." I don't see the value added by creating an issue, but ok, I created http://bugs.python.org/issue29919 :-) |
Thanks for the reviews! |
Add Stackless support to all call-API-functions in abstract.c
Add Stackless support to _PyObject_FastCallKeywords() and _PyFunction_FastCallKeywords.
Add Stackless support to _PyObject_Call_Prepend().
- Add Stackless support to _PyObject_FastCallKeywords(). - Use STACKLESS_PROPOSE_... in a consistent way.
Add Stackless support to _PyCFunction_FastCallKeywords().
Add Stackless support for METH_FASTCALL C-functions. Add a warning about the ABI change to the Stackless changelog.
Add documentation and a changelog entry.
Add Stackless support to _PyObject_CallFunctionVa() and related functions.
Fix Stackless support of _PyCFunction_FastCallKeywords().
Add Stackless support to _PyMethodDescr_FastCallKeywords().
Add Stackless support to cfunction_call_varargs().
Add Stackless support to function _PyObject_FastCall_Prepend().
Make also minor PEP8 coding style fixes on modified imports.
http://bugs.python.org/issue29919