Skip to content

Commit 53c5527

Browse files
Mubashir78Mubashir78
authored andcommitted
Remove F401 (unused import) ignores and fix all violations
- Remove 12 unused imports across the codebase - Remove F401 from all per-file-ignores in pyproject.toml - Drop unused per-file-ignores entries for files where only F401 was ignored Part of #643
1 parent 339ea27 commit 53c5527

11 files changed

Lines changed: 12 additions & 26 deletions

File tree

comtypes/_npsupport.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ def enable(self):
157157
if self.enabled:
158158
return
159159
# first we have to be able to import numpy
160-
import numpy
161160

162161
# if that succeeded we can be enabled
163162
self.enabled = True

comtypes/automation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from ctypes import *
77
from ctypes import Array as _CArrayType
88
from ctypes import _Pointer
9-
from ctypes.wintypes import DWORD, LONG, UINT, VARIANT_BOOL, WCHAR, WORD
9+
from ctypes.wintypes import DWORD, LONG, UINT, VARIANT_BOOL, WORD
1010
from typing import TYPE_CHECKING, Any, ClassVar, Optional
1111

1212
import comtypes

comtypes/client/_constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#
55
################################################################
66
import keyword
7-
import sys
87

98
import comtypes
109
import comtypes.automation

comtypes/test/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
import glob
33
from distutils.core import setup
44

5-
import py2exe
65

76
setup(name="test_*", console=glob.glob("test_*.py"))

comtypes/test/test_agilent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
# connected, the driver is used in simulation mode.
44

55
import unittest
6-
from ctypes import POINTER, c_double
6+
from ctypes import c_double
77

88
from comtypes import GUID
99
from comtypes.client import CreateObject
1010
from comtypes.safearray import _midlSAFEARRAY
11-
from comtypes.test import ResourceDenied
1211

1312
try:
1413
GUID.from_progid("Agilent546XX.Agilent546XX")

comtypes/test/test_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def GetStackTrace(self, this, *args):
219219

220220
def test_GetStackTrace(self):
221221
p = wrap(self.create())
222-
from ctypes import POINTER, c_int, pointer
222+
from ctypes import c_int, pointer
223223

224224
frames = (c_int * 5)()
225225
res = p.GetStackTrace(42, frames, 5)
@@ -324,7 +324,7 @@ def OnSomethingElse(self, this, presult):
324324
path = tlb.compile()
325325
from comtypes.connectionpoints import IConnectionPointContainer
326326
from comtypes.gen import TestLib
327-
from comtypes.typeinfo import IProvideClassInfo, IProvideClassInfo2
327+
from comtypes.typeinfo import IProvideClassInfo2
328328

329329
MyServer._com_interfaces_ = [
330330
TestLib.IMyInterface,

comtypes/test/test_urlhistory.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import unittest
3-
from copy import copy
43
from ctypes import *
54

65
from comtypes.client import CreateObject, GetModule

comtypes/test/test_variant.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
VT_UI4,
4343
VT_UI8,
4444
)
45-
from comtypes.test.find_memleak import find_memleak
4645
from comtypes.typeinfo import LoadRegTypeLib
4746

4847

@@ -316,7 +315,6 @@ def check_perf(rep=20000):
316315
from ctypes import byref, c_int
317316

318317
import comtypes.automation
319-
from comtypes.automation import VARIANT
320318

321319
print(comtypes.automation)
322320
variable = c_int()

comtypes/tools/typedesc_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import Any, Optional, SupportsInt
33
from typing import Union as _UnionT
44

5-
import comtypes
65

76

87
class Argument:

docs/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import os
1414
import sys
1515

16-
import sphinx_rtd_theme
1716

1817
# If extensions (or modules to document with autodoc) are in another directory,
1918
# add these directories to sys.path here. If the directory is relative to the

0 commit comments

Comments
 (0)