Skip to content

Commit

Permalink
Removed unused imports found by type-checkers (#2124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Nov 1, 2023
1 parent 4722923 commit 9f24116
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 66 deletions.
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/app/helloapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import win32con
import win32ui
from pywin.mfc import afxres, dialog, window
from pywin.mfc import window
from pywin.mfc.thread import WinApp


Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/dyndlg.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import win32con
import win32ui
from pywin.mfc import dialog, window
from pywin.mfc import dialog


def MakeDlgTemplate():
Expand Down
3 changes: 1 addition & 2 deletions Pythonwin/pywin/Demos/ocx/msoffice.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
# It is not comlpete yet, but it _does_ show an Excel spreadsheet in a frame!
#

import regutil
import win32con
import win32ui
import win32uiole
from pywin.mfc import activex, docview, object, window
from pywin.mfc import docview, object, window
from win32com.client import gencache

# WordModule = gencache.EnsureModule('{00020905-0000-0000-C000-000000000046}', 1033, 8, 0)
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/threadedgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import win32api
import win32con
import win32ui
from pywin.mfc import docview, thread, window
from pywin.mfc import window
from pywin.mfc.thread import WinThread

WM_USER_PREPARE_TO_CLOSE = win32con.WM_USER + 32
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/debugger/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import win32ui
from pywin.framework import app, editor, interact, scriptutils
from pywin.framework.editor.color.coloreditor import MARKER_BREAKPOINT, MARKER_CURRENT
from pywin.mfc import afxres, dialog, object, window
from pywin.mfc import afxres, window
from pywin.tools import browser, hierlist

from .dbgcon import *
Expand Down
2 changes: 0 additions & 2 deletions Pythonwin/pywin/docking/DockingBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,6 @@ def EditCreator(parent):


def test():
import pywin.mfc.dialog

global bar
bar = DockingBar()
creator = EditCreator
Expand Down
8 changes: 1 addition & 7 deletions Pythonwin/pywin/framework/editor/color/coloreditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
import win32api
import win32con
import win32ui
from pywin.framework.editor import (
GetEditorFontOption,
GetEditorOption,
SetEditorFontOption,
SetEditorOption,
defaultCharacterFormat,
)
from pywin.framework.editor import GetEditorOption
from pywin.scintilla import bindings

# from pywin.framework.editor import EditorPropertyPage
Expand Down
11 changes: 1 addition & 10 deletions Pythonwin/pywin/framework/editor/configui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
import win32api
import win32con
import win32ui
from pywin.framework.editor import (
DeleteEditorOption,
GetEditorFontOption,
GetEditorOption,
SetEditorFontOption,
SetEditorOption,
defaultCharacterFormat,
editorTemplate,
)
from pywin.framework.editor import DeleteEditorOption, GetEditorOption, SetEditorOption
from pywin.mfc import dialog

from . import document
Expand Down Expand Up @@ -119,7 +111,6 @@ def OnInitDialog(self):
import traceback

traceback.print_exc()
pass

self.HookCommand(self.OnButSimple, win32ui.IDC_FOLD_ENABLE)
self.HookCommand(self.OnButSimple, win32ui.IDC_RADIO1)
Expand Down
4 changes: 1 addition & 3 deletions Pythonwin/pywin/framework/editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@
from pywin.framework.editor import (
GetEditorFontOption,
GetEditorOption,
SetEditorFontOption,
SetEditorOption,
defaultCharacterFormat,
)
from pywin.mfc import afxres, dialog, docview
from pywin.mfc import afxres, docview

patImport = regex.symcomp(r"import \(<name>.*\)")
patIndent = regex.compile(r"^\([ \t]*[~ \t]\)")
Expand Down
21 changes: 8 additions & 13 deletions Pythonwin/pywin/framework/winout.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@
import queue
import re

import pywin.scintilla.document
import win32api
import win32con
import win32ui
from pywin.framework import app, window
from pywin.mfc import docview
from pywin.scintilla import scintillacon

debug = lambda msg: None

##debug=win32ui.OutputDebugString
##import win32trace;win32trace.InitWrite() # for debugging - delete me!
##debug = win32trace.write
# debug=win32ui.OutputDebugString
# import win32trace;win32trace.InitWrite() # for debugging - delete me!
# debug = win32trace.write
# WindowOutputDocumentParent=docview.RichEditDoc
# WindowOutputDocumentParent=docview.Document
WindowOutputDocumentParent = pywin.scintilla.document.CScintillaDocument


class flags:
Expand All @@ -43,15 +47,6 @@ class flags:
WQ_IDLE = 2


# WindowOutputDocumentParent=docview.RichEditDoc
# WindowOutputDocumentParent=docview.Document
import pywin.scintilla.document
from pywin import default_scintilla_encoding
from pywin.scintilla import scintillacon

WindowOutputDocumentParent = pywin.scintilla.document.CScintillaDocument


class WindowOutputDocument(WindowOutputDocumentParent):
def SaveModified(self):
return 1 # say it is OK to destroy my document
Expand Down
5 changes: 2 additions & 3 deletions Pythonwin/pywin/scintilla/view.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# A general purpose MFC CCtrlView view that uses Scintilla.

import array
import os
import re
import string
Expand All @@ -11,10 +10,10 @@
import afxres
import win32con
import win32ui
from pywin.mfc import dialog, docview
from pywin.mfc import docview

from . import IDLEenvironment # IDLE emulation.
from . import bindings, control, keycodes, scintillacon
from . import bindings, control, scintillacon

PRINTDLGORD = 1538
IDC_PRINT_MAG_EDIT = 1010
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/tools/hierlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import win32api
import win32con
import win32ui
from pywin.mfc import dialog, docview, object, window
from pywin.mfc import dialog, object
from win32api import RGB


Expand Down
4 changes: 0 additions & 4 deletions Pythonwin/pywin/tools/regedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ def OnDeleteKey(self, command, code):
self.hierList.Refresh(hparent)

def OnAddKey(self, command, code):
from pywin.mfc import dialog

val = dialog.GetSimpleInput("New key name", "", "Add new key")
if val is None:
return # cancelled.
Expand All @@ -139,8 +137,6 @@ def OnAddKey(self, command, code):
self.hierList.Refresh(hitem)

def OnAddValue(self, command, code):
from pywin.mfc import dialog

val = dialog.GetSimpleInput("New value", "", "Add new value")
if val is None:
return # cancelled.
Expand Down
6 changes: 2 additions & 4 deletions com/win32comext/axdebug/Test/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
import win32api
import win32com.server.util
import winerror
from win32com.axdebug import adb, axdebug, codecontainer, contexts, documents, gateways
from win32com.axdebug.util import _wrap, _wrap_remove, trace
from win32com.axscript import axscript
from win32com.client.util import Enumerator
from win32com.axdebug import adb, axdebug, codecontainer, gateways
from win32com.axdebug.util import trace
from win32com.server.exception import Exception


Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/axdebug/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from . import adb, axdebug, gateways

# Utility function for wrapping object created by this module.
from .util import _wrap, _wrap_remove, trace
from .util import _wrap


class DebugCodeContext(gateways.DebugCodeContext, gateways.DebugDocumentContext):
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/axdebug/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
expressions,
gateways,
)
from win32com.axdebug.util import _wrap, _wrap_remove, trace
from win32com.axdebug.util import _wrap
from win32com.axscript import axscript

currentDebugger = None
Expand Down
4 changes: 2 additions & 2 deletions com/win32comext/axdebug/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from win32com.server.exception import Exception
from win32com.server.util import unwrap

from . import axdebug, codecontainer, contexts, gateways
from .util import RaiseNotImpl, _wrap, _wrap_remove, trace
from . import axdebug, gateways
from .util import _wrap, trace

# def trace(*args):
# pass
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/axdebug/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from win32com.server.exception import COMException

from . import axdebug, gateways
from .util import RaiseNotImpl, _wrap, _wrap_remove
from .util import RaiseNotImpl, _wrap


# Given an object, return a nice string
Expand Down
3 changes: 1 addition & 2 deletions com/win32comext/axscript/client/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

import pythoncom
import win32api
import win32com.client.connect
import win32com.server.util
import winerror
from win32com.axdebug import adb, axdebug, contexts, documents, gateways, stackframe
from win32com.axdebug import adb, axdebug, documents, gateways
from win32com.axdebug.codecontainer import SourceCodeContainer
from win32com.axdebug.util import _wrap, _wrap_remove
from win32com.client.util import Enumerator
Expand Down
7 changes: 1 addition & 6 deletions isapi/test/extension_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@
# This will execute the method 'test1' below. See below for the list of
# test methods that are acceptable.

import urllib.error
import urllib.parse
import urllib.request

# If we have no console (eg, am running from inside IIS), redirect output
# somewhere useful - in this case, the standard win32 trace collector.
import win32api
import winerror

from isapi import ExtensionError, isapicon, threaded_extension
from isapi.simple import SimpleFilter
from isapi import ExtensionError, threaded_extension

try:
win32api.GetConsoleTitle()
Expand Down

0 comments on commit 9f24116

Please sign in to comment.