-
Notifications
You must be signed in to change notification settings - Fork 790
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
pycln: cleanup of more imports #2342
base: main
Are you sure you want to change the base?
Conversation
# try: | ||
# # seeif I can locate the demo files. | ||
# import fontdemo | ||
# except ImportError: | ||
# # else put the demos direectory on the path (if not already) | ||
# try: | ||
# instPath = regutil.GetRegistryDefaultValue( | ||
# regutil.BuildDefaultPythonKey() + "\\InstallPath" | ||
# ) | ||
# except win32api.error: | ||
# print( | ||
# "The InstallPath can not be located, and the Demos directory is not on the path" | ||
# ) | ||
# instPath = "." | ||
|
||
import sys | ||
# demosDir = win32ui.FullPath(instPath + "\\Demos") | ||
# for path in sys.path: | ||
# if win32ui.FullPath(path) == demosDir: | ||
# break | ||
# else: | ||
# sys.path.append(demosDir) | ||
# import fontdemo |
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.
The demo was already commented out above. TBD if fontdemo should just be removed entirely from here or added back in. It's possible that #2101 fixed w/e issue fontdemo had.
@@ -100,4 +100,4 @@ def SetEditorFontOption(option, newValue): | |||
SetEditorOption(option, str(newValue)) | |||
|
|||
|
|||
from pywin.framework.editor.color.coloreditor import editorTemplate | |||
import pywin.framework.editor.color.coloreditor # nopycln: import # Adds doc template |
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.
Assuming this side-effect is wanted here:
pywin32/Pythonwin/pywin/framework/editor/color/coloreditor.py
Lines 639 to 646 in 377a3ef
# For debugging purposes, when this module may be reloaded many times. | |
try: | |
win32ui.GetApp().RemoveDocTemplate(editorTemplate) # type: ignore[has-type, used-before-def] | |
except NameError: | |
pass | |
editorTemplate = SyntEditTemplate() | |
win32ui.GetApp().AddDocTemplate(editorTemplate) |
from . import ( # nopycln: import # Injects fast_readline into the IDLE auto-indent extension | ||
IDLEenvironment, | ||
) |
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.
If injecting in the extension isn't needed when IDLEenvironment
isn't used directly (it's imported in a couple other places), then this can be removed.
@@ -1,3 +1,4 @@ | |||
# nopycln: file # undecidable cases due to explicit re-exports https://github.com/hadialqattan/pycln/issues/205 |
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.
Ref.: hadialqattan/pycln#205
"pythoncom", | ||
"pywintypes", | ||
"win32api", | ||
"win32clipboard", | ||
"win32com", | ||
"win32cryptcon", | ||
"win32event", | ||
"win32file", | ||
"win32gui_struct", | ||
"win32gui", | ||
"win32inet", | ||
"win32inetcon", | ||
"win32pipe", | ||
"win32ras", | ||
"win32ui", | ||
"win32process", | ||
"win32security", | ||
"win32uiole", |
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.
Do you know if any of these produce side-effects in a way one might want to import the module w/o using any of its symbols?
"pythoncom",
"pywintypes",
"win32api",
"win32file",
"win32gui",
"win32process",
"win32security",
"win32uiole",
c88531e
to
b0490f2
Compare
See per-file comments for more details.
Some expanded star imports with lots of entries might be better as
import x
instead offrom x import a, b, c, ...